Sign in to follow this  
Followers 0
bositroll

GUI not responding, infinite Loop (newb)

3 posts in this topic

Hello everybody,

I'm writing a little program in autoIt and I'm having some trouble. I created a gui with two buttons. Run and Close.

Func _EventRecorder()

While 1

   $nMsg = GUIGetMsg()
   Switch $nMsg
   Case $GUI_EVENT_CLOSE
      Exit

   Case $_Run
      _theLoop()

   Case $_Close
      Close()

   EndSwitch
WEnd
EndFunc

_EventRecorder()

So Basically  I have a function that's polls the GUI with an endless while loop. Everything great here. But the problem is when I hit the "run" button, _theLoop() is called. _theLoop() is another infinite while loop, and is the "core" of my program. It polls diferent things constantly so my program works. The problem I'm having is that when I press the "Run" button the program goes to _theLoop() and stays here. It doesn't stop looping (which is fine ofcourse, because _theLoop() is the actual program), The downside of this (the program caught in _theLoop()) is that my while loop for my GUI is no longer responsive. 

What is the best tactic to solve this problem?

 

Thanks in advance

Sorry for bad English

 

Share this post


Link to post
Share on other sites



bositroll,

Welcome to the AutoIt forum. :)

Take a look at the Interrupting a running function tutorial in the Wiki - that will explain all. ;)

You might also think of looking at Adlib in the Help file as that allows you to run code (your "polling" code perhaps?) at regular intervals. If you give us some more details of exactly what you do in this "core" function we might be able to suggest which strategy would be best suited to your case. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

bositroll,

 

i was trying to write a bot for one of the stupid flash games I found on the internet

I suggest you read the Forum rules (there is also a link at bottom right of each page) - particularly the part about not discussing game automation - before you post again. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0