Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am experiencing inconsistent hotstring expansions in ahk. For example the following hotstring


worked till yesterday, but after today's boot/reboot cycle , it isn't.

The hotkeys still work, like this one below

    ;Run, Notepad.exe
    fname = %Clipboard% ;Open file in Clipboard, if it exists - similar to functionality in DOPUS
    ;MsgBox Before %fname%
    StringSplit, fname, fname, `r`n
    ;MsgBox %fname0%
    if (fname0 > 0) {
        ;convert newline seperated files to space seperated arguments for program
        StringReplace, fname, fname, `r`n, "%A_Space%", All
        fname = "%fname%"
        ;MsgBox parameters are %fname%
    If !FileExist(fname1) {
        ;check for single element first
        fname = 
    Loop %fname0%-1
        element := fname%A_Index%
        ;element = "%element%"
        ;MsgBox %element%
        ;params = %params% %element%
        If !FileExist(element) {
            ;MsgBox Resetting fname as %element% doesn't exist.
            fname = 
    ;MsgBox After %app% %fname%
    Run, %app% %fname%
#y::OpenClipboardFileWith(Share "\Programs\@Text\Editors\Notepad2\notepad2.exe") ;;Notepad (open file on clipboard)
#n:: Run, notepad.exe

So I don't know what the issue is. This happens on and off and I had experienced this problem on another computer as well. I am guessing it has to do with the keyboard and mouse hooks. I checked in the script listing (right click ahk icon > vew script info) and it was fine, the hooks are installed.

How do I go about resolving this issue?

I tested if it running as admin.

MsgBox , , , %A_IsAdmin%

and it says 1. I event tried these programs and but no help from those. It shows me the regular hotkeys as being registered, but nothing about hotstrings. Any other tools that can detect and sort these issues out? The question is of no help.

Anybody else seeing similar issues?

Another related issue might be that, drag & drop randomly stops working, and I have to use the press and hold left mouse button, press ESC several times to get it to work (not consistently though).

I am guessing that out of the various programs installed on the pc, one is causing this issue.

share|improve this question

3 Answers 3

Your problem with "drag & drop" is a lesser known Windows 7 "feature". The way to restore drag & drop until Redmond has found the time to patch it, is to hit Ctrl + Alt + Del and then when the blue selection page pops up, hit ESC again. I know it sounds stupid, but it works every time.

For one reason or the other your:


still required a space, so I changed it to:


Which works flawlessly.

share|improve this answer
thanks for the tip on the Esc button. But I still have problem with expansion. I don't mind the space requirement. Another example that won't work is :c?:@sig::Regards,{Enter 2}Name ;; – Vijay Jan 29 '13 at 7:40
For one reason or the other your expansion initially did not work here either. Once I removed the c? and @ it worked and after I placed the c? and @ back it continued working. I suggest to throw it away and type (not copy) it again. Not sure why. B.t.w. why did you add the ?, This means that it will expand if you write a letter to to ABCRegards, – Robert Ilbrink Jan 29 '13 at 8:34
good point. Didn't think of it in the email context i suppose. Ok I'll try. Tested ::test::Woohoo it didn't work. in a new blank script. Using AHK – Vijay Jan 29 '13 at 11:02
This is strange. I use Does autoHotKey keep running (Green H icon) or does it close immediately after you started it? – Robert Ilbrink Jan 29 '13 at 12:25
Since you seem to have weird behaviour, have you tried re-installing AutoHotKey? – Robert Ilbrink Jan 30 '13 at 8:17

It finally started working after disabling UAC.

share|improve this answer
Ugh I had this problem on another computer again. Disabled UAC and it's working, but I still don't know why it happened in the first place when it was working with UAC for a while. I think maybe an update disabled this? Anybody with more insight into the issue? – Vijay Oct 9 '13 at 5:01

I was having a problem with some of my expansions not working. But the problem was the script itself. I included a script which someone else had written however I didn't realise quite the way it worked.

It had a directive like

#IfWinActive, ahk_class Blah

It didn't have an ending blank


What that meant was that all the hotkeys and expansions following that initial directive (which was most of my expansions) were only applied in the context Blah

To fix it I added the extra directive


after the one which started it. That makes the context apply to anything again.

An example of a problem script would be

;This is for in a Console Window
#IfWinActive, ahk_class ConsoleWindowClass
; Some short cut here

::ex::Some expand which I expect to happen in all situations (which doesn't)

To fix that script you would need to do the following

;This is for in a Console Window
#IfWinActive, ahk_class ConsoleWindowClass
; Some short cut here

::ex::Some expand which I expect to happen in all situations (which  it now does)

For more information on how this works look at

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.