Jump to content

Cannot run Winword


Recommended Posts

I'm a newby and have been playing with this awesome program for the last couple of days.

Now I want to run Winword and the Winword doc ''Textexample'', located at the desktop.

I get an error that Winword could'nt be found.

This is my code:

Run("winword.exe")

WinWaitActive("Textexample")

BTW: with notepad there is no problem.

What do I wrong.

TIA

Arnie

Link to comment
Share on other sites

Now I want to run Winword and the Winword doc ''Textexample'', located at the desktop.

I get an error that Winword could'nt be found.

Try going to start/run and type in winword.exe Does it open word?

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

just change "winword.exe" to "the.whole.path\winword.exe"......

:(

<{POST_SNAPBACK}>

OK, now Winword is booting, and I can boot the doc if it is located in C:\

My code:

Run("C:\program files\microsoft office\office10\winword.exe C:\textexample.doc")

Question is what is the computer/user - independent path to the desktop?

Edited by Arnie
Link to comment
Share on other sites

OK, now Winword is booting, and I can boot the doc if it is located in C:\

My code:

Run("C:\program files\microsoft office\office10\winword.exe C:\textexample.doc")

Question is what is the computer/user - independent path to the desktop?

<{POST_SNAPBACK}>

C:\Documents and Settings\User.Name\Desktop
Link to comment
Share on other sites

@DesktopDir  ?

<{POST_SNAPBACK}>

Ah...where in the documentation would all those locations be?

I know that there's @WindowsDir, and now @DesktopDir, but I'd like to know what the others are now too. :(

Link to comment
Share on other sites

  • Developers

Ah...where in the documentation would all those locations be?

I know that there's @WindowsDir, and now @DesktopDir, but I'd like to know what the others are now too. :(

<{POST_SNAPBACK}>

Just open the helpfile and check out the AutoIt\Macro reference\Directory macros..

:(

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

Thanks for the help guys (BTW: great response).

Next code opens a new Word document, not the text.doc.:

Run("C:\program files\microsoft office\office10\winword.exe @DesktopDir\Text.doc")

I used also: @DesktopCommonDir

Anyone?

Edited by Arnie
Link to comment
Share on other sites

Thanks for the help guys (BTW: great response).

Next code opens a new Word document, not the text.doc.:

I used also: @DesktopCommonDir

Anyone?

<{POST_SNAPBACK}>

Try this line:

Run(@ProgramFilesDir & "\Microsoft Office\Office10\Winword.exe " & @DesktopDir & "\Text.doc")
Edited by MHz
Link to comment
Share on other sites

Try this line:

Run(@ProgramFilesDir & "\Microsoft Office\Office10\Winword.exe " & @DesktopDir & "\Text.doc")

<{POST_SNAPBACK}>

Thanks MHz.

Unfortunately this does'nt work either.

I get (translated) message: can't find documentpath.

Anymore suggestions?

Link to comment
Share on other sites

Sorry Arnie, try this. The document path may need inverted comma's.

I will cover both desktops also. If you see the messagebox, then it will try the @DesktopCommonDir.

$document = @DesktopDir & '\Text.doc'
If FileExists($document) Then
    Run(@ProgramFilesDir & '\Microsoft Office\Office10\Winword.exe "' & $document & '"')
Else
    MsgBox(0, '', 'Using 2nd Choice')
    $document = @DesktopCommonDir & '\Text.doc'
    Run(@ProgramFilesDir & '\Microsoft Office\Office10\Winword.exe "' & $document & '"')
EndIf
Link to comment
Share on other sites

Hi,

Also;

$document = @DesktopDir & '\Text.doc'
$directoryExe=@ProgramFilesDir&"\Microsoft Office\Office10\Winword.exe"
If StringInStr($document, " ") Then $document = '"' & $document & '"'
Run($directoryExe&" "&$document)

** OR else use the "short file name" command on "@DesktopDirectory

** Better to use "if instr" as applies to directory and file names if you use @comspec, or Run Dos commands too

Randall

Edited by randallc
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...