water Posted September 25, 2009 Posted September 25, 2009 I had to comment out some lines but I hope you get the message: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Timers.au3> $Windows = GUICreate("Windows 7™ Setup", 501, 401, -1, -1) ;GUISetIcon("X:\Setup.exe") GUISetBkColor(0x808080) $Install = GUICtrlCreateButton("Install Windows 7™ Unattended", 112, 8, 281, 33, 0) GUICtrlSetTip(-1, "Start Windows 7™ Setup") $win7custom = GUICtrlCreateButton("Install Windows 7 ( without any customization )", 112, 64, 281, 33, 0) GUICtrlSetTip(-1, "Install Windows 7 like your normal windows 7 installation, no customization, no automation. Completely untouched os with latest updates!") $Recovery = GUICtrlCreateButton("Windows Recovery Wizard ( Recovery Environment )", 112, 117, 281, 33, 0) GUICtrlSetTip(-1, "Recovery wizard ") $Command = GUICtrlCreateButton("Command Window", 23, 199, 177, 33, 0) $taskmanager = GUICtrlCreateButton("Task Manager", 296, 200, 177, 33, 0) $processxp = GUICtrlCreateButton("Process Explorer", 24, 256, 177, 33, 0) $Processmon = GUICtrlCreateButton("Process Monitor", 296, 256, 177, 33, 0) $netservice = GUICtrlCreateButton("Start Network Services", 24, 312, 177, 33, 0) $notepad = GUICtrlCreateButton("Notepad", 296, 312, 177, 33, 0) $Label2 = GUICtrlCreateLabel("", 370, 370, 130, 50) ;$Pic1 = GUICtrlCreatePic("X:\Windows\System32\setupback.jpg", 0, 0, 500, 400, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() GUICtrlSetData($Label2, "Seconds left: " & Int((30000 - _Timer_GetIdleTime()) / 1000)) If _Timer_GetIdleTime() > 30000 Then ;run ("C:\Windows\System32\taskmgr.exe") MsgBox(0, "Test", "Run") EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Install ;Run ("X:\windows\system32\boot\en-us\startsetup.cmd" ) Case $win7custom ;Run ("X:\windows\system32\boot\en-us\startsetupnormal.cmd" ) Case $Recovery ;Run ("X:\sources\recovery\RecEnv.exe" ) Case $Command ;Run ("X:\Windows\System32\cmd.exe" ) Case $taskmanager ;Run ("X:\Windows\System32\taskmgr.exe" ) Case $processxp ;Run ("X:\Windows\System32\procexp.exe" ) Case $Processmon ;Run ("X:\Windows\System32\Procmon.exe" ) Case $netservice ;Run ("X:\Windows\System32\net.exe start" ) Case $notepad ;Run ("X:\Windows\System32\notepad.exe" ) EndSwitch WEnd My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Yashied Posted September 25, 2009 Posted September 25, 2009 #Include <GUIConstantsEx.au3> #Include <StaticConstants.au3> #Include <Timers.au3> GUICreate('MyGUI', 400, 400) $Label = GUICtrlCreateLabel('30 sec', 340, 380, 50, 14, $SS_RIGHT) GUISetState() Global $Msg, $Label, $Time = 0, $Prev = 0 While 1 $Time = 30 - Int(_Timer_GetIdleTime() / 1000) If $Time <> $Prev Then GUICtrlSetData($Label, $Time & ' sec') $Prev = $Time EndIf If $Time <= 0 Then MouseMove(MouseGetPos(0), MouseGetPos(1), 0) Run(@WindowsDir & '\Notepad.exe') EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
AmitPatel Posted September 25, 2009 Author Posted September 25, 2009 Thanks @Water and Yashied, both of your scripts work fine . But now I realize another problem! It keeps setting timer back to 30 and begin countdown each time I left PC idle for a sec! What I want is that once this timer loop should be end if user interacts with PC! I mean no countdown once there is some activity on PC. Is this can be done by using following, considering Yashied's script, If $Time = 0 then <end timer loop> <hide label> which command can end this loop and to hide lebel I dont know, is above idea correct for what I m asking?
AmitPatel Posted September 25, 2009 Author Posted September 25, 2009 (edited) I got it working!!While 1 $Time = 5 - Int(_Timer_GetIdleTime() / 1000) If $Time <> $Prev Then GUICtrlSetData($Label, $Time & ' sec') $Prev = $Time EndIf if _Timer_GetIdleTime() = 0 Then GUICtrlSetState ( $Label, $GUI_HIDE ) ExitLoop EndIf If $Time <= 0 Then Run ("X:\windows\system32\boot\en-us\startsetup.cmd" ) GUICtrlSetState ( $Label, $GUI_HIDE ) ExitLoop EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitchWEndabove worked fine . Edited September 25, 2009 by AmitPatel
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