Page 1 of 4

External Tools plugin how-to?

Posted: 03.03.2023 20:38
by qwerky
Hi. Can't get the External Tools plugin to execute an external program. Obviously operator error, but I can't figure out the correct parameters for all the fields in the configure dialog.

What I want is this: when I press the correct hotkey (or run from the menu), I want to run an AutoHotkey script. So, I have the "Shell command" box checked, the "Name" field contains "view.ahk", the "File name" field contains the fully qualified path to autohotkey.exe, the "Parameters" field contains the fully qualified path to view.ahk (the script), and I also set the "Initial folder" field to the autohotkey.exe directory. I've also tried variations on these settings. I always get the error "Script file not found: path".

Posted: 03.03.2023 20:52
by Stefan
This works for me:

File Name: D:\Toolbox\ahk\AutoHotkeyU64.exe
Shell Command Checkbox = DISABLED
Parameters: "D:\Toolbox\ahk\YourScript.ahk"

Please note the quotes around "YourScript.ahk"

Posted: 03.03.2023 22:10
by qwerky
@Stefan, thanks! I had also tried without the Shell checkbox without success, but it was adding the quotes around the Parameters that made it work; thanks for pointing that out! :D

So, now it executes successfully. But, every time I run it, it opens the bottom panel, which I have no need for with this script. Is there any way to prevent it from opening the bottom panel?

Posted: 03.03.2023 22:13
by Stefan
Further down on that dialog, in the field where it says "Capture Output" — set it to Ignore.

Posted: 03.03.2023 22:16
by qwerky
Oops, we were posting at the same time, sorry.

Yes, I found the Ignore option in the "Capture output" field, thanks.

So, I notice you are using AutoHotkeyU64.exe, rather than just autohotkey.exe. I'm not a frequent user of AutoHotkey, and certainly not an expert, but am wondering what the difference is? Obviously that file is for x64 systems (which mine is), but about the 'U', I suspect that it means it is a Unicode version? And so it would use Unicode fonts?

That might be helpful to me, as I was trying to make use of some box-drawing characters, and it wasn't working.

Posted: 03.03.2023 22:20
by Stefan
Yes, exactly. Unicode.
I assume, you are running AHK 1.1.* and not AHK 2?

Posted: 03.03.2023 22:26
by qwerky
Yes, 1.1.*. I was just reading about 2.0 yesterday. What do you think? Time to upgrade?

I think I need to do more than just run AutoHotkeyU64.exe in order to get the characters to display correctly. Maybe I need to specify a Unicode font specifically?

Posted: 03.03.2023 22:29
by Stefan
Too early to upgrade, imo.

Not sure I can help you with your script. What exactly do you want to accomplish?

Posted: 03.03.2023 22:33
by Stefan
Btw, instead of handing YourScript.ahk over to the exe, you could simply just call the exe without any parameters at all.
Just rename the autohotkey.exe to YourScript.exe. It will then open automatically the same-named script YourScript.ahk

It will attempt to find YourScript.ahk - in the following locations, in this order:
* the directory which contains the AutoHotkey executable
* the current user's Documents folder

Posted: 03.03.2023 22:42
by qwerky
Thanks for all the input. I'm just reading up in the AutoHotkey help file. I think I need to set a default encoding parameter, so that a text file is opened as Unicode, rather than ANSI.

What my simple little script (which I will compile when ready) is designed to do, when I press the hotkey in CudaText, is to read and display a specific, standard text file in a set size and location; i.e. a file viewer. The text file, which may be altered by the user, is a help file for all the CudaText commands and their hotkeys, as I have them defined.