Jump to content

Office 2007 beta Date Switch


KJohn
 Share

Recommended Posts

I don't know how many of you are using the Office 2007 beta 2 but I am and as of Feb 1st 2007, its been 'disabled'. You can make it run with all the features if you just change the system date as each program in the Office2k set starts up. You can still install Office 2007 beta 2 technical refresh which is valid till March 31st 2007 and use this script to run it beyond that (until you get that machine with Vista and Office preinstalled!).

I've used AutoIt to automate the changing of the date. The date changes back to the current date once 10 seconds after the program's started up. Please note: In order not to complicate the script, I've assumed that nobody is going to open an Office 2007 application between 11:50:50 pm and 12:00:00 am.

Here's the script:

#NoTrayIcon
AutoItSetOption("MustDeclareVars", 0)
AutoItSetOption("RunErrorsFatal", 0)
Break(0)

Global $dd,$mm,$yyyy,$pid,$pidold

While 1
    $pid =  ProcessExists("WinWord.exe") + ProcessExists("PowerPnt.exe") + ProcessExists("Excel.exe") + ProcessExists("MSPub.exe")
    If $pid <> $pidold Then
        $dd = @MDAY
        $mm = @MON
        $yyyy = @YEAR
        _SetDate(01,01,2007)
        sleep(10000)
        _SetDate($dd,$mm,$yyyy)
    EndIf
    sleep(100)
    $pidold = $pid
WEnd

Func _SetDate($iDay, $iMonth = 0, $iYear = 0)
    Local $iRetval, $SYSTEMTIME, $lpSystemTime
    $SYSTEMTIME = DllStructCreate("ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort")
    $lpSystemTime = DllStructGetPtr($SYSTEMTIME)
    DllCall("kernel32.dll", "long", "GetLocalTime", "ptr", $lpSystemTime)
    DllStructSetData($SYSTEMTIME, 4, $iDay)
    DllStructSetData($SYSTEMTIME, 2, $iMonth)
    DllStructSetData($SYSTEMTIME, 1, $iYear)
    DllCall("kernel32.dll", "long", "SetLocalTime", "ptr", $lpSystemTime)
EndFunc

Add features as you please. My script can be closed only by killing the process in task manager.

Note: credit for the _setdate function goes to /dev/null. I've just modified it to suit my purpose.

Other programs of mine:

KJohn DiskMax

http://www.autoitscript.com/forum/index.php?showtopic=40674

KJohn DesktopSearch

http://www.autoitscript.com/forum/index.php?showtopic=40627

Link to comment
Share on other sites

i did almost the same as yours but it included an .ini file for better usage...

Backdater.au3

#Include <Process.au3>

Global $y=IniRead("backdate.ini","Backdate","Runasdate",""), $E=IniRead("backdate.ini","File2run","Name","")
Global $z=IniRead("backdate.ini","Backdate","Currentdate",""), $t=IniRead("backdate.ini","File2run","Time","")

$c=IniWrite("backdate.ini","Backdate","Currentdate",@MON&"-"&@MDAY&"-"&@YEAR)

If Not FileExists("backdate.ini") Then
    MsgBox(16,"ERROR finding .ini file!!","The backdate.ini file cannot be found! The program will exit... ",3)
    Exit    
EndIf

If Not FileExists($E) Then
    MsgBox(16,"ERROR finding file!!","The specified "&$E&" cannot be found, please check!! ",3)
    Exit
EndIf

If $y="" Then
    MsgBox(16,"ERROR !!","The DATE to backdate is not specified in the .ini file. ",3)
    Exit
Else
    TrayTip("","",1)
    TrayTip("","Backdating the date to "&$y, 1)
    Run("cmd.exe /c Date "&$y, "", @SW_HIDE)
    _RunDOS("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True")   
EndIf

If $E="" Then
    MsgBox(16,"ERROR !!","The file you want to run is not specified in the .ini file. ",3)
    Exit
Else
    TrayTip("","",1)
    TrayTip("","Your machine's date will be restored when "&$t&" seconds... ", 1)
    Run($E) 
    Sleep($t&"000")
    TrayTip("","Restoring the date to "&$z, 1)
    Run("cmd.exe /c Date "&$z, "", @SW_HIDE)
    _RunDOS("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True")
EndIf
Exit

Backdate.ini

;currentdate is the date you want to restore to
;Runasdate is the date you want to change to
;dateformat is mm-dd-yyyy
[Backdate]
Currentdate=02-12-2007
Runasdate=02-12-2006


;Name is the name of the program you want to run. 
;If the program is in a different folder, please provide the fullpath, for example C:\Program Files\New Folder\start.exe
;the file to run can be in any formats: .exe, .com and .bat
;Time is the delay in seconds for the date to return back to current date 
[File2run]
Name=SetupCapture.exe
Time=5
Edited by mikiutama
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...