Jump to content

Drag-and-drop files or folders to .au3 scripts


ning
 Share

Recommended Posts

Hi,

I have several scripts that accept filename(s) as parameters. Using Windows Explorer, I can drag-and-drop files onto programs (.EXE files), and the names of those files will be passed as parameters to the program. However, no such drag-and-drop functionality exists by default for .au3 scripts. To get this, you have to compile the script. Or alternatively, you can change a setting in the Registry that specifies the drop handler for .au3 files.

The setting is in:

HKEY_CLASSES_ROOT\AutoIt3Script\shellex\DropHandler

(you will probably need to create this key)

Just change the (default) setting to:

{86C86720-42A0-1069-A2E8-08002B30309D}

Close Registry Editor, refresh an Explorer window, et voila! You can now drag-and-drop files onto .au3 scripts.

I've attached a .reg file to do the change automatically without opening Registry Editor - just double-click the file to merge the file with your Registry. [edit: seems I'm not allowed to upload .reg files, so rename it after downloading.]

OK, it's not earth-shattering, but I thought it was quite useful, so I'm sharing it with you... :whistle:

ben

Drag_and_drop_support_for_au3_scripts.reg.txt

Link to comment
Share on other sites

The registry edit in AutoIt-script form:

RegWrite("HKEY_CLASSES_ROOT\AutoIt3Script\shellex\DropHandler", "", "REG_SZ", "{86C86720-42A0-1069-A2E8-08002B30309D}")

By the way, you probably need the default action when you double-click a script to be Run instead of Edit (which it could be for some people who've installed SciTE).

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

ok, i did that...

but i dont completely understand this. so i drag them to the tray icon or a GUI? once i do, how do i get the filename and path from the file dragged there?

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

but i dont completely understand this. so i drag them to the tray icon or a GUI? once i do, how do i get the filename and path from the file dragged there?

<{POST_SNAPBACK}>

Save the following example script to your desktop. Then drag a file into its icon:

; Sample script to handle command line args 
Dim $list = ""
For $i = 1 to $CmdLine[0]
    $list = $list & $CmdLine[$i] & @CRLF
Next

MsgBox(4096,"Info", "The following file(s) was provided on the command line:" & @CRLF & $list)
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...