I'm writing some scripts to easily change the printer selection for my work. These will be called by a C# GUI - so to make things easier on myself I thought I'd just compile some ahk scripts as .exe and run it through C# with Process.start.
I got my script working as intended and went to compile the script as an .exe but it seems it doesn't recognize the if statement and just plainly ignores it. Resulting in multiple instances of the msgbox.
It also straight up ignores the WinActivate function.
TLDR: Script works as intended as .ahk file but not as .exe
Here's my code:
Code: Select all
if WinExist("Print")
{
Sleep, 100
WinActivate, Print
Sleep, 100
ControlClick, ComboBox1, Print
Sleep, 10
Send, M
Send, A
Send, A
Send, A
Send, A
Send, {Enter}
Sleep, 1000
MsgBox, 64, A4 Zwart/Wit, U heeft geslecteerd: A4 Zwart/Wit, 5
Exit
}
else
MsgBox, "ERROR, no print menu found, exiting"
Exit
I hope you guys can help me out! Thanks in advance