Jump to content

Recommended Posts

Posted

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..??

Posted (edited)

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
Posted

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.??

Posted

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?

  • Moderators
Posted

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.

Posted

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..??

Posted

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

App: Au3toCmd              UDF: _SingleScript()                             

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
×
×
  • Create New...