| View previous topic :: View next topic |
| Author |
Message |
0xe34a345b3 Guest
|
Posted: Mon May 12, 2008 3:00 pm Post subject: GUICLOSE doesn't accept variables in Label!? |
|
|
This one works...
..but the one below not:
| Code: |
var := 5
%var%GUICLOSE:
|
why?
It would be great to set the GUICLOSE Label dynamically. |
|
| Back to top |
|
 |
TheIrishThug
Joined: 19 Mar 2006 Posts: 360
|
Posted: Mon May 12, 2008 4:38 pm Post subject: |
|
|
Labels are established before any variable will get a value, so labels are interpreted literally.
| Code: | gosub `%var`%test
return
%var%test:
msgbox test
return |
What you can do is the following. | Code: | 1test:
2test:
3test:
MsgBox, %A_ThisLabel%
return |
|
|
| Back to top |
|
 |
0xe34a345b3 Guest
|
Posted: Mon May 12, 2008 4:55 pm Post subject: |
|
|
Thanks, TheIrishThug, for this nice workaround  |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2472 Location: Australia, Qld
|
Posted: Mon May 12, 2008 9:45 pm Post subject: |
|
|
If the purpose is to assign multiple GUIs the same label or allow the GUI number to be dynamic, you may wish to use this:
| GUI options wrote: | Label [v1.0.44.09+]: Sets custom names for this window's special labels. For example, Gui 2:+LabelMyGui would use the labels MyGuiClose and MyGuiSize (if they exist) instead of 2GuiClose and 2GuiSize. In other words, the string "2Gui" is replaced by "MyGui" in the names of all special labels. This can also be used to make multiple windows share the same set of labels (in which case the script may consult A_Gui to determine which window launched the subroutine).
|
|
|
| Back to top |
|
 |
0xe34a345b3 Guest
|
Posted: Tue May 13, 2008 8:51 am Post subject: |
|
|
Thanks Lexikos, that's the way I like
As I had checked out the "GUI options" last time, this option didn't exist...AHK is changing really fast, isn't it?  |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2472 Location: Australia, Qld
|
Posted: Tue May 13, 2008 11:30 am Post subject: |
|
|
This feature was added in v1.0.44.09, which was released on August 9, 2006...  |
|
| Back to top |
|
 |
|