AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GUICLOSE doesn't accept variables in Label!?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
0xe34a345b3
Guest





PostPosted: Mon May 12, 2008 3:00 pm    Post subject: GUICLOSE doesn't accept variables in Label!? Reply with quote

This one works...
Code:
5GUICLOSE:

..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

PostPosted: Mon May 12, 2008 4:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
0xe34a345b3
Guest





PostPosted: Mon May 12, 2008 4:55 pm    Post subject: Reply with quote

Thanks, TheIrishThug, for this nice workaround Wink
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2472
Location: Australia, Qld

PostPosted: Mon May 12, 2008 9:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
0xe34a345b3
Guest





PostPosted: Tue May 13, 2008 8:51 am    Post subject: Reply with quote

Thanks Lexikos, that's the way I like Very Happy

As I had checked out the "GUI options" last time, this option didn't exist...AHK is changing really fast, isn't it? Laughing
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2472
Location: Australia, Qld

PostPosted: Tue May 13, 2008 11:30 am    Post subject: Reply with quote

This feature was added in v1.0.44.09, which was released on August 9, 2006... Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group