ahkscript / SublimeAutoHotkey

AutoHotkey AHK language package for SublimeText including syntax highlighting, comments toggling, auto-completions, build system definitions, commands for ahkrun, ahkcompile, ahkrunpiped.
The Unlicense
207 stars 43 forks source link

Inconsistent execution bug #52

Closed akaleeroy closed 5 years ago

akaleeroy commented 5 years ago

Steps to reproduce

output := ComObjCreate("WScript.Shell").Exec("powercfg /requests").StdOut.ReadAll()  
MsgBox % output

Run from Sublime Text it will show an incorrect output, different from the output of running powercfg /requests from a command prompt. Run by clicking on the .ahk file it will show the correct output.

Also described in ComObjCreate("WScript.Shell").Exec("powercfg /requests") returns different output than actual command run in command prompt : AutoHotkey

Fix

Using AutoHotkeyU32.exe / AutoHotkeyA32.exe on x64 systems runs into this bug.
Changing to a 64-bit executable fixes it.

AutoHotkey.sublime-settings

{
  "AutoHotKeyExePath":
  {
    "default": "C:\\Program Files\\AutoHotkey\\AutoHotkey.exe"
  }
}
robertcollier4 commented 5 years ago

Fixed with Commit 8cc1631 - "ahkrun and ahkcompile allow targeting multiple ahk versions"

akaleeroy commented 5 years ago

In my opinion fixing the bug would be to automatically pick the correct executable based on system architecture.