uzi17 Posted December 19, 2008 Posted December 19, 2008 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; LoopsWhile $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)WEndmy 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
Malkey Posted December 19, 2008 Posted December 19, 2008 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 thanksTry 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
uzi17 Posted December 21, 2008 Author Posted December 21, 2008 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
uzi17 Posted December 21, 2008 Author Posted December 21, 2008 (edited) If _IsPressed("27") Then $x += 1 ; righti 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 December 21, 2008 by uzi17
Malkey Posted December 21, 2008 Posted December 21, 2008 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now