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 

Constant loop while a gui exists

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
a_guy
Guest





PostPosted: Sat Feb 20, 2010 2:48 am    Post subject: Constant loop while a gui exists Reply with quote

Hello,

I have wrote a gui that I plan on having do some things with clocks and timers. Once I hit a button, a time is put into a text field. How can I have a loop that is ALWAYS executing while the gui is alive that could say, decrement a second (I don't need help with decrementing a second, only the placement of said loop). I tried placing after the full code of the gui and nothing happened. Any help would be much appreciated.
Back to top
randallf



Joined: 06 Jul 2009
Posts: 678

PostPosted: Sat Feb 20, 2010 3:21 am    Post subject: Reply with quote

Code:
#Persistant
Loop
{
IfWinExist, Wintitle Of Your GUI
msgbox
}


not complete but might point you in the right direction for the help file
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5334
Location: San Diego, California

PostPosted: Sat Feb 20, 2010 3:43 am    Post subject: Reply with quote

I think of GUI interfaces as static, meaning non-moving.
GUI interfaces are also economical, they are drawn and done without wasting time.
They only change based on something happening. In fact most of the scripts I have seen there is a Return instruction just after the Gui, show command.

Given those ideas, why not use something that is also economical: SetTimer. It can be set to call a subroutine as often as you like. It can increment a variable and finish, then wait until the next settimer calls it.
You can use this to show "elapsed time".

If you need something that allows a value to be placed in a field based on when the gui was shown an when you pushed the button consider reading and storing a copy of the variables A_Now or A_TickCount. Just after showing the GUI read and store one of those variables, later when you push a button read the variable again. If you subtract the stored value from the last, you get how long between GUI-shown and button-pushed.

If you want to use the SetTimer command to start a subroutine, place the SetTimer command after GUI, show and before Return.
Back to top
View user's profile Send private message
randallf



Joined: 06 Jul 2009
Posts: 678

PostPosted: Sat Feb 20, 2010 3:46 am    Post subject: Reply with quote

If all you want to do is change text on something without killing the GUI the command specifically (for text and edit fields) is

Code:
GuiControl,,ControlVlabel, This is the new text
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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