hotstrings in AHK 2

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dentopolis
Posts: 125
Joined: 06 May 2016, 16:28

hotstrings in AHK 2

16 Oct 2021, 13:04

I've a script with many hotstrings, everything written in AHK 1 and it still works even if I've installed AHK 2 beta, but I'd like to move to AHK 2 to learn it and use in a future, so I've changed old code:

Code: Select all

::zn1::
SendInput, anaesthetic 1 amp. Citocartin 100 (40 mg Articaini hydrochloridum + 0,01 mg Adrenalini tartas),{space}
Return

::e1::
SendInput, izolacja pola zabiegowego koferdamem, opracowanie komory, ostateczne opracowanie kanału MAF 25 0.06 mm, 17`% EDTA, płukanie 5`% NaOCl, aktywacja ultradźwiękami, płukanie 40`% kwas cytrynowy, osuszenie i wypełnienie kanałów gutaperka 25 0.06 z AH{+}, rtg, opatrunek tymczasowy Kromoglass
Return
to new according to docs, but after I write "zn1" or "e1" script sends much more text, even from other hotstrings. That's strange. What should I change?

Code: Select all

::zn1::
{
SendInput anaesthetic 1 amp. Citocartin 100 (40 mg Articaini hydrochloridum + 0,01 mg Adrenalini tartas),{space}
}

::e1::
{
SendInput "izolacja pola zabiegowego koferdamem, opracowanie komory, ostateczne opracowanie kanału MAF 25 0.06 mm, 17`% EDTA, płukanie 5`% NaOCl, aktywacja ultradźwiękami, płukanie 40`% kwas cytrynowy, osuszenie i wypełnienie kanałów gutaperka 25 0.06 z AH{+}, rtg, opatrunek tymczasowy Kromoglass"
}
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: hotstrings in AHK 2

16 Oct 2021, 13:15

"much more text" ? Senseless text? duplicate text? ...?
dentopolis
Posts: 125
Joined: 06 May 2016, 16:28

Re: hotstrings in AHK 2

16 Oct 2021, 14:23

text from other hotstrings from below the currently executed.
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: hotstrings in AHK 2

16 Oct 2021, 16:46

I suspect that the v2 script is inadvertently being run by a version 1 copy of AutoHotkey.exe.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: hotstrings in AHK 2

17 Oct 2021, 00:55

TAC109 wrote:
16 Oct 2021, 16:46
I suspect that the v2 script is inadvertently being run by a version 1 copy of AutoHotkey.exe.
Looks like it.

Edit: @dentopolis There exists a #requires directive that could help you catch when a script is not being executed with the expected version. For example puting at the top of script #Requires AutoHotkey v2.0-beta.1
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: hotstrings in AHK 2

17 Oct 2021, 07:26

Using ah1 and ah2 extensions indeed makes sense.
I would also advice to start using the #Requires command at the start of the scripts to detect if the version is wrong.

Your conversion of the zn1 hotkey seems to be wrong.

To make the conversion easier of a large scripts, you can use this convertor.

This is what the convertor gave:

Code: Select all

#Requires AutoHotkey v2.0-beta.1

::zn1::
{ ; V1toV2: Added bracket
SendInput("anaesthetic 1 amp. Citocartin 100 (40 mg Articaini hydrochloridum + 0,01 mg Adrenalini tartas),{space}")
Return
} ; V1toV2: Added Bracket before hotkey or Hotstring

::e1::
{ ; V1toV2: Added bracket
SendInput("izolacja pola zabiegowego koferdamem, opracowanie komory, ostateczne opracowanie kanału MAF 25 0.06 mm, 17`"  EDTA, płukanie 5` " NaOCl, aktywacja ultradźwiękami, płukanie 40`"  kwas cytrynowy, osuszenie i wypełnienie kanałów gutaperka 25 0.06 z AH{+}, rtg, opatrunek tymczasowy Kromoglass")
Return
} ; V1toV2: Added bracket in the end

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 302 guests