mmikeww / AHK-v2-script-converter

AHK v1 -> v2 script converter
https://autohotkey.com/boards/viewtopic.php?f=6&t=25100
The Unlicense
580 stars 44 forks source link

Gui created in Func should be global #300

Open Banaanae opened 1 month ago

Banaanae commented 1 month ago

V1:

MyFunc() {
   Gui, Add, Text,, Gui
   Gui, Show, w150
}
MyFunc()

F1::Gui, Destroy

V2 (Converted):

MyFunc() {
   myGui := Gui()
   myGui.Add("Text", , "Gui")
   myGui.Show("w150")
}
MyFunc()

F1::myGui.Destroy()

V2 (Expected):

MyFunc() {
   global myGui ; V1toV2: Made function global
   myGui := Gui()
   myGui.Add("Text", , "Gui")
   myGui.Show("w150")
}
MyFunc()

F1::myGui.Destroy()

Same should apply to menu (untested)