Why won't AHK launch the Visual Studio Code app?

Viewed 230

This is how I can successfully open only the VS-Code app:

^!h::If !FileExist(code := StrReplace(A_AppData, "Roaming", "Local\Programs\Microsoft VS Code\Code.exe"))
MsgBox, 48, Error, File not found.\n`n%code%`
Run, %code%
return

However, here is my issue:

I use Stardock Groupy on my computer. Groupy groups any open window on your computer into tabs; an Explorer window, application, etc. You can group specific folders and files and save them as a custom group, which Groupy will save as a ".groupy" file. The file runs by selecting it within the Groupy "Saved Groups" dropdown, or you can double-click the ".groupy" file.

I have a custom ".groupy" file that opens (and groups into tabs) an Excel file and a text file that runs via VS-code. When I open my group, two things open successfully and get grouped into tabs: Excel and VS-Code.

Three ways successfully open both Excel and VS-Code into a tabbed group:

  1. Within Groupy's dropdown
  2. Double-clicking the ".groupy" file
  3. Running the following command in cmd: %AppData%\Groupy\CROSS_EXCEL_VS.groupy

I want to run this ".groupy" file via AHK, but when I do, the file runs, but only the Excel file opens. No matter how I try to run the .groupy file via AHK, VS-Code doesn't run at all.

Here are the various ways I've tried:

001:

run, %A_AppData%\Groupy\CROSS_EXCEL_VS.groupy

002:

If !FileExist(groupy := A_AppData "\Groupy\CROSS_EXCEL_VS.groupy")
MsgBox, 48, Error, File not found.\n`n%groupy%`
Run, %groupy%

003:

Run "C:\Users\ztwer\AppData\Roaming\Groupy\CROSS_EXCEL_VS.groupy"

004:

Run, C:\Program Files (x86)\Stardock\Groupy\Groupy32.exe
, "C:\Users\ztwer\AppData\Roaming\Groupy\CROSS_EXCEL_VS.groupy"

005:

run cmd /k "C:\Users\ztwer\AppData\Roaming\Groupy\CROSS_EXCEL_VS.groupy"

006:

commands="C:\Users\ztwer\AppData\Roaming\Groupy\CROSS_EXCEL_VS.groupy"
runwait, %comspec% /c %commands%

007:

run C:\Windows\System32\cmd.exe /C "C:\Users\ztwer\AppData\Roaming\Groupy\CROSS_EXCEL_VS.groupy",,hide

What can the problem be?

1 Answers

Found a way. I set C:\Program Files\AutoHotkey\AutoHotkey.exe compatibility setting to "Run this program as an administrator" and all works fine.

Related