How to use access a global variable from a hotkey Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
theholyscripture
Posts: 62
Joined: 26 Apr 2019, 17:11

How to use access a global variable from a hotkey

20 Mar 2020, 23:13

Hi all, I'm trying to use a variable to designate the key to be sent but I'm not able to access the variable outside of the hotkey, where I would rather it be declared. Thank you.


Code: Select all

key := "Space" ; I WANT MY HOTKEY TO ACCESS THIS AND NOT HAVE TO DECLARE key IN HOTKEY

RAlt::
;key := "Space"
ControlFocus,,Mozilla Firefox
ControlSend,,{%key%},Mozilla Firefox ; works when ;key := "Space" is uncommented

return
theholyscripture
Posts: 62
Joined: 26 Apr 2019, 17:11

Re: How to use access a global variable from a hotkey  Topic is solved

20 Mar 2020, 23:24

Edit: I got it. I just had to declare my key variable above everything else in my script. There were other hotkeys/code above the code I chose to show for the question.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jameswrightesq, mikeyww, wpulford and 334 guests