Jump to content

Recommended Posts

Posted (edited)

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
Posted

If you are willing to change (or parse) the date and time format, you could write a function that wraps the DOS "Date" and "Time" functions. Maybe someone else knows a better way.

*** Matt @ MPCS

Posted

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?

  • Developers
Posted (edited)

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

Posted

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

Posted (edited)

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
Posted

actually i think that compec line will be exactly what i need.

I need to change dates randomly actually.

Date will change months at a time in my program to determain APR Rates and such.

Posted (edited)

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
Posted

I have personally had problems with it but you could try setting the "flag" parameter of the Run command. Set it to @SW_HIDE.

*** Matt @ MPCS

  • Developers
Posted

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

Posted (edited)

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
Posted

==> 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?

Posted (edited)

Guess you can't copy and paste.

Try

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

Edited by ezzetabi
Posted (edited)

You miscopied their code, it is:

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

*** Matt @ MPCS

EDIT: Damn I was late on that one

Edited by Matt @ MPCS
  • Developers
Posted

==> 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.
  :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...