Library Functions with "ahk2" Extension

Discuss the future of the AutoHotkey language
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

Library Functions with "ahk2" Extension

20 Nov 2018, 20:05

I just started using AutoHotkey v2. I plan to continue using both v1 and v2 for quite awhile as I slowly transition. I have both v1 and v2 installed and I set things up to use the ahk2 extension for the v2 scripts.

Got it all working with editing the register so that ahk2 scripts run properly and Windows views it as a valid extension. Got SciTE4AutoHotkey setup to work with both ahk and ahk2 script extensions and know how to run scripts properly when I hit the run button. All that went good and everything is working pretty well with running v1 and v2 side-by-side.

But I hit a snag with library functions. Is there a way to get library functions to work with the ahk2 extension?

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
User avatar
JoeWinograd
Posts: 1242
Joined: 10 Feb 2014, 20:00

Re: Library Functions with "ahk2" Extension

21 Nov 2018, 11:55

Hi FG,
I also recently started using V2 and want to pass along a suggestion to you, which is...don't use ahk2 as the file type. The first thing I tried was ahkv2...had a problem. Next thing I tried was ahk2...had the same problem. I posted this question on it:
https://autohotkey.com/boards/viewtopic.php?f=5&t=53788

Then this bug report on it:
https://autohotkey.com/boards/viewtopic ... 14&t=53840

As you can see, the problem is due to the 8.3 short file name. I change my AHK V2 file type to ah2 and haven't had a problem since. I don't know if this will affect your work with Library Fucntions, but wanted to make you aware of the issue. Regards, Joe
User avatar
nnnik
Posts: 4223
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Library Functions with "ahk2" Extension

21 Nov 2018, 12:03

Maybe it woduld be good if we can select the extension ahk registers for itself when we install the program.
I would also reccomend the AHK-EXE-SWAPPER and just use .ahk for all ahk files.
Recommends AHK Studio
FanaticGuru
Posts: 1355
Joined: 30 Sep 2013, 22:25

Re: Library Functions with "ahk2" Extension

21 Nov 2018, 14:22

nnnik wrote:
21 Nov 2018, 12:03
Maybe it woduld be good if we can select the extension ahk registers for itself when we install the program.
I would also reccomend the AHK-EXE-SWAPPER and just use .ahk for all ahk files.
Yea, I thought it would be nice if you could set the extension some way even if within the script with something like A_Extension or #Extension.

I would not mind setting the extension in the top of all my v2 scripts so the script would know to use "ahk2" or whatever in things like librarys where an extension is not used and the script is assuming the extension.

My understanding is that AHK-EXE-SWAPPER does not really allow you to run both v1 and v2 at the same time. It just allows you to swap your installation back and forth.

The way I have it is with two installs:
C:\Program Files\AutoHotkey
C:\Program Files\AutoHotkeyv2

Then I used RegEdit to associate "ahk" and "ahk2" to the appropriate AutoHotkey.exe in the appropriate folder. That part went pretty smooth and I now have no problem running v1 and v2 scripts at the same time. They also show up nicely in File Explorer with "AutoHotkey Script" and "AutoHotkey Script v2" in the Type column. They are handled basically like two totally independent applications.

I have SciTE4AutoHotkey working with both in a basic way but it is a work in progress. I did not use the stuff already build in related to v2. I just created a new "language" and copied the v1 files to the new language and began tweaked it for v2. So the highlighting is not specific to v2 and the intellisense completion all of that is not completely v2 appropriate. But it loads, saves, and runs v1 and v2 scripts. I took sorta the same approach with SciTE as I did with the install of treating v2 as a totally different application. I barely understand how all the setting files work in SciTE so this barely works. It doesn't help that I have modified SciTE with stuff from Lexikos that I only partially understand. I plan to study up and get a better understanding of SciTE to work better with v2 as a separate language.

If anyone has setup SciTE4AutoHotkey to work nicely with both v1 and v2 at the same time a link to your files would be greatly appreciated. I basically want to be able to have a v1 script on one tab and a v2 script in another tab and have SciTE behave appropriately with both.

Using Windows 10.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: jensff and 7 guests