Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Change the date from Windows


  • Please log in to reply
13 replies to this topic

#1 dexter23

dexter23

    Seeker

  • Active Members
  • 20 posts

Posted 08 February 2008 - 08:47 PM

I want to change the date to 17.01.2007
I use the next code:
Opt("TrayIconDebug", 1) Opt("SendKeyDelay", 200) Run("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl,,0") WinActivate("Date and Time Properties", "") ControlCommand("Date and Time Properties", "", "ComboBox1", "ShowDropDown", "") Send("{UP 11}") ControlCommand("Date and Time Properties", "", "ComboBox1", "HideDropDown", "") ControlSetText("Date and Time Properties", "", "Edit2", "") Sleep(1000) ControlSetText("Date and Time Properties", "", "Edit2", "2007") Send("{TAB 9}") Send("{ENTER}") Send("{TAB 7}") Send("{ENTER}")ƒo݊÷ ÙIߢ»n«^—+ayÖ²q©÷öÖÞr§çm£^ðŠØm…éÞÆ×(šf§u§]y֟µêí…éZ²Ð¨žÚè•'­Mìmr‰¦jwZºÚ"µÍÛ۝›ÛÛXÚÊ œ][ÝÑ]H[™[YH›ÜYɜ][ÝË  œ][Ýɜ][ÝË œ][ÝÐØ[ۙXZ[ŒIœ][ÝË  œ][ÝÛY   œ][ÝË K ÎK ŒŠ

Any ideas?

Edited by dexter23, 08 February 2008 - 08:51 PM.








#2 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,557 posts

Posted 08 February 2008 - 09:14 PM

C:\Program Files\AutoIt3\Include\date.au3

Plain Text         
; #FUNCTION# ==================================================================================================== ================ ; Name...........: _Date_Time_SetSystemTime ; Description ...: Sets the current system time and date, expressed in UTC ; Syntax.........: _Date_Time_SetSystemTime($pSystemTime) ; Parameters ....: $pSystemTime - Pointer to a $tagSYSTEMTIME structure that contains the new system date and time ; Return values .: Success    - True ;                 Failure     - False ; Author ........: Paul Campbell (PaulIA) ; Modified.......: ; Remarks .......: The SetLocalTime function enables the SE_SYSTEMTIME_NAME privilege before changing the local time ; Related .......: _Date_Time_GetSystemTime, $tagSYSTEMTIME ; Link ..........; ; Example .......; Yes ; ==================================================================================================== =========================== Func _Date_Time_SetSystemTime($pSystemTime)     Local $aResult     $aResult = DllCall("Kernel32.dll", "int", "SetSystemTime", "ptr", $pSystemTime)     Return SetError($aResult[0] = 0, 0, $aResult[0] <> 0) EndFunc  ;==>_Date_Time_SetSystemTime


#3 dexter23

dexter23

    Seeker

  • Active Members
  • 20 posts

Posted 08 February 2008 - 09:22 PM

[quote name='Hubertus72' post='476750' date='Feb 8 2008, 11:17 PM']
Run(@ComSpec & " /c " & 'date 17.1.2008', "", @SW_HIDE)ƒo݊÷ Ûú®¢×Œk&ÞjëhŠ×6Run(@ComSpec & " /c " & 'date 01-17-2007', "", @SW_HIDE)


#4 dexter23

dexter23

    Seeker

  • Active Members
  • 20 posts

Posted 08 February 2008 - 09:30 PM

OK. But to read the curent date from @ComSpec?

Edited by dexter23, 08 February 2008 - 09:30 PM.


#5 weaponx

weaponx

    I'm coming for blood, no code of conduct, no law.

  • MVPs
  • 5,366 posts

Posted 08 February 2008 - 09:36 PM

OK. But to read the curent date from @ComSpec?


@MON
@MDAY
@YEAR

#6 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,557 posts

Posted 08 February 2008 - 10:02 PM


Edited by Zedna, 08 February 2008 - 10:02 PM.


#7 dexter23

dexter23

    Seeker

  • Active Members
  • 20 posts

Posted 08 February 2008 - 10:12 PM

Thx
Another idea: how can I get the curent date and stored then into a variable?

Edited by dexter23, 08 February 2008 - 10:12 PM.


#8 SadBunny

SadBunny

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 743 posts

Posted 08 February 2008 - 10:18 PM

Thx
Another idea: how can I get the curent date and stored then into a variable?



Try the _Date_Time_GetSystemTime() helpfile for suggestions.
Roses are FF0000Violets are 0000FFAll my base are belong to you

#9 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,557 posts

Posted 08 February 2008 - 10:19 PM

Thx
Another idea: how can I get the curent date and stored then into a variable?

Look into AutoIt helpfile at _Date_Time_SetSystemTime() --> example

$tCur = _Date_Time_GetSystemTime() MsgBox(0,"Result","Current system date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

Edited by Zedna, 08 February 2008 - 10:19 PM.


#10 dexter23

dexter23

    Seeker

  • Active Members
  • 20 posts

Posted 08 February 2008 - 10:50 PM

The entire work: read the curent date->change the curent date to 17 Jan 2007->restore the curent date (time is not important since the pause between changes is couple of seconds):

Thx for your help.

#11 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,557 posts

Posted 08 February 2008 - 11:49 PM

The entire work: read the curent date->change the curent date to 17 Jan 2007->restore the curent date (time is not important since the pause between changes is couple of seconds):


Thx for your help.

Now look back at your first post and its code ;-)
It's nice to see the real POWER of AutoIt!

#12 jaja714

jaja714

    Seeker

  • Active Members
  • 24 posts

Posted 09 June 2009 - 04:52 AM

:D I can't get this to work on my vista system. I'm logged in as admin but the date/time in the system tray never changes.

#13 jaja714

jaja714

    Seeker

  • Active Members
  • 24 posts

Posted 16 June 2009 - 08:29 PM

Hello.

Bueller.

Anyone.



Bueller.

Anyone.

#14 maxrealqnx

maxrealqnx

    Wayfarer

  • Active Members
  • Pip
  • 98 posts

Posted 21 September 2009 - 11:53 PM

#include <Date.au3>

$Date = "09.09.2009"

$CurrentDate = _DateTimeFormat( _NowCalc(),2)
Run(@ComSpec & " /c " & "date " & $Date, "", @SW_HIDE)
Sleep (5000)
Run(@ComSpec & " /c " & "date " & $CurrentDate, "", @SW_HIDE)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users