Drag-Drop onto .ahk suddenly does ... nothing.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ed1chandler
Posts: 15
Joined: 15 May 2015, 11:18

Drag-Drop onto .ahk suddenly does ... nothing.

22 May 2015, 12:49

Hey, all,

After writing a few scripts that trigger when other files are dropped on top of them, they were working as expected. Now, dragging and dropping onto a .ahk file does nothing.

Just to make sure it wasn't me, I tried using the code from Example 6 here https://www.autohotkey.com/docs/commands/LoopFile.htm. When I drop a text file named test.txt on top of it, ... nothing. Dragging and dropping in general still works, and I can drop a script onto autohotkey.exe and it runs, but if I drop a file onto an .ahk ... nada.
  • I added a MsgBox at the top of the script, just to see if it was executing at all ... nope.
  • Other scripts running? Nope.
  • Run as Administrator? Not normally, but tried both ways -- nope.

Code: Select all

MsgBox, FIRE ; <-- I added this to see if the script even fired.
Loop %0%  ; For each file dropped onto the script (or passed as a parameter).
{
    GivenPath := %A_Index%  ; Retrieve the next command line parameter.
    Loop %GivenPath%, 1
        LongPath = %A_LoopFileLongPath%
    MsgBox The case-corrected long path name of file`n%GivenPath%`nis:`n%LongPath%
}
ExitApp
Any ideas what could cause drag/drop to stop working?
Incidentally, running "autohotkey.exe ThatScriptAbove.ahk Test.txt" from the command line works just fine.
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Drag-Drop onto .ahk suddenly does ... nothing.

22 May 2015, 20:07

When you drag a file over a script file, does it highlight the script file? If not, the file type or drag-drop handler registration is probably corrupt.

First, delete the following registry key if it exists:

Code: Select all

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ahk\UserChoice
If present, this key overrides the .ahk -> AutoHotkeyScript file type association. It is created if you use the "Choose default program" function of Windows Vista or later to change the program associated with .ahk files. It is a per-user setting and is protected against modification by programs (other than Explorer itself).

If the key doesn't exist or you still have a problem, reinstall AutoHotkey and ensure the "Enable drag & drop" option is ticked.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: bobstoner289, peter_ahk, Spawnova and 340 guests