Jump to content

Auto Timer v1.0


z0mgItsJohn
 Share

Recommended Posts

Hello AutoIt People.. I Came Out With A New Program... :D

About Auto Timer v1.0...

Well Its A Program Where You Set The Amount Of Hours / Mins / Secs You Want The Program To Sleep... When The Program Is Done It Will Run The AutoIt Commands You Wrote :P .. The Program Has A Place To Type In Commands... Well.. I Gtg ~~

#Include <GuiConstants.au3>
Opt('GUIOnEventMode',1)
#NoTrayIcon

FileDelete ( "Command.au3" )

Global $Second = ('1000')  
Global $Minute = ('60000')  
Global $Hour   = ('3600000')  
Global $Title  = ('Auto Time v1.0 - By John O.')
Local $Hour_   = 0
Local $Minute_ = 0
Local $Second_ = 0

GUICreate($Title , 350, 420)
GUISetOnEvent($GUI_EVENT_CLOSE , '_Exit')
$Input_Hour = GUICtrlCreateInput ( "" ,35,50,75)
$Input_Minute = GUICtrlCreateInput ( "" ,135,50,75)
$Input_Second = GUICtrlCreateInput ( "" ,235,50,75)
$Command = GUICtrlCreateEdit ( "" , 4,150,343,200) 
GUISetFont (13,"","","Comic Sans MS")
GUICtrlCreateLabel ( "Hour" ,50,18) 
GUICtrlCreateLabel ( "Minute" ,144,18)
GUICtrlCreateLabel ( "Second" ,243,18)
GUICtrlCreateLabel ( "------------------------------------------------" ,6,95)
GUICtrlCreateLabel ( "Input - Command" ,100,115)
GUICtrlCreateLabel ( "------------------------------------------------" ,6,350)
GUICtrlCreateButton ( "Continue" ,130,375)
GUICtrlSetOnEvent (-1, "_Continue" )
GUISetState (@SW_SHOW)

While 1
Sleep (500)
WEnd

Func _Continue ()
WinSetState ($Title , "", @SW_HIDE)
FileDelete ('Command.au3')
FileWrite ('Command.au3', GUICtrlRead ($Command) )
Call ('_Set_Sleep_Second')
EndFunc

Func _Set_Sleep_Second ()
For $Array_Second = '1' To '100'
If GUICtrlRead ($Input_Second) = $Array_Second Then 
Global $Second_ = GUICtrlRead ($Input_Second) * $Second
EndIf 
Next
Call ('_Set_Sleep_Minute')
EndFunc

Func _Set_Sleep_Minute ()
For $Array_Minute = '1' To '100'
If GUICtrlRead ($Input_Minute) = $Array_Minute Then 
Global $Minute_ = GUICtrlRead ($Input_Minute) * $Minute
EndIf 
Next
Call ('_Set_Sleep_Hour')
EndFunc

Func _Set_Sleep_Hour ()
For $Array_Hour = '1' To '100'
If GUICtrlRead ($Input_Hour) = $Array_Hour Then 
Global $Hour_ = GUICtrlRead ($Input_Hour) * $Hour
EndIf 
Next
Call ('_Sleep')
EndFunc

Func _Sleep ()
$Set_Sleep = $Second_ + $Minute_ + $Hour_
Sleep ($Set_Sleep)
Call ('_Command')
EndFunc

Func _Command ()
Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "'& @ScriptDir &'\Command.au3"')
Exit
EndFunc

Func _Exit ()
Exit
EndFunc

Some Credits Goto Senton-Bomb But Mostly To Me :P

Comments.. Bug Reports Ect.. Please Post ;)

Enjoy ~~

Edited by John2006

Latest Projects :- New & Improved TCP Chat

Link to comment
Share on other sites

[/offtopic]

[ontopic]

A small suggestion, use the time functions to get the current time, then add the timer time to the current time to get the alarm time, then wait for the alarm time and set off the alarm then. =]]]]]] that would be a slightly cleaner way to do it and remove the whole restriction all together.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

New Copy With Test Command Button And Exit Button ! :D

#Include <GuiConstants.au3>
Opt('GUIOnEventMode',1)
#NoTrayIcon

FileDelete ( "Command.au3" )

Global $Second = ('1000')  
Global $Minute = ('60000')  
Global $Hour   = ('3600000')  
Global $Title  = ('Auto Time v1.0 - By John O.')
Local $Hour_   = 0
Local $Minute_ = 0
Local $Second_ = 0

GUICreate($Title , 350, 420)
GUISetOnEvent($GUI_EVENT_CLOSE , '_Exit')
$Input_Hour = GUICtrlCreateInput ( "" ,35,50,75)
$Input_Minute = GUICtrlCreateInput ( "" ,135,50,75)
$Input_Second = GUICtrlCreateInput ( "" ,235,50,75)
$Command = GUICtrlCreateEdit ( "" , 4,150,343,200) 
GUISetFont (13,"","","Comic Sans MS")
GUICtrlCreateLabel ( "Hour" ,50,18) 
GUICtrlCreateLabel ( "Minute" ,144,18)
GUICtrlCreateLabel ( "Second" ,243,18)
GUICtrlCreateLabel ( "------------------------------------------------" ,6,95)
GUICtrlCreateLabel ( "Input - Command" ,100,115)
GUICtrlCreateLabel ( "------------------------------------------------" ,6,350)
GUICtrlCreateButton ( "Continue" ,5,375)
GUICtrlSetOnEvent (-1, "_Continue" )
GUICtrlCreateButton ( "Test Command" ,217,375)
GUICtrlSetOnEvent (-1, "_Test_Command" )
GUICtrlCreateButton ( "   Exit   " ,115,375)
GUICtrlSetOnEvent (-1, "_Exit" )
GUISetState (@SW_SHOW)

While 1
Sleep (500)
WEnd

Func _Continue ()
WinSetState ($Title , "", @SW_HIDE)
FileDelete ('Command.au3')
FileWrite ('Command.au3', GUICtrlRead ($Command) )
Call ('_Set_Sleep_Second')
EndFunc

Func _Test_Command ()
FileWrite ('Command.au3', GUICtrlRead ($Command) )
Sleep (500)
Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "'& @ScriptDir &'\Command.au3"')
EndFunc

Func _Set_Sleep_Second ()
For $Array_Second = '1' To '100'
If GUICtrlRead ($Input_Second) = $Array_Second Then 
Global $Second_ = GUICtrlRead ($Input_Second) * $Second
EndIf 
Next
Call ('_Set_Sleep_Minute')
EndFunc

Func _Set_Sleep_Minute ()
For $Array_Minute = '1' To '100'
If GUICtrlRead ($Input_Minute) = $Array_Minute Then 
Global $Minute_ = GUICtrlRead ($Input_Minute) * $Minute
EndIf 
Next
Call ('_Set_Sleep_Hour')
EndFunc

Func _Set_Sleep_Hour ()
For $Array_Hour = '1' To '100'
If GUICtrlRead ($Input_Hour) = $Array_Hour Then 
Global $Hour_ = GUICtrlRead ($Input_Hour) * $Hour
EndIf 
Next
Call ('_Sleep')
EndFunc

Func _Sleep ()
$Set_Sleep = $Second_ + $Minute_ + $Hour_
Sleep ($Set_Sleep)
Call ('_Command')
EndFunc

Func _Command ()
Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "'& @ScriptDir &'\Command.au3"')
Exit
EndFunc

Func _Exit ()
Exit
EndFunc
Edited by John2006

Latest Projects :- New & Improved TCP Chat

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