Jump to content
Sign in to follow this  
StrategicX

Turning GUIOnEventMode On/off?! help

Recommended Posts

StrategicX

Hey Im trying to turn on Opt("GUIOnEventMode", 1) For the task of calling a function that stops my program from running (stop button) and since this option works so well for an instant result Id like to use it, Problem is that since my program uses loops for certain tasks, The GUIgetMsg() function doesnt work so well or sometimes not at all, because of other loops in process ^_^

So when I tryed GUIOnEventMode it worked great, and when the user presses the Stop button the script stops and I call a function that changes the variable conditions controling the loop(s) to turn them off. So after that function is called I turn off GUIOnEventMode with Opt("GUIOnEventMode", 0)....

But when the user presses the start button again, (It passes Opt("GUIOnEventMode", 1)) again to turn OnEvent mode back on... But when the user presses start again, then trys to press the start button it doesnt call the function ;) So its not turning it back on....

How can I turn GUIOnEventMode on/off? Since im using GUIgetmsg() in my other loops..

I also tryed using AutoItSetOption("GUIOnEventMode", 0) and AutoItSetOption("GUIOnEventMode", 1) and it still only turns on/off one time. Please help thanks.


*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

Share this post


Link to post
Share on other sites
Melba23

StrategicX,

GUIOnEventMode mode switches on and off without problem - have a look at this post to see a script where it is switched on and off as the script runs.

You will need to post some code if this does not help as there must be something else wrong.

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
StrategicX

Edit: got it to work on your script.... trying it out on mine, I think it was the compiler i was using... thx for the help ^^

Edited by StrategicX

*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

Share this post


Link to post
Share on other sites
Melba23

StrategicX,

Sounds like you have a problem beyond my powers to solve if that script does not run for you. You will have to wait for someone more knowledgable than myself, sorry.

However, why are you using a Beta version of AutoIt? The current version is 3.3.0.0 and there is no later beta that I know of. The beta on the Downloads page is the final 3.2.13 version which was overtaken by the latest release. I cannot imagine that it will solve the problem, but you could try installing the 3.3.0.0 release - it cannot do any harm (as long as you are not using Win9x that is!).

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
Melba23

StrategicX,

Well i got it to work on ur script , But iM using an icon for it but it still works but will NOT turn back on like wtf.

So does it work or not? And what has an icon got to do with it?

Post your code as I suggested earlier. We are not mindreaders and cannot help if we do not know what you are trying to do!

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
StrategicX

StrategicX,

So does it work or not? And what has an icon got to do with it?

Post your code as I suggested earlier. We are not mindreaders and cannot help if we do not know what you are trying to do!

M23

well my source code is simply to big to post and private at that, But anyway an icon is the button im using, It wors the first time but will not turn back on once its been turned off. dont know what the deal is, tryed multiple compilers....

all im trying to do is turn it off then on again Opt("GUIOnEventMode, 1) and Opt("GUIOnEventMode, 0)

do I have to declare it on at the very top first? Cuz Im declaring it off then,. on then on/off depending on user input.

Edited by StrategicX

*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

Share this post


Link to post
Share on other sites
Jos

well my source code is simply to big to post and private at that, But anyway an icon is the button im using, It wors the first time but will not turn back on once its been turned off. dont know what the deal is, tryed multiple compilers....

all im trying to do is turn it off then on again Opt("GUIOnEventMode, 1) and Opt("GUIOnEventMode, 0)

do I have to declare it on at the very top first? Cuz Im declaring it off then,. on then on/off depending on user input.

Did you consider a code/script logic error which sounds a lot more obvious to me than trying multiple compilers.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
StrategicX

How would that work then? its 2 commands, set to 1 should turn on, set to 0 shoudl turn off.. .is there certain rules or conditions that must be met when using it??


*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

Share this post


Link to post
Share on other sites
Melba23

StrategicX,

an icon is the button im using, It wors the first time but will not turn back on once its been turned off

Do I understand correctly that you are offering the user a chance to switch between (GUIOnEventMode, 0) and (GUIOnEventMode, 1) - within the same script?

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
JackDinn

just a stab in the dark (no script to look at) but you are aware of the use of GUIOnEventMode, 1

When an event calls a function in OnEvent mode, no other event will be executed until that function returns, maybe your making a similar mistake to me a while ago, i was trying to call a func on an event and then before that func and all its called funcs had returned back to where the event call started from i was expecting to be able to call the func again with the same event!

so in effect i was able to start something (hitting start/stop button) but it wouldn't stop (same start/stop button)

maybe what your doing , but a pure guess ^_^

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites
StrategicX

So how did you fix this problem?

btw, I think he answered my problem basicly If I call a function from OnEvent Mode and it happens to have a Infinite loop in it , it will not work any,more since the function never returns am i right? Thanks for that , only one who even tryed answering it. ^_^ Thx to melba too., and no im not asking the user to change anything, there just a start/stop button and theres loops in the script and I wanted it to be able to stop tin the middle of the loop on a dime (without lagging)

Edited by StrategicX

*WoW Dev Projects: AFK Tele Bot development journalSimple Player Pointer Scanner + Z-Teleport*My Projects: coming soon.Check out my WoW Dev wiki for patch 3.0.9!http://www.wowdev.wikidot.com

Share this post


Link to post
Share on other sites
JackDinn

If I call a function from OnEvent Mode and it happens to have a Infinite loop in it , it will not work any,more since the function never returns am i right?

yep ^_^ i believe so, one way to check is to test if you can trigger any events at the point in question, ie can you trigger a $GUI_EVENT_CLOSE func etc after your in your Infinite loop? if not then thats whats going on.

well i dont know about how you can receive any events before returning from a previously called one, its a problem thats also been doing my head in as im currently looking at using GUIOnEventMode, 1 and this exact problem has kinda put me off from using it. but saying that i did'nt realize you could switch event mode on and off during run time i thought you had to choose between either one or the other during the whole script! (so thx for that info) so that might be its only saving grace in my book, so i can use it if i want to do quick func and i know its guna return pretty quick but if i want to go off somewhere and do a whole load of script calling many other func's & many loops etc i can switch off event mode and use the normal polling method.

anyhow have a read here it might help http://www.autoitscript.com/forum/index.ph...&hl=OnEvent

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Share this post


Link to post
Share on other sites
Melba23

StrategicX

a start/stop button and theres loops in the script and I wanted it to be able to stop tin the middle of the loop on a dime (without lagging)

If all you need is a way to pause the script than you can do that with HotKeySet. From the Help file: "A hotkey-press *typically* interrupts the active AutoIt function/statement and runs its user function until it completes or is interrupted." Here is a short script that shows how it works:
Global $Paused
HotKeySet("{pause}", "TogglePause") 
HotKeySet("{ESC}", "Terminate") 

While 1 
    For $x = 1 to 999
        Sleep(1)
        ToolTip($x & " - Running",200,200)
    Next
WEnd 

Func TogglePause() 
    $Paused = NOT $Paused 
    While $Paused
        ToolTip($x & " - Paused",200,200)
    Wend
EndFunc 

Func Terminate() 
Exit 0 
EndFunc

I hope that helps.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.