Jump to content

problems opening Word?


Recommended Posts

Hi all, I had created a script back in november with the latest at that time of autoit, it worked and then I didnt need it since. now I have downloaded the latest auto it on a different computer and copied the same script over. it works except for when it get to the spot where its supposed to open a word doc. this wont work. I have tried making a new script solely meant to open a word doc, and cannot get it to open, what am I doing wrong?

 

this is my code,

#include <Word.au3>


Local $location = InputBox( "Location.", "What is the name of the file including the extension, {for example .rtf}")
Sleep ( 3000)
Local $WordCreate = _Word_Create()
Sleep ( 3000)
Local $path = @ScriptDir & "\"&$location
Sleep ( 3000)
_Word_DocOpen( $WordCreate, $path,)

I would normally run the script it would prompt for where its located, which I would enter the name including the extension, for example "open.rtf". which is located in the same place im running my script from. Is there something im missing?? something that changed with a recent update?

thanks

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

When you run your script from SciTE do you get any error messages?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks for the replies, 

Your code has a few typos. Try this:

#include <Word.au3>

Local $location = InputBox( "Location.", "What is the name of the file including the extension, {for example .rtf}")
Local $WordCreate = _Word_Create()
Local $path = @ScriptDir & "\" & $location
_Word_DocOpen( $WordCreate, $path)

And I don't believe the sleeps are needed either.

 

-DakotaSamuel

I did try the code, still nothing, I run it and it just runs and goes away, the word I specify doesnt open.no erroes etc. im wondering if it is something to do with my computer?  

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Thanks for the replies, 

I did try the code, still nothing, I run it and it just runs and goes away, the word I specify doesnt open.no erroes etc. im wondering if it is something to do with my computer?  

You have no error checking, so It wouldn't report an error.

Does this display an error?

 

#include <Word.au3>

Local $location = InputBox( "Location.", "What is the name of the file including the extension, {for example .rtf}")
Local $WordCreate = _Word_Create()
Local $path = @ScriptDir & "\" & $location
_Word_DocOpen( $WordCreate, $path)
If @Error Then Msgbox(0,'',"_Word_DocOpen returned @error: " & @error)

 

Link to comment
Share on other sites

Hi Kaisies, woops, I thought you meant the syntax check type errors. I tried your code and it returned code 1

 

The installer says 3.3.12.0 for autoit. 

I am actually using WPS writer ( which worked before with the old code) that version is 9.1.0.4758

Thanks

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

Thanks Kaisies,

any hints on how to correct it? as I am not very fluent in all of this code language :P

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Link to comment
Share on other sites

@error = 1 means: $oAppl is not an object
It looks like _Word_Create already returned an error. I suspect there is no MS Word installed on your machine.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks,

I really appreciate your help!

 

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

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