Jump to content
Sign in to follow this  
cypher175

ToolTip(Sleep(30000)) How to Display a Counting SleepTime ToolTip..?

Recommended Posts

cypher175

ToolTip(Sleep(30000))

How can I make a ToolTip function work with a Sleep function so it counts up from 0->30 showing the counting in a tooltip..??

Share this post


Link to post
Share on other sites
Spiff59

If you want to display actual seconds, then something like this might do you:

Dim $x
$Timer = TimerInit()
While $x < 30
    $x = Int(TimerDiff($Timer)/1000)
    Tooltip($x,100,100)
Wend
Edited by Spiff59

Share this post


Link to post
Share on other sites
cypher175

thanks, it works, but it seems a lil too CPU intensive..??

is there any other ways that doesnt make the CPU go up 40% when running that code.??

Share this post


Link to post
Share on other sites
Spiff59

Sorry, try adding a sleep()...

$x =0
$Timer = TimerInit()
While $x < 30
    Sleep(1)
    $x = Int(TimerDiff($Timer)/1000)
    Tooltip($x,100,100)
Wend

Better?

Share this post


Link to post
Share on other sites
SmOke_N

Sorry, try adding a sleep()...

$x =0
$Timer = TimerInit()
While $x < 30
    Sleep(1)
    $x = Int(TimerDiff($Timer)/1000)
    Tooltip($x,100,100)
Wend

Better?

Just a FYI, the minimum sleep with AutoIt's Standard Sleep() function is 10ms, so Using Sleep(1) through Sleep(9) is the same as Sleep(10). (Just in case you weren't aware)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
cypher175

how could i turn all that code into a Function so i could call it like _SleepTimerToolTip(#) and instead of putting the # of seconds in the While $x < 30 put it inside the _SleepTimerToolTip(#)

get what im sayin..??

how would ya do this..??

Share this post


Link to post
Share on other sites
Exit

how could i turn all that code into a Function so i could call it like _SleepTimerToolTip(#) and instead of putting the # of seconds in the While $x < 30 put it inside the _SleepTimerToolTip(#)

get what im sayin..??

how would ya do this..??

I would prefer it in a countdown manner. Then you know, how long it takes to the end. :D

Here a sample:

_SleepTimerToolTip(5)

Func _SleepTimerToolTip($iSeconds)
    While $iSeconds
        ToolTip($iSeconds)
        $iSeconds -= 1
        Sleep(1000)
    WEnd
    ToolTip("")
EndFunc   ;==>_SleepTimerToolTip

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

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.