Funtime60 Posted October 17, 2017 Share Posted October 17, 2017 This is probably obvious, but can MsgBox not have a timeout below 1 second. If not can anyone suggest a replacement for this? Local $Cancel = MsgBox(4,"",$PCount,.01) If $Cancel <> -1 Local $YPCount = $YPCountT Local $XPCount = $XPCountT EndIf I want to use it as a way of forcing a loop to end early since the loop ends when $XPCount = $XPCountT which is nested inside a loop that ends when $YPCount = $YPCountT. The method would also have to be keyboard based as my loop uses MouseClick so I can't click on anything. This loop will run several thousand times so I need it to be faster than once a second. Thanks Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 17, 2017 Moderators Share Posted October 17, 2017 I'm confused, you want to go to the bother of creating a MsgBox to give the user a chance to cancel, but then make it timeout so fast they may not be able to click it anyway? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Funtime60 Posted October 17, 2017 Author Share Posted October 17, 2017 Since the MsgBox will automatically select the button the user would only have to spam the enter button. Sooner or later the MsgBox would be triggered with less impact on the time it takes to run. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 17, 2017 Moderators Share Posted October 17, 2017 Then why bother with the MsgBox at all? Just skip it? Perhaps more information on what you're doing would help us help you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Funtime60 Posted October 17, 2017 Author Share Posted October 17, 2017 I have a really long loop that I want to be able to abort. This is my attempt to make it so I can manually trigger the loop to end prematurely. Link to comment Share on other sites More sharing options...
Bert Posted October 17, 2017 Share Posted October 17, 2017 You didn't answer his question (you just stated your problem again) so let me ask it in a different way - what is the intent of the script, not just the problem you have with the script? kylomas 1 The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Funtime60 Posted October 17, 2017 Author Share Posted October 17, 2017 I have another script that creates a string of decimal colors based on a specified portion of your screen. This one is intended to reassemble the image in MS Paint. Link to comment Share on other sites More sharing options...
badcoder123 Posted October 17, 2017 Share Posted October 17, 2017 You should just use ToolTip if you want to be able to control something like that... Link to comment Share on other sites More sharing options...
Funtime60 Posted October 18, 2017 Author Share Posted October 18, 2017 47 minutes ago, badcoder123 said: You should just use ToolTip if you want to be able to control something like that... No offense, but I fail to see how this would solve my problem. ToolTip doesn't seem to take any end user input. Am I missing a feature of ToolTip? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 18, 2017 Moderators Share Posted October 18, 2017 48 minutes ago, Funtime60 said: No offense, but I fail to see how this would solve my problem. No offense but you are being purposely vague about what you're trying to do, so how are we to help you solve your problem? Let's try a more direct path: Is this for a desktop app, website game, etc? If so, which? What are you trying to accomplish in said app, webpage, game? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
badcoder123 Posted October 18, 2017 Share Posted October 18, 2017 8 hours ago, Funtime60 said: This is probably obvious, but can MsgBox not have a timeout below 1 second. 6 hours ago, Funtime60 said: No offense, but I fail to see how this would solve my problem. ToolTip doesn't seem to take any end user input. Am I missing a feature of ToolTip? Sorry. Let me clear that up. You could ToolTip($sText) then follow it up with a sleep of <1 second which can be used as a notifier. If it's not pretty enough for you, you could use a GUI that shows itself for <1 second as well. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 18, 2017 Moderators Share Posted October 18, 2017 Funtime60, Might I suggest using my Notify UDF (the link is in my sig) along these lines: #include "Notify.au3" ; Create a notification which remains visible until clicked $hNotication = _Notify_Show(0, "Loop running", "Click to stop loop", 0, 1, 250, 250) ; Register required messages _Notify_RegMsg() ; Start the loop For $i = 1 To 100000 ; Simulate some code running in the loop Sleep(10) ; Check if the notification is still visible If Not WinExists($hNotication) Then ; If not then exit the loop immediately ConsoleWrite("Exiting loop at count: " & $i & @CRLF) ExitLoop EndIf Next ; Announce the point at which the loop exited to check if it ran fully or was stopped by the user ConsoleWrite("Loop ended at count: " & $i & @CRLF) Now you have a visual reminder that the loop is running and the loop can be interrupted by the user at any time. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Funtime60 Posted October 18, 2017 Author Share Posted October 18, 2017 I think I have solved my problem on my own, is there anything I need to do here? I've never started one of these before. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 19, 2017 Moderators Share Posted October 19, 2017 Funtime60, It is always a good idea to post the solution you found so that others facing the same problem can learn how you did it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Funtime60 Posted November 14, 2017 Author Share Posted November 14, 2017 On 10/19/2017 at 2:13 PM, Melba23 said: Funtime60, It is always a good idea to post the solution you found so that others facing the same problem can learn how you did it. M23 Oh sorry, but my situation is probably unique. I needed to run a loop in side of a loop to run through a set of X values before changing the Y value, creating a scanning effect. I wanted a way to abort this script since it only moves about 1 X values a second and that can get very time consuming when it needs to go through several million coordinates, made worse by the fact that it steals control of my mouse. My original idea was to have a MsgBox that could cause my program to abort after every X increment however this would effectively double the amount of time it would take which already measures in several days. My solution was to move the MsgBox to after every Y increment. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now