Jump to content
Sign in to follow this  
pendragon

Why won't this script work?

Recommended Posts

pendragon

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","")

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
pendragon

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?

Share this post


Link to post
Share on other sites
pendragon

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?

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  

×