Jump to content
Funtime60

MsgBox Timeout Limits

Recommended Posts

Funtime60

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

Share this post


Link to post
Share on other sites
JLogan3o13

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?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Funtime60

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.

Share this post


Link to post
Share on other sites
JLogan3o13

Then why bother with the MsgBox at all? Just skip it? Perhaps more information on what you're doing would help us help you


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Funtime60

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.

Share this post


Link to post
Share on other sites
Funtime60

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.

Share this post


Link to post
Share on other sites
badcoder123

You should just use ToolTip if you want to be able to control something like that...

Share this post


Link to post
Share on other sites
Funtime60
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?

Share this post


Link to post
Share on other sites
JLogan3o13
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?

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
badcoder123

 

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.

Share this post


Link to post
Share on other sites
Melba23

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

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.

Share this post


Link to post
Share on other sites
Melba23

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

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

×