Jump to content

Why won't this script work?


Recommended Posts

Rather than banging my head against the desk anymore, can someone tell me why this won't work....I always seem to get stuck when it comes to the use of quotes and joining strings! Grrr!

Global $OfficeVersion

$objWord = ObjCreate("Word.Application")
$OfficeVersion = $objWord.Version
$objWord.Quit

Switch $OfficeVersion
    Case "9.0"
        $OfficeVersion = "Office9"
    Case "10.0"
        $OfficeVersion = "Office10"
    Case "11.0"
        $OfficeVersion = "Office11"
    Case "12.0"
        $OfficeVersion = "Office12"
    Case "14.0"
        $OfficeVersion = "Office14"
    EndSwitch
    
Run("C:\Program Files (x86)\Microsoft Office\" & $OfficeVersion & "\Outlook.exe","")
Link to comment
Share on other sites

  • Developers

Works for me on Win7/x64 Office 2007.

What is the problem?

Have you put in dome debugging statements to figure out what info is returned to $OfficeVersion?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes, have done the debugging and $OfficeVersion is returning correctly. What version of Autoit do you have? I've got Win7/x64 and Office 2007 as well and it just won't launch outlook. No errors or anything, the script just runs and exits without launching.

Works for me on Win7/x64 Office 2007.

What is the problem?

Have you put in dome debugging statements to figure out what info is returned to $OfficeVersion?

Link to comment
Share on other sites

  • Developers

autoit3_x64.exe ver 3.3.6.1

What is the value of $OfficeVersion after the Case and before the run?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Oops....sorry. Someone decided to install office to a non standard location on this pc I'm testing with. Silly me! I guess that points out one potential flaw with my script though!

Thanks

autoit3_x64.exe ver 3.3.6.1

What is the value of $OfficeVersion after the Case and before the run?

Link to comment
Share on other sites

  • Developers

What about?:

RegRead('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE', 'Path')

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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