Sign in to follow this  
Followers 0
esfalk

Quick Yes/no

12 posts in this topic

For commands that have a timeout in a value of seconds, is it possible to use < 1 second? i.e., .5 or .1 ?

Share this post


Link to post
Share on other sites



No, just positive integer.

Share this post


Link to post
Share on other sites

For commands that have a timeout in a value of seconds, is it possible to use < 1 second?  i.e., .5 or .1 ?

I have tried several times, but nothing worked. :D It seems that I also raised this issue on the mailing list, but it may be that I had recently pissed the PTB off :postal: about numbers, anyway no one responded. :huh2:

Gene


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

the other option is to use a loop with a sleep:

WinWaitActive ( "title","",1 )

so this same command is

for $i = 1 to 100
if WinActive ( "title","" ) then exitloop
sleep(10)
next

...some people see things as problems, others as chalenges.

like my challenge to spell correctly...

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

But it can work on other case like

MsgBox(0,"","Wait 1/10 of second",1/10)

Share this post


Link to post
Share on other sites

Most people can't focus on and read a message box in less than a second, though. If you can, it's probably because you are expecting the message box...

Share this post


Link to post
Share on other sites

But it can work on other case like

MsgBox(0,"","Wait 1/10 of second",1/10)

What is the OS that "MsgBox(0,"","Wait 1/10 of second",1/10)" worked under? I just tried it with Win98se. It treats the fraction as 0 and waits for a mouse click or a key press.

Gene


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

I am sorry... I think I forgot a "NOT" :D

About the focusing, it is of course true you can read well a so fast message, it could only useful if you need to open a file dialog topmost.

Thinked message

"

But it can NOT work on other case like

MsgBox(0,"","Wait 1/10 of second",1/10)

"

Share this post


Link to post
Share on other sites

Most people can't focus on and read a message box in less than a second, though.  If you can, it's probably because you are expecting the message box...

You are right Valik, but then you could use a message box as a count down or up device. It can also be used to GRAB the user's attention.

I know, there is Splash..., but sometimes it is visually annoying, especially if you are changing the content many times in a short time span.

Gene


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

I know, there is Splash..., but sometimes it is visually annoying, especially if you are changing the content many times in a short time span.

To avoid flickering with SplashTextOn you can use a function tha uses the SplashTextOn once and after that does a controlsettext to update the text:

;=====================================================
; Show Splash screen or update its content
;=====================================================
Func ShowMenu($msg)
   $W_Title="Title....."
   If WinExists($W_Title) Then
      ControlSetText($W_Title,"","Static1",$msg)
   Else
      SplashTextOn($W_Title,$msg,500,350,1,1,6,"Courier",10,600)
   EndIf
   Return 0
EndFunc

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

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Well perhaps I should be more specific as to my uses... I've written an incredibly simple UDF _Busy which essentially waits for the mouse cursor to be something other than the hour glass, waits for the CPU usage % to be < 10%, waits for a pre-defined title of a window to become active, and displays in a TrayTip box the expected window to wait for.

The reason I was hoping for a split-second display is that the loop, well, loops very fast and w/o the TrayTip ("CLEAR", "", 0) the messages would linger far too long.

I think I got the desired result by placing a TrayTip ( "", "", 0 ) very shortly after the TrayTip command that displays the information... check the code below::

; Function to check CPU activity and mouse icon for use
Func _Busy( $WINDOW )
    Do
        Do
            TrayTip ( "", "Waiting for " & $WINDOW, 1 )
            Sleep ( 100 )
            $CPU = StatusbarGetText ( "Windows Task Manager","",2 )
            $CPU = StringTrimRight ( $CPU, 1); remove the %
            $CPU = StringRight ( $CPU, 3 ); get the possible 3 digits
            $CPU = Int ( StringReplace ( $CPU,":","" ) ); remove colon and convert to int.
            TrayTip ( "CLEAR", "", 0 )
        Until  $CPU < 15
        Do
            TrayTip ( "", "Waiting for " & $WINDOW, 1 )
            Sleep ( 100 )
            TrayTip ( "CLEAR", "", 0 )
        Until  MouseGetCursor ( ) <> 15
        WinActivate ( $WINDOW )
        TrayTip ( "", "Waiting for " & $WINDOW, 1 )
        $STATE = WinGetState ( $WINDOW )
        TrayTip ( "CLEAR", "", 0 )
    Until ( BitAND ( $STATE, 15 ) = 15 or BitAND ( $STATE, 13 ) = 13 or BitAND ( $STATE, 47 ) = 47 )
EndFunc; --> _Busy

And if you've been following my other threads, the BitAND and WinGetState commands are my version of a customized WinWaitActive.

CORRECTION: The code watches for CPU Usage of <15%, not 10%

Edited by esfalk

Share this post


Link to post
Share on other sites

The TrayTip function has an OS enforced minimum timeout anyway. If you want it to disappear in anything under like 10 seconds or something, you have to manually clear it yourself or the OS will keep it displaying, even if you tell it to only linger for 1 second.

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