dexter23 Posted February 8, 2008 Share Posted February 8, 2008 (edited) 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 February 8, 2008 by dexter23 Link to comment Share on other sites More sharing options...
Zedna Posted February 8, 2008 Share Posted February 8, 2008 C:\Program Files\AutoIt3\Include\date.au3 ; #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 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
dexter23 Posted February 8, 2008 Author Share Posted February 8, 2008 Run(@ComSpec & " /c " & 'date 17.1.2008', "", @SW_HIDE)oÝ÷ Ûú®¢×k&Þjëh×6Run(@ComSpec & " /c " & 'date 01-17-2007', "", @SW_HIDE) Link to comment Share on other sites More sharing options...
dexter23 Posted February 8, 2008 Author Share Posted February 8, 2008 (edited) OK. But to read the curent date from @ComSpec? Edited February 8, 2008 by dexter23 Link to comment Share on other sites More sharing options...
weaponx Posted February 8, 2008 Share Posted February 8, 2008 OK. But to read the curent date from @ComSpec?@MON @MDAY @YEAR Link to comment Share on other sites More sharing options...
Zedna Posted February 8, 2008 Share Posted February 8, 2008 (edited) #include <Date.au3> $tNew = _Date_Time_EncodeSystemTime(1, 17, 2007) _Date_Time_SetSystemTime(DllStructGetPtr($tNew)) Edited February 8, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
dexter23 Posted February 8, 2008 Author Share Posted February 8, 2008 (edited) #include <Date.au3> $tNew = _Date_Time_EncodeSystemTime(1, 17, 2007) _Date_Time_SetSystemTime(DllStructGetPtr($tNew))Thx Another idea: how can I get the curent date and stored then into a variable? Edited February 8, 2008 by dexter23 Link to comment Share on other sites More sharing options...
SadBunny Posted February 8, 2008 Share Posted February 8, 2008 ThxAnother idea: how can I get the curent date and stored then into a variable?Try the _Date_Time_GetSystemTime() helpfile for suggestions. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Zedna Posted February 8, 2008 Share Posted February 8, 2008 (edited) 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 February 8, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
dexter23 Posted February 8, 2008 Author Share Posted February 8, 2008 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): #include <Date.au3> $tCur = _Date_Time_GetSystemTime() $tNew = _Date_Time_EncodeSystemTime(1, 17, 2007) _Date_Time_SetSystemTime(DllStructGetPtr($tNew)) Sleep(5000) _Date_Time_SetSystemTime(DllStructGetPtr($tCur)) Thx for your help. Link to comment Share on other sites More sharing options...
Zedna Posted February 8, 2008 Share Posted February 8, 2008 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): #include <Date.au3> $tCur = _Date_Time_GetSystemTime() $tNew = _Date_Time_EncodeSystemTime(1, 17, 2007) _Date_Time_SetSystemTime(DllStructGetPtr($tNew)) Sleep(5000) _Date_Time_SetSystemTime(DllStructGetPtr($tCur)) Thx for your help. Now look back at your first post and its code ;-) It's nice to see the real POWER of AutoIt! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
jaja714 Posted June 9, 2009 Share Posted June 9, 2009 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. Link to comment Share on other sites More sharing options...
jaja714 Posted June 16, 2009 Share Posted June 16, 2009 Hello. Bueller. Anyone. Bueller. Anyone. Link to comment Share on other sites More sharing options...
maxrealqnx Posted September 21, 2009 Share Posted September 21, 2009 #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) Visit My Website Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now