Sign in to follow this  
Followers 0
Arnie

Cannot run Winword

16 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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. :(

Share this post


Link to post
Share on other sites

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

:(


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

:(

<{POST_SNAPBACK}>

Hoho! Thank you! :(

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#12 ·  Posted

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?

Share this post


Link to post
Share on other sites

#13 ·  Posted

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

Share this post


Link to post
Share on other sites

#14 ·  Posted

Thank you very much Mhz, this one works like a charm.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#16 ·  Posted

Thanks a lot randallc.

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