yucatan Posted July 6, 2008 Share Posted July 6, 2008 hi i wanne make a countdown of 300 sec if the 300 sec are over i wane that a func is runned b.v the script give a msgbox and then exits is this posseble ? Link to comment Share on other sites More sharing options...
sandin Posted July 6, 2008 Share Posted July 6, 2008 you can use this: $count_down_time = 300 ;sec $corected_time = $count_down_time * 1000 $timer = TimerInit() Global $display_old While 1 ;~ == display countdown part: === $display = Floor(($corected_time-TimerDiff($timer))/1000) if $display <> $display_old Then TrayTip("", $display, 10) $display_old = $display EndIf ;~ == end of display countdown part === if TimerDiff($timer)>= $corected_time Then _Do_Something() EndIf WEnd func _Do_Something() MsgBox(0, "OK", "countdown ended") Exit EndFunc if you don't wanna show countdown display, then delete "countdown display part" Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 you can use this: $count_down_time = 300 ;sec $corected_time = $count_down_time * 1000 $timer = TimerInit() Global $display_old While 1 ;~ == display countdown part: === $display = Floor(($corected_time-TimerDiff($timer))/1000) if $display <> $display_old Then TrayTip("", $display, 10) $display_old = $display EndIf ;~ == end of display countdown part === if TimerDiff($timer)>= $corected_time Then _Do_Something() EndIf WEnd func _Do_Something() MsgBox(0, "OK", "countdown ended") Exit EndFunc if you don't wanna show countdown display, then delete "countdown display part" i want to use it in my gui how do i need to do that ? Link to comment Share on other sites More sharing options...
sandin Posted July 6, 2008 Share Posted July 6, 2008 I dunno if I dunno how does your gui looks like, can you post some code of your gui? Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 I dunno if I dunno how does your gui looks like, can you post some code of your gui?func inbox()$display=301GUIDelete()GUICreate ( "My GUI delete control", 600,200,250,200)GUICtrlCreateLabel ("Your Logged in as: " & $USER , 5, 5, 200) GUICtrlCreateLabel ("Your Logged in as: " & $display , 20, 20, 200) $Button_1 = GUICtrlCreateButton ("Quit", 520, 5, 75)$Button_2 = GUICtrlCreateButton ("Disconnect.", 440, 5, 75)GUISetState (); Run the GUI until the dialog is closed$msg=0While $msg <> $GUI_EVENT_CLOSE ;~ == display countdown part: === $display = Floor(($corected_time-TimerDiff($timer))/1000) if $display <> $display_old Then ; MsgBox(4096, "Test", $display) $display_old = $display EndIf;~ == end of display countdown part === if TimerDiff($timer)>= $corected_time Then _Do_Something() EndIf$msg = GUIGetMsg() Select Case $msg = $Button_1quit() Case $msg = $Button_2disconnect()EndSelectWEnd Link to comment Share on other sites More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 func inbox()$display=301GUIDelete()GUICreate ( "My GUI delete control", 600,200,250,200)GUICtrlCreateLabel ("Your Logged in as: " & $USER , 5, 5, 200) GUICtrlCreateLabel ("Your Logged in as: " & $display , 20, 20, 200) $Button_1 = GUICtrlCreateButton ("Quit", 520, 5, 75)$Button_2 = GUICtrlCreateButton ("Disconnect.", 440, 5, 75)GUISetState (); Run the GUI until the dialog is closed$msg=0While $msg <> $GUI_EVENT_CLOSE ;~ == display countdown part: === $display = Floor(($corected_time-TimerDiff($timer))/1000) if $display <> $display_old Then ; MsgBox(4096, "Test", $display) $display_old = $display EndIf;~ == end of display countdown part === if TimerDiff($timer)>= $corected_time Then _Do_Something() EndIf$msg = GUIGetMsg() Select Case $msg = $Button_1quit() Case $msg = $Button_2disconnect()EndSelectWEndhow i can reset the timer back to 300 ? Link to comment Share on other sites More sharing options...
sandin Posted July 6, 2008 Share Posted July 6, 2008 (edited) expandcollapse popup#include <GUIConstantsex.au3> inbox() func inbox() $display = 301 $USER = 'snd' $display = '301' $time = 300 ;sec $corected_time = $time * 1000 $inbox = GUICreate ( "My GUI delete control", 600,200,250,200) GUICtrlCreateLabel ("Your Logged in as: " & $USER , 5, 5, 200) GUICtrlCreateLabel ("Your Logged in as: " & $display , 20, 20, 200) $Button_1 = GUICtrlCreateButton ("Quit", 520, 5, 75) $Button_2 = GUICtrlCreateButton ("Disconnect.", 440, 5, 75) GUISetState (@SW_SHOW, $inbox) $timer = TimerInit() While GUIGetMsg() <> $GUI_EVENT_CLOSE if TimerDiff($timer)>= $corected_time Then MsgBox(0, "OK", "countdown ended") quit() EndIf $msg = GUIGetMsg() switch $msg Case $Button_1 quit() Case $Button_2 disconnect() EndSwitch WEnd EndFunc func quit() Exit EndFunc func disconnect() EndFuncoÝ÷ Ú2¢ç·¬zÛbêÛÊ)éºÛb(f§u«¢+ØÀÌØíÑ¥µÈôQ¥µÉ%¹¥Ð ¤ Edited July 6, 2008 by sandin Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
yucatan Posted July 6, 2008 Author Share Posted July 6, 2008 how i can reset the timer back to 300 ?if have a $var containing a word how do i change the first letter of the word in to a capitalso not $var = yucatanbecomes$var=Yucatan Link to comment Share on other sites More sharing options...
picaxe Posted July 6, 2008 Share Posted July 6, 2008 Try this MsgBox(262144, "ProperCase", Propercase("yucAtan")) Func ProperCase($sString) $sProperCase = StringUpper(StringLeft($sString, 1)) & StringLower(StringRight($sString, StringLen($sString) - 1)) Return $sProperCase EndFunc Link to comment Share on other sites More sharing options...
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