donnyh13 Posted August 31, 2015 Posted August 31, 2015 (edited) Hi all, I had created a script back in November with the latest at that time of AutoIt, it worked and then I haven't needed it since. Now I have downloaded the latest AutoIt on a different computer and copied the same script over. It works except for when it get to the spot where it's supposed to open a word doc. This isn't working. 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 in the same directory, of the file name I intend to open, I would then enter the name including the extension, for example "open.rtf". Is there something i'm missing?? something that changed with a recent update? Thanks Edited March 13 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."
DakotaSamuel Posted August 31, 2015 Posted August 31, 2015 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
water Posted August 31, 2015 Posted August 31, 2015 When you run your script from SciTE do you get any error messages? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
donnyh13 Posted September 1, 2015 Author Posted September 1, 2015 (edited) Thanks for the replies, On 8/30/2015 at 10:46 PM, DakotaSamuel said: 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 tried the code, but still nothing, I open it, it just runs and goes away, the Word I specify doesn't open. I didn't see any errors etc. i'm wondering if it is something to do with my computer? Edited March 13 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."
DakotaSamuel Posted September 1, 2015 Posted September 1, 2015 What versions of Autoit and Word do you have installed? -DakotaSamuel
kaisies Posted September 1, 2015 Posted September 1, 2015 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)
donnyh13 Posted September 2, 2015 Author Posted September 2, 2015 (edited) Hi Kaisies, whoops, 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 Edited March 13 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."
kaisies Posted September 2, 2015 Posted September 2, 2015 You should look at the doc open udf page and look at what error 1 means donnyh13 1
donnyh13 Posted September 8, 2015 Author Posted September 8, 2015 (edited) Thanks Kaisies, Any hints on how to correct it? As I am not very fluent with all of this code language. Edited March 13 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."
Solution water Posted September 8, 2015 Solution Posted September 8, 2015 @error = 1 means: $oAppl is not an objectIt looks like _Word_Create already returned an error. I suspect there is no MS Word installed on your machine. donnyh13 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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
donnyh13 Posted September 9, 2015 Author Posted September 9, 2015 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."
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now