Getting a debugger running: setting up path to AHK

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
adamrice
Posts: 4
Joined: 20 Jun 2019, 16:30

Getting a debugger running: setting up path to AHK

20 Jun 2019, 16:37

I'm new to Windows (thanks to a new job), so there's a baseline of knowledge that is probably common to most AHK users that I lack.

I'm trying to get a debugger running (the plugin for Notepad++) and have run aground on editing $PATH to include the path to AHK.

Thanks, in advance. I'll probably run aground on something else soon enough.
lexikos
Posts: 9683
Joined: 30 Sep 2013, 04:07
Contact:

Re: Getting a debugger running: setting up path to AHK

21 Jun 2019, 04:24

I haven't used the Notepad++ debugger in a long time, but I don't think it needs the path to AutoHotkey. It just listens for network connections, which can come from AutoHotkey, xdebug (PHP) or some other source.

IIRC, I think you need to open the DBGp plugin pane and start listening (there's a sort of "play" button), then run AutoHotkey.exe /Debug "YourScript.ahk" from the command line or via NppExec.

You are probably better off with an integrated solution, such as AHKStudio or SciTE4AutoHotkey.
adamrice
Posts: 4
Joined: 20 Jun 2019, 16:30

Re: Getting a debugger running: setting up path to AHK

21 Jun 2019, 09:25

Thank you, I'll give those a shot, but I still need to figure out how to set the path to look for AHK so I can launch the debugger from the command line.
lexikos
Posts: 9683
Joined: 30 Sep 2013, 04:07
Contact:

Re: Getting a debugger running: setting up path to AHK

21 Jun 2019, 21:57

It isn't strictly necessary to modify PATH; that would just avoid the need to specify the path of AutoHotkey.exe each time. You can alternatively create a command alias or script that takes the script name as a parameter and executes AutoHotkey.exe /Debug. How do you plan to execute the command?

If from a command prompt, you'll probably want to modify PATH "permanently". The easiest way is probably via the GUI:
  • Open the Environment Variables dialog.
    Method 1:
    • Using the Start menu's search function, Cortana or Control Panel's search function, search for "env" and select "Edit the system environment variables".
    • Click "Environment Variables".
    Method 2:
    • Run rundll32 sysdm.cpl,EditEnvironmentVariables
    • Note that unless you run as admin, this method can only modify the current user's environment.
    It can also be accessed via "Advanced system settings" under System properties, which can be accessed several different ways.
    -
  • Select "Path"
  • Click "Edit", "New"
  • Enter path of AutoHotkey directory
  • Click "OK" multiple times
  • Relaunch your command prompt or program via Explorer for the changes to take effect


If you want to stick with Notepad++, I would suggest using the NppExec plugin. The plugin has a "startup" script which (iirc) executes automatically when the plugin initializes. You can use it to set up variables and aliases. I forget where the script is located, so I just use the Execute (F6) dialog to edit and save it. For example:

Code: Select all

set AhkPath = $(SYS.PROGRAMFILES)\AutoHotkey\AutoHotkey.exe
npe_cmdalias dbg = "$(AhkPath)" /Debug "$(FULL_CURRENT_PATH)" $(ARGV)
If you are using Notepad++ x86 on Windows x64, you'll probably need to replace PROGRAMFILES with ProgramW6432 or just write the actual full path.

Then you can execute dbg or dbg some args from the NppExec console.

If you save the command (everything after =) as an NppExec script, you can execute it by \scriptname (backslash followed by script name) in the NppExec console or in another NppExec script.

You can also set up an NppExec script to save the document (npp_save) and clear the console (cls) before executing AutoHotkey. It takes a bit of work to set up, but once set up you can execute it easily by typing a simple command alias or pressing F6 or Ctrl+F6.

I'm not sure if it's necessary anymore, but I remember I had to enable the option "Bypass all mapping" in the DBGp plugin's config before the plugin would work.

There's no "play" button like I thought I remembered; the DBGp plugin starts listening automatically once you show the DBGp pane (by selecting Debugger from the plugin menu).


I haven't used Notepad++ with AutoHotkey since these were written, but they might be helpful:
adamrice
Posts: 4
Joined: 20 Jun 2019, 16:30

Re: Getting a debugger running: setting up path to AHK

27 Jun 2019, 13:37

Got it. Thank you for all the help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: GEOVAN and 173 guests