Jump to content

Recommended Posts

Posted

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?

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
  • 5 months later...
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
Posted

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

  • 3 weeks later...
Posted

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)

  • 9 years later...
Posted
1 hour ago, naveenlr said:

I need office 2007 automatic installation file

Hi, It is illegal to distribute "office 2007 installation files" so you won't find any here. Also, you have bumped a 10 year old thread, please look at the thread's age before posting in it :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted

Using Microsoft Office 2007 Installation run:

Setup.exe /admin

This should bring up the Microsoft Office Customization Tool, just follow it through and at the end save the file as MyCustom.msp, now place this file in the Updates folder in your Microsoft Office 2007 folder (you may need to create the folder if it doesn't already exist).  Run setup.exe and it should automatically use the MyCustom.msp file, alternatively you can point the setup.exe to the msp using something like:

Setup.exe /adminfile MyCustom.msp

 

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