0
votes

I made an AHK script that compiles my keyboard layout in AHK, moves it to the Windows 10 startup folder, and then runs it. When I run the script and press the key combo it does run, and everything functions except the initial send of Ctrl + F7, which is supposed to compiles the script in my editor. I've tried a few things, but it hasn't worked so far. Thanks for your help, and I've attached the code below.

#IfWinActive, ahk_class SciTEWindow ;if script editor is open
    $<^F7:: ;if ctrl+F7 is pressed
    Sleep, 200 ;wait a 0.2 seconds
    Send {^F7} ;send ctrl+F7 to compile script (this line isn't working)
    Sleep, 2000 ;wait 2 seconds for the script to compile
    FileCopy, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe, C:\Users\jackn\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, 1 ;Copies the file to the startup folder
    Sleep, 100;waits 0.1 seconds
    run, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe ;runs the program
    return
return
1

1 Answers

1
votes

Instead of

Send {^F7}

Use

Send ^{F7}

Full Script:

#IfWinActive, ahk_class SciTEWindow ;if script editor is open
    $<^F7:: ;if ctrl+F7 is pressed
    Sleep, 200 ;wait a 0.2 seconds
    Send ^{F7} ;send ctrl+F7 to compile script (this line has been changed)
    Sleep, 2000 ;wait 2 seconds for the script to compile
    FileCopy, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe, C:\Users\jackn\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, 1 ;Copies the file to the startup folder
    Sleep, 100;waits 0.1 seconds
    run, C:\Users\jackn\Typing\Key Mappings\Startup Folder Layouts\keymap.exe ;runs the program
    return
return