adam162 Posted July 30, 2010 Share Posted July 30, 2010 code expandcollapse popup#include <GUIConstantsEx.au3> #include <Date.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $ExitID Global $iX = 2, $iStartTime, $stime, $hTimeLabel _Main() Func _Main() Local $YesID GUICreate("timer", 350, 80) $hTimeLabel = GUICtrlCreateLabel("", 10, 10, 100, 20) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() ; display the GUI $iStartTime = TimerInit() While 1 _UpdateTimmer() Sleep(1000) WEnd EndFunc ;==>_Main ;--------------- Functions --------------- Func Reset() MsgBox(0, "Timer Reset to Zero", "Ok") $iStartTime = TimerInit() EndFunc ;==>Reset Func OnExit() If @GUI_CtrlId = $ExitID Then EndIf Exit EndFunc ;==>OnExit Func _UpdateTimmer() Local $iHours, $iMins, $iSecs, $sNewtime, $iTimeDif $iTimeDif = TimerDiff($iStartTime) _TicksToTime($iTimeDif, $iHours, $iMins, $iSecs) $sNewtime = StringFormat("%02s", $iHours) & ":" & StringFormat("%02s", $iMins) & ":" & StringFormat("%02s", $iSecs) If $stime <> $sNewtime Then $stime = $sNewtime GUICtrlSetData($hTimeLabel, $stime) EndIf If $iMins = $iX Then MsgBox(0, "", "Reached " & $iX & " Minutes") Exit EndIf EndFunc ;==>_UpdateTimmer 2nd code expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Logged on - Windows Bot - Created by *", 801, 443, 192, 124) $iStartTime = TimerInit() $title1 = GUICtrlCreateLabel("You have Sucsessfully Logged on - Windows Bot", 16, 8, 769, 37) GUICtrlSetFont(-1, 25, 400, 0, "@MingLiU") $shutdown = GUICtrlCreateButton("Shutdown", 24, 72, 113, 57, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetTip(-1, "Click this if you want to shutdown this system") $logoff = GUICtrlCreateButton("Logoff", 144, 72, 113, 57, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFF00) GUICtrlSetTip(-1, "Click this to logoff this system") $Admin = GUICtrlCreateButton("Admin", 680, 392, 105, 41, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlSetTip(-1, "Click this for admin functions") $Lock = GUICtrlCreateButton("Lock ", 272, 72, 113, 57, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetTip(-1, "Lock this computer") GUISetState(@SW_SHOW) Dim $Form1_AccelTable[4][2] = [["^s", $shutdown],["^l", $logoff],["^!a", $Admin],["^c", $Lock]] GUISetAccelerators($Form1_AccelTable) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Now as im new to autoscripts how do I get both of them to work as 1 gui $hTimeLabel = GUICtrlCreateLabel("", 10, 10, 100, 20) Link to comment Share on other sites More sharing options...
smashly Posted July 30, 2010 Share Posted July 30, 2010 Hi,expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Date.au3> $Form1 = GUICreate("Logged on - Windows Bot - Created by *", 801, 443, 192, 124) $hTimeLabel = GUICtrlCreateLabel("00:00:00", 16, 10, 100, 20) $iStartTime = TimerInit() AdlibRegister("Timer", 1000) $title1 = GUICtrlCreateLabel("You have Sucsessfully Logged on - Windows Bot", 16, 20, 769, 37) GUICtrlSetFont(-1, 25, 400, 0, "@MingLiU") $shutdown = GUICtrlCreateButton("Shutdown", 24, 72, 113, 57, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetTip(-1, "Click this if you want to shutdown this system") $logoff = GUICtrlCreateButton("Logoff", 144, 72, 113, 57, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFF00) GUICtrlSetTip(-1, "Click this to logoff this system") $Admin = GUICtrlCreateButton("Admin", 680, 392, 105, 41, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlSetTip(-1, "Click this for admin functions") $Lock = GUICtrlCreateButton("Lock ", 272, 72, 113, 57, $WS_GROUP) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetTip(-1, "Lock this computer") GUISetState(@SW_SHOW) Dim $Form1_AccelTable[4][2] = [["^s", $shutdown],["^l", $logoff],["^!a", $Admin],["^c", $Lock]] GUISetAccelerators($Form1_AccelTable) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $shutdown Case $logoff Case $Lock Case $Admin EndSwitch WEnd Func Timer() Local $iHours, $iMins, $iSecs _TicksToTime(Int(TimerDiff($iStartTime)), $iHours, $iMins, $iSecs) GUICtrlSetData($hTimeLabel, StringFormat("%02i:%02i:%02i", $iHours, $iMins, $iSecs)) EndFunc ;==>Timer Cheers 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