Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Example

#Persistent
fileName = H:\Data\Desktop\myfile.txt
return

^#Left::
FileDelete, %fileName%
return

^#Right::
FileDelete, %fileName%
FileAppend, %clipboard%, %fileName%
return

Right now it works with the #Persistent command but I have to put the #Persistent at the top of the file, which is inconvenient. If I remove the Persistent, it stops working.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Okay, apparently superuser is not the place to ask autohotkey questions :)

The autohotkey forum is quite active and I found the answer on the first search (Asked and answered yesterday). In my defense: Google didn't give me any relevant answer even after multiple search attempts.

maul.esel: Only the Global variables in the function you need: globalVar := "abc"

func()
{
    Global globalVar
    MsgBox %globalVar%
}

Latest AHK supports so-called "super-globals":

global globalVar := "abc"
func()
{
    MsgBox %globalVar%
}

The original thread: globals not global

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.