Sign in to follow this  
Followers 0
tommy13061980

Change windows time

6 posts in this topic

Hello, I am quitte new with AutoIt.

One thing i just can not solve.

My program needs to set the windows clock to a specific time.

Example:

Script -> Change windows clock to 07:30

I found this: _Date_Time_SetTimeZoneInformation

But it is a little bit difficult for me to understand.

I only need to change the visible clock time in the bottom left corner.

Any help will be appreciated very much.

Many thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

To set the current local time of your PC use: _Date_Time_SetLocalTime().

In the help file you'll find an example.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you very much Mass Spammer.

And also for so fast answering.

It seems to work perfect on XP.

I still need to test on VISTA.

Share this post


Link to post
Share on other sites

Hi.

Another way for change windows time :

NOTE: You need administrative privilegies for this operation.

#RequireAdmin
RunWait("cmd.exe /c " & "time 07:30",@ScriptDir,@SW_HIDE)

[size="5"] [/size]

Share this post


Link to post
Share on other sites

Hi, Thanx both of you.

But, as i espected, VISTA sais, can not change windows time. User has not the right privileges.

is thwere any way i can get arround that.

Another option is to change the creation date of a file.

But the file has a crc check.

Share this post


Link to post
Share on other sites

The help file says:

"Function _Date_Time_SetLocalTimeThe SetLocalTime function enables the SE_SYSTEMTIME_NAME privilege before changing the local time."

If you don't have this privilege then there is no way to change the time.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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