How to associate .ahk default EDITOR to SciTE4AutoHotkey? Topic is solved

The popular SciTE-based AutoHotkey Script Editor
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

How to associate .ahk default EDITOR to SciTE4AutoHotkey?

21 Nov 2023, 09:43

I seem to have lost the SciTE editor association for my scripts (I'm using AHK v1 and the older 3.0.06.01 version of SciTE4AutoHotkey). I don't want to use the Windows settings because it just has a single association, which is correct for executing the files (AutoHotkey Unicode 64-bit). File browser Edit commands and the ones in notification icon menus both open the file for editing in Notepad. :roll:

I think this may be a Win 10 or 11 issue - earlier versions had separate settings for Open a file and Edit a file, but I can't find anything on Windows forums either. It's doing my nut! Please help!
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 11:26

I thought I'd bump this and ask it more simply:

The AutoHotkey Menu, Tray,... menu has a link "Edit This Script" which used to load the script into SciTE4AutoHotkey. It now opens into Notepad. I don't know how to fix this.

The same is true from a file browser context menu > Edit

If I change the associated program for file type .ahk to SciTE4AutoHotkey, launching scripts brings them into the editor instead of running them.

Is there a setting in SciTE, or in Windows?

I remember from earlier versions of Windows being able to set the default editor for files as well as the default for running, but I can't find this in Win11.
vmech
Posts: 357
Joined: 25 Aug 2019, 13:03

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?  Topic is solved

04 Dec 2023, 14:21

You can download latest Autohotkey v2 executable, install it, and launch built-in Autohotkey Dash to configure any actions that you can do with .ahk files.
Please post your script code inside [code] ... [/code] block. Thank you.
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 14:51

vmech wrote:
04 Dec 2023, 14:21
You can download latest Autohotkey v2 executable, install it, and launch built-in Autohotkey Dash to configure any actions that you can do with .ahk files.
Cheers, but I'm not ready to move to v2. Any thoughts on how to do this with v1 would be great.
I'm using AHK v1 and an older (3.0.06.01) version of SciTE4AutoHotkey. If there's no way to do it, I guess I might be able to find a way with a script - easy with the running ones with a tray icon and menu, but it would be neat to have it in the Explorer context menu. Failing that, Notepad++ at least adds its own "Edit with Notepad++" menu item in Explorer windows, but I'd rather stick with Sc4AHK.
User avatar
Datapoint
Posts: 296
Joined: 18 Mar 2018, 17:06

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 15:37

As vmech mentioned, the AHK Dash can change the associated editor for you. You may be able to run it without installing v2 if you download the zip and just run the Dash as portable (I have not tried). Also, you can install v2 alongside v1 and run both.
You could also look at the .ahk source for the AHK Dash. The part that changes the editor seems to be in ui-editor.ahk. It changes the registry key:
(Edit: ui-editor.ahk may change other things too, use at your own risk!)

HKEY_CURRENT_USER\SOFTWARE\Classes\AutoHotkeyScript\shell\edit\command

On my system that key contains:
Name: (Default)
Type: REG_SZ
Data: "C:\Program Files\AutoHotkey\SciTE\SciTE.exe" "%1"
Last edited by Datapoint on 23 Dec 2023, 07:39, edited 1 time in total.
vmech
Posts: 357
Joined: 25 Aug 2019, 13:03

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 15:52

ahketype wrote:
04 Dec 2023, 14:51
Cheers, but I'm not ready to move to v2.
Where did I indicate the need to switch to Autohotkey v2?
I pointed you to the easiest recipe for fixing .ahk file associations.
Then everything is in your hands - you can fix the breakdown, or you can continue to write conjectures and unfounded fears.
Please post your script code inside [code] ... [/code] block. Thank you.
User avatar
Datapoint
Posts: 296
Joined: 18 Mar 2018, 17:06

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 15:56

I would also add that in my experience, using the installers, it was painless to have both installed.
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 19:25

vmech wrote:
04 Dec 2023, 15:52
ahketype wrote:
04 Dec 2023, 14:51
Cheers, but I'm not ready to move to v2.
Where did I indicate the need to switch to Autohotkey v2?
OK, you didn't.
I pointed you to the easiest recipe for fixing .ahk file associations.
Why thank you, good Sir!
Then everything is in your hands - you can fix the breakdown, or you can continue to write conjectures and unfounded fears.
:crazy:
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 19:29

Datapoint wrote:
04 Dec 2023, 15:56
I would also add that in my experience, using the installers, it was painless to have both installed.
Cheers, I might try that again. I did install v2 when v1 was kinda being deprecated and somehow got in a mess with it. It might have been the update of SciTE4AHK - it lost its autocomplete at around the same time. In the end I decided to try to back-track to when I only had v1 installed and the earlier editor that wasn't broken. Since then I've not used the language much, and then had hardware changes and all sorts, just getting back into it now. I'll check out the instructions, and I might be best uninstalling all of it and starting again.
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

04 Dec 2023, 19:39

I ran the SciTE4AutoHotkey installer again, and it reports it can't find AutoHotkey, so that right there is probably an issue!
ahketype
Posts: 191
Joined: 27 Oct 2016, 15:06
Location: Yorkshire, UK

Re: How to associate .ahk default EDITOR to SciTE4AutoHotkey?

05 Dec 2023, 11:47

Yeah, as @vmech said, the v2 installation allows setting of the default editor for ahk scripts, so all I had to do was reinstall v2. I just set it to the 3.0.06.01 version of SciTE4ahk and all's well. Thanks - and @Datapoint, for the detailed info.

Return to “SciTE4AutoHotkey”

Who is online

Users browsing this forum: No registered users and 3 guests