Jump to content

GUI execution


beb7089
 Share

Recommended Posts

I'm trying to write an automated script for my technicians to easily update the time zone information on a pc. I know you can always right click on the time in the sys tray and change it their, but this script will be used for new deployment of pc through the network enviroment.

When I execute my script I select the desired time zone. After OK is pressed every command line executes. Leaving the very last line of code (which is Hawaiian Time) set. What is wrong?

GuiCreate("MyGUI", 199, 88,(@DesktopWidth-199)/2, (@DesktopHeight-88)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Label_1 = GuiCtrlCreateLabel("Select correct Time Zone", 10, 10, 170, 20)
$Combo_2 = GuiCtrlCreateCombo("", 10, 30, 180, 21)
$Combo_2 = GUICtrlSetData(-1,"Central|Mountain|Arizona|Pacific|Alaska|Hawaii","Central")
$Button_1 = GUICtrlCreateButton ("OK", 75, 60, 50, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
            GUISetState(@SW_Hide)
            If GUICtrlRead($Combo_2) = ("Central") Then RunWait(@SystemDir&'\RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-06:00) Central Time (US & Canada)')
            If GUICtrlRead($Combo_2) = ("Mountain") Then RunWait(@SystemDir&'\RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-07:00) Mountain Time (US & Canada)')
            If GUICtrlRead($Combo_2) = ("Arizona") Then RunWait(@SystemDir&'\RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-07:00) Arizona')
            If GUICtrlRead($Combo_2) = ("Pacific") Then RunWait(@SystemDir&'\RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-08:00) Pacific Time (US & Canada); Tijuana')
            If GUICtrlRead($Combo_2) = ("Alaska") Then RunWait(@SystemDir&'\RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-09:00) Alaska')
            If GUICtrlRead($Combo_2) = ("Hawaii") Then RunWait(@SystemDir&'\RUNDLL32.EXE SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,,/Z (GMT-10:00) Hawaii')
            
            
        
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Thanks

Link to comment
Share on other sites

I'm trying to write an automated script for my technicians to easily update the time zone information on a pc. I know you can always right click on the time in the sys tray and change it their, but this script will be used for new deployment of pc through the network enviroment.

When I execute my script I select the desired time zone. After OK is pressed every command line executes. Leaving the very last line of code (which is Hawaiian Time) set. What is wrong?

Thanks

Change this bit:

$Combo_2 = GuiCtrlCreateCombo("", 10, 30, 180, 21)
$Combo_2 = GUICtrlSetData(-1,"Central|Mountain|Arizona|Pacific|Alaska|Hawaii","Central")

to:

$Combo_2 = GuiCtrlCreateCombo("", 10, 30, 180, 21)
GUICtrlSetData(-1,"Central|Mountain|Arizona|Pacific|Alaska|Hawaii","Central")
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...