Global variable does not have global scope

前端 未结 4 2033
予麋鹿
予麋鹿 2021-02-13 04:42
supposedlyGlobalVariable := \"blah\"

ARoutine()
{
   localVariable := \"asdf\"
   MsgBox, The global variable value is %supposedlyGlobalVariable%.  The local variable v         


        
4条回答
  •  暖寄归人
    2021-02-13 05:25

    P.Brian, It works when you do this.. I know it doesn't explain why, but this might be your workaround.

    #Persistent
    GlobalVariable = "blah"
    RETURN
    
    ARoutine:
    {
       localVariable := "asdf"
       MsgBox, The global variable value is %GlobalVariable%.  The local variable value is %localVariable%.
    }
    Return
    
    ^!X:: ;This assigns the hotkey CTRL + ALT + X to run the routine
    gosub, ARoutine
    return
    

提交回复
热议问题