Jump to content

MsgBox Timeout Limits


Recommended Posts

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

  • Moderators

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

  • Moderators

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

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

  • Moderators
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

 

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Link to comment
Share on other sites

  • 4 weeks later...
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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...