Sign in to follow this  
Followers 0
Omatsei

Office 2007 Automated Install

6 posts in this topic

Has anyone tried to automate Office 2007 yet? I know it's not out to the general public, but since I work in a big university, we have it now.

I'm trying to write a program that will completely automate the install process, but since the interface is so different, I have a feeling that it can't be done by anything other than sending keystrokes. The AutoIt Window Info never changes at all throughout the install, no matter what text, buttons, whatever, appear in the window. It makes it very difficult to work with...

I have a temporary fix in place where it sends one keystroke, then waits 1/4 of a second, then sends another, and continues that until it gets to the "installing now" phase. Then I have it hit Alt-C every 15 seconds until the window closes. Overall, it's a very user-friendly interface, but it sucks for automating. Anybody else experimented with it?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You will be better for using some sort of Microsoft Office 2007 Deploying Kit.

Office install will behave differently by client OS and previous installation of Office and so forth. It will nightmare to Visual script all..

Office 2007 Resource Kit

Edit: Found the link

Edited by Joon

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I need to get this working too. I have tried a few different methods but I'm not having a lot of luck. The last way I tried was OCR using with GOCR. It does kind of work but for some reason it reads the text inconsistantly so its hard to get it working reliably.

Heres what I have so far:

(For it to work you will need to put gocr044.exe, libnetpbm10.dll and bmptopnm.exe from the NetPbm package and the files from capture_dll.zip in the directory with the script and batch file.

test.au3

DIM $serial= InputBox($title, "Serial",@UserName)
$path = @DesktopDir & "\Office 2007 Standard\Setup.exe"
run($path)
WinWaitActive("Microsoft Office Standard 2007", "")
While 1
    $ocr_text = _refreshOcrText("Microsoft Office Standard 2007")

    Select 
        Case StringInStr($ocr_text, "Enter your Product Key", 2)
            ClipPut ($serial)
            Send("^v!c")
        case StringInStr($ocr_text, "License", 2)
            send("!a!c")
        case StringInStr($ocr_text, "Choose the", 2)
            send("!a!c")
        case StringInStr($ocr_text, "pragramsrun", 2)
            send("!i")
        case StringInStr($ocr_text, "getfeeproductupda", 2)
            send("!c")
        case StringInStr($ocr_text, "Change your in", 2)
            msgbox(16, "Error", "Error Office already installed")
            Exit
        case StringInStr($ocr_text, "Progress", 2)
            sleep(10000)
        case Else
            msgbox(16, "Error", "Unknown window, text as follows:")
            msgbox(0, "title", $ocr_text)
            Exit
    EndSelect
    
    sleep(100)
WEnd
        
Func _refreshOcrText($title)
    ; Make sure the window exists at all
    If Not WinExists($title, "") Then
        msgbox(16, "Error", "Window: " & $title & " doesn't exist!")
        Exit
    EndIf
    
    ; Run the OCR stuff to create the text.txt file
    WinActivate($title, "")
    ;WinSetState($title, "", @SW_SHOW)
    $size = WinGetPos($title, "")
    DllCall("captdll.dll", "int", "CaptureRegion", "str", "screenshot.bmp", "int", $size[0], "int", $size[1], "int", $size[2], "int", $size[3])
    RunWait("ocr.bat", "", @SW_HIDE)
    
    ; Open the text file
    $file = FileOpen("text.txt", 0)
    If $file == -1 Then
        msgbox(16, "OCR Error", "Error Opening file: text.txt")
        Exit
    EndIf

    ; Copy the text from the file to the text variable and close it
    $text = FileRead($file)
    FileClose($file)
    
    ; Cleanup the files
    FileDelete("screenshot.txt")
    FileDelete("screenshot.bmp")
    FileDelete("text.txt")
    
    Return $text
EndFunc

ocr.bat

@@echo off

bmptopnm.exe screenshot.bmp > screenshot.txt
gocr044.exe -i screenshot.txt > text.txt
Edited by kzar

Share this post


Link to post
Share on other sites

Setup.exe /admin creates an admin file

Setup.exe /admin <adminfile.msp> installs using that admin file

easiest method easy to set up.

Share this post


Link to post
Share on other sites

Unfortuneately I can't use the customization tool as I am installing Office 2007 Standard and you need enterprise. Any other ideas?

Share this post


Link to post
Share on other sites

This page has the awnser.

Basicly you just have to edit an XML file. (Make sure you edit it with a basic text editor not a proper XML editor, and be warned its case sensitive)

Share this post


Link to post
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
Sign in to follow this  
Followers 0