Note that there are some explanatory texts on larger screens.

plurals
  1. POGet path of selected Windows Explorer file in AutoIt
    primarykey
    data
    text
    <p>My AutoIt script worked as long as I used it via command line. There I could use <code>$CmdLine[1]</code> and pass a path as argument. Now I try to convert the script to a new method to avoid command line arguments. </p> <p>You open an Explorer Window and select a file e.g <code>C:\test.txt</code>. After that you trigger the AutoIt function with <strong><kbd>CTRL</kbd>+<kbd>WIN</kbd>+<kbd>C</kbd></strong>. The script should look what file is selected in the active Explorer Window and retrieve the path <code>C:\test.txt</code> and assign it to <code>$file</code> variable.</p> <p>This is my work-in-progress where I'm stuck.<br> Line 5 <code>$CmdLine[1]</code> needs to be changed to a secret function I don't know.</p> <pre><code>;Assign key combination "CTRL-WIN-C" to function "copyUNC" HotKeySet("^#c", "CopyUNC") ;function to copy UNC path of selected Windows Explorer file/folder to clipboard func CopyUNC() $file = FileGetLongName($CmdLine[1]) ;THIS LINE NEEDS TO BE CHANGED $drive = StringLeft($file, 2) $UNCdrive = DriveMapGet($drive) If $UNCdrive = "" Then $UNCfile = $file else $UNCfile = $UNCdrive &amp; StringTrimLeft($file, 2) endif ClipPut($UNCfile) endfunc ;necessary loop so AutoIt script stays active and in Tray While 1 Sleep(100) WEnd </code></pre> <p><strong>Q:</strong> How do I get the path of a selected file/folder from Windows Explorer into <a href="http://www.autoitscript.com/site/autoit/downloads/" rel="nofollow">AutoIt v3.3.8.1</a>? </p> <p><em>Note #1:</em> I don't want to use registry and right-click tricks to pass the argument<br> <em>Note #2:</em> If multiple files are selected just pass the first file. Don't overcomplicate things</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload