Sign in to follow this  
Followers 0
harleyds

Selecting an option from a drop down box.

5 posts in this topic

Hello all,

I really don't know much about AutoIt and am learning how to use it. I need a script to change the Time Zone from "(GMT) Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London" to "(GMT-5:00) Eastern Time (US & Canada)". This is on a Windows XP workstation.

Below is the script I came up with, but I need it setup so that it can be run more than once. The way it is setup now, the second time it is run, it will take it off of Eastern Time and set it to something else. I tried to specify text of "(GMT-5:00) Eastern Time (US & Canada)", but it doesn't seem to do it. Anyone have any ideas how to get this accomplished? I already tried capturing the registry values with RegMon. They import in fine, but they don't seem to take affect when checking the GUI.

Thanks.

Send("#r")

WinWaitActive("Run")

Send("timedate.cpl{Enter}")

WinWaitActive("Date and Time Properties")

Send("^{TAB}")

WinWaitActive("Date and Time Properties")

Send("{UP 13}")

Send("{ENTER}")

Share this post


Link to post
Share on other sites



Take a look at ControlCommand() in the help file... It has what you are looking for I'm sure.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Might want to change it directly via the registry. Try this:

global $tzkey = "HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation"

RegWrite($tzkey, "Bias", "REG_DWORD", "300")
RegWrite($tzkey, "StandardName", "REG_SZ", "Eastern Standard Time")
RegWrite($tzkey, "StandardBias", "REG_DWORD", "0")
RegWrite($tzkey, "StandardStart", "REG_BINARY", "00000a00050002000000000000000000")
RegWrite($tzkey, "DaylightName", "REG_SZ", "Eastern Daylight Time")
RegWrite($tzkey, "DaylightBias", "REG_DWORD", "-60")
RegWrite($tzkey, "DaylightStart", "REG_BINARY", "00000400010002000000000000000000")
RegWrite($tzkey, "ActiveTimeBias", "REG_DWORD", "240")

;~ RegWrite($tzkey, "Bias", "REG_DWORD", "360")
;~ RegWrite($tzkey, "StandardName", "REG_SZ", "Central Standard Time")
;~ RegWrite($tzkey, "StandardBias", "REG_DWORD", "0")
;~ RegWrite($tzkey, "StandardStart", "REG_BINARY", "00000a00050002000000000000000000")
;~ RegWrite($tzkey, "DaylightName", "REG_SZ", "Central Daylight Time")
;~ RegWrite($tzkey, "DaylightBias", "REG_DWORD", "-60")
;~ RegWrite($tzkey, "DaylightStart", "REG_BINARY", "00000400010002000000000000000000")
;~ RegWrite($tzkey, "ActiveTimeBias", "REG_DWORD", "300")

;~ RegWrite($tzkey, "Bias", "REG_DWORD", "420")
;~ RegWrite($tzkey, "StandardName", "REG_SZ", "Mountain Standard Time")
;~ RegWrite($tzkey, "StandardBias", "REG_DWORD", "0")
;~ RegWrite($tzkey, "StandardStart", "REG_BINARY", "00000a00050002000000000000000000")
;~ RegWrite($tzkey, "DaylightName", "REG_SZ", "Mountain Daylight Time")
;~ RegWrite($tzkey, "DaylightBias", "REG_DWORD", "-60")
;~ RegWrite($tzkey, "DaylightStart", "REG_BINARY", "00000400010002000000000000000000")
;~ RegWrite($tzkey, "ActiveTimeBias", "REG_DWORD", "360")

;~ RegWrite($tzkey, "Bias", "REG_DWORD", "480")
;~ RegWrite($tzkey, "StandardName", "REG_SZ", "Pacific Standard Time")
;~ RegWrite($tzkey, "StandardBias", "REG_DWORD", "0")
;~ RegWrite($tzkey, "StandardStart", "REG_BINARY", "00000a00050002000000000000000000")
;~ RegWrite($tzkey, "DaylightName", "REG_SZ", "Pacific Daylight Time")
;~ RegWrite($tzkey, "DaylightBias", "REG_DWORD", "-60")
;~ RegWrite($tzkey, "DaylightStart", "REG_BINARY", "00000400010002000000000000000000")
;~ RegWrite($tzkey, "ActiveTimeBias", "REG_DWORD", "420")

I added the other US timezones incase you have a need to do those as well. This information was gleaned via capturing what actually happened in the registry when you use the Time control panel (via regmon) to change the time zone, and replicating those changes in AutoIT.

Note, you may have to log off and back on to see the change.


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Might want to change it directly via the registry. Try this:

I added the other US timezones incase you have a need to do those as well. This information was gleaned via capturing what actually happened in the registry when you use the Time control panel (via regmon) to change the time zone, and replicating those changes in AutoIT.

Note, you may have to log off and back on to see the change.

thanks for the registry keys, but I already tried that and even after a reboot it still does not work. After you import the registry keys, the GMT, or original Time Zone is still displayed(in the Date and Time Properties Window). Logging off and back on and rebooting still doesn't do it.

I usually script things like this in to Wise or batch files so I'm not dependant on having the user logged in. Using AutoIt is my last resort before I have my techs do it manually.

thanks again

Edited by harleyds

Share this post


Link to post
Share on other sites

Are you trying it as an administrator of the machine?

Here's another, but non-autoit method, a direct regedit import

Create Eastern.reg with this code:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"Bias"=dword:0000012c
"StandardName"="Eastern Standard Time"
"StandardBias"=dword:00000000
"StandardStart"=hex:00,00,0a,00,05,00,02,00,00,00,00,00,00,00,00,00
"DaylightName"="Eastern Daylight Time"
"DaylightBias"=dword:ffffffc4
"DaylightStart"=hex:00,00,04,00,01,00,02,00,00,00,00,00,00,00,00,00
"ActiveTimeBias"=dword:000000f0

And run this command:

regedit /s c:\Eastern.reg


[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
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
Sign in to follow this  
Followers 0