Jump to content

Function that changes Windows Calendar Time?


Falling
 Share

Recommended Posts

Sorry, if not could someone give me some tips on how to start a project like this?

What i would want to do is use a function that you enter a parametor like

ChangeTime(10, 5, 1985, 4:50pm).

The call to that function would set the calendar in windows to 10/5/1985 at 4:50pm)

The exact time part is not that important really. It's mainly changing the date.

Edited by Falling
Link to comment
Share on other sites

  • Developers

Could you expand on what you said?  Like give more meat and less bone?  What you said kind of went over my head.

If you change DOS time windows time changes also?

<{POST_SNAPBACK}>

Run(@comspec & " /c date 01/01/2004") will change the date to jan 1, 2004

so all you need to do is do run commands for date and time to accomplish what you want.

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

At least in 2000/XP the DOS prompt is just emulated. This means that DOS gets its time from Windows.

Using the Run (AutoIt) command you could execute "Time time to change to" and "Date date to change to" You can find more on this on the internet. Just google the DOS "Date" and "Time" commands. Or you can always just try it... go to the command prompt and type in "Date /?" and "Time /?". This will give you the help provided for these commands.

*** Matt @ MPCS

Link to comment
Share on other sites

Consider using

http://www.softshape.net/download/cmdtime.zip

cmdtime3 for a nice command line apps that sets the clock perfectly.

Edit: oh... I had the clock wrong for 2 seconds!! Thanks cmdtime3. :)

Edit2: time is only one per system. Worry not Falling.

Most probably it is even shared between OS.

Edited by ezzetabi
Link to comment
Share on other sites

Consider using cmdtime3 for a nice command line apps that sets the clock perfectly.

How does this differ from the intrinsic commands provided by windows?

ADDITION: Nevermind, I figured it out. Depending on the situation you are setting the date and time for, this could or may not be useful. It requires an internet connection, and in his example above:

ChangeTime(10, 5, 1985, 4:50pm)
Edited by Matt @ MPCS
Link to comment
Share on other sites

Here it is the function i was asking for. Thanks for all your suggestions. But especially to JdeB for the excelent 1 line command and to Matt @ MPCS for explaining how it works.

Func ChangeDateStupidComputer($M, $D, $Y)
  Run(@comspec & " /c date " & $M &"/"& $D &"/"& $Y &"")
EndFunc

ChangeDateStupidComputer("2","3","1981")

This is prob a good method, because now i can make a ChangeTimeStupidComputer that is independent.

--------------------

If only i could get that crazy dos box from popping up. Even if it is for only a split secound.

Edited by Falling
Link to comment
Share on other sites

  • Developers

If only i could get that crazy dos box from popping up.  Even if it is for only a split secound.

<{POST_SNAPBACK}>

Run(@comspec & " /c date " & $M &"/"& $D &"/"& $Y, "", @SW_HIDE) :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

What about?

Func ChangeDateStupidComputer($M, $D, $Y)
 Run(@comspec & " /c date " & $M &"/"& $D &"/"& $Y,'',@sw_hide)
EndFunc

ChangeDateStupidComputer("2","3","1981")]

Actually Matt was the first with the date idea...

Edited by ezzetabi
Link to comment
Share on other sites

  • Developers

==> Unable to execute the external program.:

Run(@comspec & " /c date " & $M &"/"& $D &"/"& $Y &"", @SW_HIDE)

The directory name is invalid.

Guess for WinXP this @SW_HIDE does not work?

<{POST_SNAPBACK}>

look at what is posted and your code... it is different !!

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...