using a global variable

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
clarson

using a global variable

16 Dec 2017, 10:26

I'm trying to use a global variable. And, I'm not getting it to work.

this works

!q::
fname = text
send, %fname%{enter}
return

this doesn't, no text, just a new line

fname = text
!q::
send, %fname%{enter}
return

What I'm I doing wrong?
Thanks for the help
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: using a global variable

16 Dec 2017, 11:21

You must set the variable BEFORE sending the text.
You may set the variable at the beginning of the script, or you can set the variable inside the hotkey (Like the first example you have)

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

clarson

Re: using a global variable

16 Dec 2017, 12:36

thanks

I needed to set the global variable at the beginning of the script.

Thanks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Rohwedder and 308 guests