What I would like, is a Select -structure from Basic-family languages (at least VB and RealBasic have this. or VB used to anyway).
;Var1 contains the hour of the day. The script is supposed to do different things at different hours. We can do it with multiple "if Var1"s, but I think Select is a more appropriate approach for this. Select Case Var1 Case 1 ; Code here that executes if Var1 = 1 Case 2 ; Code here that executes if Var1 = 2 Case 3 ; etc. Case 4 Case 5 To 7 ; Can define ranges also. Case 8..9 ; Another suggestion to range syntax, I think Delphi did this. Case 10, 12 ; Multiple-choice case Case 11 Case %Var2% ; you can use a variable too. Just "Var2" would matched if Var1 == "Var2" Case Else ; If Var1 wasn't anything yet specified, execute this code End Select
This is almost how RealBasic does it and I've noticed I use it a lot (I hate multiple if clauses...).
Again, if AHK can already do this, please point me to the syntax, otherwise discuss if this would be a worthwhile addition.[/code]