| 4471 | } |
| 4472 | |
| 4473 | void LaunchAutoHotkeyUtil(LPTSTR aFile, bool aIsScript) |
| 4474 | { |
| 4475 | LPTSTR file = aFile, args = _T(""); |
| 4476 | bool our_file, result = false; |
| 4477 | if (!FindAutoHotkeyUtil(aFile, our_file)) |
| 4478 | return; |
| 4479 | #ifndef AUTOHOTKEYSC |
| 4480 | // If it's a script in our directory, use our EXE to run it. |
| 4481 | TCHAR buf[64]; // More than enough for "/script WindowSpy.ahk". |
| 4482 | if (aIsScript && our_file) |
| 4483 | { |
| 4484 | sntprintf(buf, _countof(buf), _T("/script %s"), aFile); |
| 4485 | file = g_script.mOurEXE; |
| 4486 | args = buf; |
| 4487 | } |
| 4488 | //else it's not a script or it's the installed copy of WindowSpy.ahk, so just run it. |
| 4489 | #endif |
| 4490 | if (!g_script.ActionExec(file, args, NULL, false)) |
| 4491 | { |
| 4492 | TCHAR buf_file[64]; |
| 4493 | sntprintf(buf_file, _countof(buf_file), _T("Could not launch %s"), aFile); |
| 4494 | MsgBox(buf_file, MB_ICONERROR); |
| 4495 | } |
| 4496 | SetCurrentDirectory(g_WorkingDir); // Restore the proper working directory. |
| 4497 | } |
| 4498 | |
| 4499 | void LaunchWindowSpy() |
| 4500 | { |
no test coverage detected