Page 1 of 1

Error after compiling to exe

Posted: 20 Apr 2019, 15:10
by 4kingrich
I created a simple code for F1-F12 keys and some multimedia shortcuts.

Running the ahk file works fine with no errors but as soon as it's converted to .exe using Ahk2Exe it produces an error at line 1.
Error at line 1.

Line Text: *F & 1::
Error: Invalid Hotkey.

The Program will exit.


The error looks like it adds an asterix * on the first line for some reason.

Here is the code:

Code: Select all

F & 1::F1
F & 2::F2
F & 3::F3
F & 4::F4
F & 5::F5
F & 6::F6
F & 7::F7
F & 8::F8
F & 9::F9
F & 0::F10
F & -::F11
F & =::F12

+F::Send F
F::Send f

#If GetKeyState("CapsLock", "T") = 1
F::Send F



^=::Send {Volume_Mute}
^-::Send {Volume_Up}  
^0::Send {Volume_Down}
Please help, thank you.

Re: Error after compiling to exe

Posted: 21 Apr 2019, 01:12
by Osprey
It could be because you're running the script with one version of AutoHotkey and compiling it with another. Go to the Compiler folder, delete AutoHotkeySC.bin, make a copy of the .bin that corresponds to the AutoHotkey executable that you're using (i.e. ANSI 32-bit.bin if using AutoHotkeyA32.exe, Unicode 32-bit.bin if using AutoHotkeyU32.exe or Unicode 64-bit.bin if using AutoHotkeyU64.exe) and rename that copy to AutoHotkeySC.bin.