Jump to content

ToolTip Help


uzi17
 Share

Recommended Posts

im new to using autoit and i was trying to make a random count down program

$countDown = 1 ;count down timer in minutes

$timer = ($countDown * 1000 * 60) + 20 ; converted to milli seconds

; Loops

While $timer >= 0

;Ceiling Rounds up the numbers

$timer = $timer - 20

$secLeft = $timer / 1000

$minLeft = $secLeft / 60

$hoursLeft = $minLeft / 60

ToolTip("Time Left" & @CRLF & Round($hoursLeft, 2) & " hours left" & @CRLF & Round($minLeft, 1) & " mins left" & @CRLF & Ceiling($secLeft) & " secs left" , 20, 20, "Counting Down from " & $countDown & " mins", 1)

Sleep(10)

WEnd

my question is, is there a way i can make it so the box can be dragged and moved around? cause right now its just stuck in that 1 position

thanks

Link to comment
Share on other sites

im new to using autoit and i was trying to make a random count down program

my question is, is there a way i can make it so the box can be dragged and moved around? cause right now its just stuck in that 1 position

thanks

Try this.

Arrow keys more the Tool Tip.

The independent Adlib timer is more accurate.

#include <Misc.au3>

HotKeySet("{Esc}", "_Exit")

Local $x = 20
Local $y = 20
Local $countDown = 1 ;count down timer in minutes
Global $timer = ($countDown * 1000 * 60) + 20 ; converted to milli seconds
AdlibEnable("CountDown", 250)

; Loops
While $timer >= 0
    If _IsPressed("27") Then $x += 1 ; right
    If _IsPressed("25") Then $x -= 1 ;left
    If _IsPressed("28") Then $y += 1 ;down
    If _IsPressed("26") Then $y -= 1 ; up   
    Sleep(10)
WEnd

Func CountDown()
    ;Ceiling Rounds up the numbers
    $timer = $timer - 250
    $secLeft = $timer / 1000
    $minLeft = $secLeft / 60
    $hoursLeft = $minLeft / 60
    
    ToolTip("Time Left" & @CRLF & Round($hoursLeft, 2) & " hours left" & @CRLF & Round($minLeft, 1) & " mins left" & _
            @CRLF & Ceiling($secLeft) & " secs left", $x, $y, "Counting Down from " & $countDown & " mins", 1)
EndFunc   ;==>CountDown

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Link to comment
Share on other sites

Try this.

Arrow keys more the Tool Tip.

The independent Adlib timer is more accurate.

#include <Misc.au3>

HotKeySet("{Esc}", "_Exit")

Local $x = 20
Local $y = 20
Local $countDown = 1 ;count down timer in minutes
Global $timer = ($countDown * 1000 * 60) + 20 ; converted to milli seconds
AdlibEnable("CountDown", 250)

; Loops
While $timer >= 0
    If _IsPressed("27") Then $x += 1 ; right
    If _IsPressed("25") Then $x -= 1 ;left
    If _IsPressed("28") Then $y += 1 ;down
    If _IsPressed("26") Then $y -= 1 ; up   
    Sleep(10)
WEnd

Func CountDown()
    ;Ceiling Rounds up the numbers
    $timer = $timer - 250
    $secLeft = $timer / 1000
    $minLeft = $secLeft / 60
    $hoursLeft = $minLeft / 60
    
    ToolTip("Time Left" & @CRLF & Round($hoursLeft, 2) & " hours left" & @CRLF & Round($minLeft, 1) & " mins left" & _
            @CRLF & Ceiling($secLeft) & " secs left", $x, $y, "Counting Down from " & $countDown & " mins", 1)
EndFunc   ;==>CountDown

Func _Exit()
    Exit
EndFunc   ;==>_Exit
thx works fine now :)
Link to comment
Share on other sites

If _IsPressed("27") Then $x += 1 ; right

i see the number 27 is mapped to the right arrow key, where i can find which numbers maps to which keys?

EDIT - also how could i make it so the box will only move when i press ctrl + <arrow key>

Edited by uzi17
Link to comment
Share on other sites

i see the number 27 is mapped to the right arrow key, where i can find which numbers maps to which keys?

EDIT - also how could i make it so the box will only move when i press ctrl + <arrow key>

Look under _IsPressed() function in AutoIt Help File.

If _IsPressed("27") And _IsPressed("11") Then ; Right Arrow And Ctrl Key

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