BillyNelson Posted July 10, 2012 Share Posted July 10, 2012 I have a script that asks a series of questions and then opens a few documents and replaces values with the gathered data. Today I installed the latest version of AutoIT and then opened the script and added a new icon to it. After saving it I found that the script no longer updates the word documents. The Excel Documents update with no problem, the files are copied and renamed with no problem, but the word documents are no longer updating.example.au3 Any help will be greatly appreciated. As well, I have another script that asks which customer I am working with and then opens a GUI listing the available documents. The documents no longer open when I click on them, but we'll look at that after I get this fixed. Link to comment Share on other sites More sharing options...
BillyNelson Posted July 10, 2012 Author Share Posted July 10, 2012 expandcollapse popup#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=DocsCopy.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #include ;------------------------------------------------------ ; Getting Customer Name for Directory Creation ;------------------------------------------------------ $Cust = InputBox ("Customer Name", "Customer Name") $Location = InputBox ("Customer Location", "Customer Location") ;------------------------------------------------------ ; Create Directory for Document Storage ; ----------------------------------------------------- DirCreate ("D:Documents" & $Cust) $Doclocale = ("D:Documents" & $Cust) ;------------------------------------------------------ ; Copy Engagement Docs ;------------------------------------------------------ FileCopy ("C:ConsultDocs*.*", $Doclocale) FileMove ($DocLocale & "Daily Status.xls", $DocLocale & "" & $Cust & " Daily Status.xls") FileMove ($DocLocale & "Project Completion document.doc", $DocLocale & "" & $Cust & " Project Completion document.doc") FileMove ($DocLocale & "Health Check.docx", $DocLocale & "" & $Cust & " Health Check.docx") FileMove ($DocLocale & "Server Installation and Production Server Layout.docx", $DocLocale & "" & $Cust & " Server Installation and Production Server Layout.docx") ;------------------------------------------------------- ; Gather project information ;------------------------------------------------------- $oDStatus = ($DocLocale & "" & $Cust & " Daily Status.xls") $oProjDoc = ($DocLocale & "" & $Cust & " Project Completion document.doc") $oHlthDoc = ($DocLocale & "" & $Cust & " Health Check.docx") $oLayout = ($DocLocale & "" & $Cust & " Server Installation and Production Server Layout.docx") $oStartDate = Inputbox ("Start Date", "Start Date") $oEndDate = InputBox ("End Date", "End Date") $oConsultant = InputBox ("Consultant Name", "Consultant Name") $oSOWDate = InputBox ("SOW Date", "SOW Date") ;-------------------------------------------------------- ; Update Project Completion Document ;-------------------------------------------------------- $oWordApp = _WordCreate ($oProjDoc) $oDoc = _WordDocGetCollection ($oWordApp, 0) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc, "RefStartDate", $oStartDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc, "RefEndDate", $oEndDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc, "RefConsultant", $oLDConsultant) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc, "RefSOWDate", $oSOWDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc, "RefCustomerName", $Cust) _WordDocSave($oDoc) _WordDocClose ($oDoc) ConsoleWrite(@error & @CRLF) ;------------------------------------------------------------ ; Update Health Check Document ;------------------------------------------------------------ $oWordApp1 = _WordCreate ($oHlthDoc) $oDoc1 = _WordDocGetCollection ($oWordApp1, 0) ;$oWordApp = _WordCreate ($oProjDoc) ConsoleWrite(@error & @CRLF) $oDoc1 = _WordDocGetCollection ($oWordApp1, 0) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc1, "RefStartDate", $oStartDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc1, "RefEndDate", $oEndDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc1, "RefConsultant", $oLDConsultant) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc1, "RefSOWDate", $oSOWDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc1, "RefCustomerName", $Cust) _WordDocFindReplace( $oDoc1, "refLocation", $Location) _WordDocSave($oDoc1) _WordDocClose ($oDoc1) ConsoleWrite(@error & @CRLF) ;------------------------------------------------------------ ; Update Daily Status Report ;------------------------------------------------------------ $rRowNum = "3H" $oExcel = _ExcelBookOpen ($oDStatus) _ExcelWriteCell ($oExcel, $oConsultant, 3, 8 ) _ExcelWriteCell ($oExcel, $Cust, 2, 8 ) _ExcelWriteCell ($oExcel, $oStartDate, 5, 8 ) _ExcelWriteCell ($oExcel, $oEndDate, 6, 8 ) _ExcelBookSave ($oExcel) _ExcelBookClose ($oDStatus) ConsoleWrite(@error & @CRLF) ;--------------------------------------------------------------------- ; Update LANDesk Core Server Installation and Production Server Layout ;--------------------------------------------------------------------- $oWordApp2 = _WordCreate ($oLayout) $oDoc2 = _WordDocGetCollection ($oWordApp2, 0) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc2, "RefStartDate", $oStartDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc2, "RefEndDate", $oEndDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc2, "RefConsultant", $oLDConsultant) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc2, "RefSOWDate", $oSOWDate) ConsoleWrite(@error & @CRLF) _WordDocFindReplace( $oDoc2, "RefCustomerName", $Cust) _WordDocFindReplace( $oDoc2, "refLocation", $Location) _WordDocSave($oDoc2) _WordDocClose ($oDoc2) ConsoleWrite(@error & @CRLF) Link to comment Share on other sites More sharing options...
bogQ Posted July 10, 2012 Share Posted July 10, 2012 (edited) do you have error log from scite that you can post or? Edited July 10, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
BillyNelson Posted July 10, 2012 Author Share Posted July 10, 2012 Here is the error log of a condensed version of the script. It is only copying one doc and gathering and updating one piece of the data Below I will add the test script as it sits right now. >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "F:AutoITtestdocs.au3" /UserParams +>15:28:14 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64) >Running AU3Check (1.54.19.0) from:C:Program Files (x86)AutoIt3 +>15:28:14 AU3Check ended.rc:0 >Running:(3.3.6.1):C:Program Files (x86)AutoIt3autoit3_x64.exe "F:AutoITtestdocs.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop --> Word.au3 Error from function _WordDocOpen, $_WordStatus_InvalidObjectType --> Word.au3 Error from function _WordDocGetCollection, $_WordStatus_InvalidObjectType --> Word.au3 Error from function _WordDocFindReplace, $_WordStatus_InvalidDataType +>15:28:18 AutoIT3.exe ended.rc:0 expandcollapse popup#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=DocsCopy.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Date.au3> #include <File.au3> #include <WindowsConstants.au3> #include <Word.au3> #include <Excel.au3> ;------------------------------------------------------ ; Getting Customer Name for Directory Creation ;------------------------------------------------------ $Cust = InputBox ("Customer Name", "Customer Name") $Location = InputBox ("Customer Location", "Customer Location") ;------------------------------------------------------ ; Create Directory for Document Storage ; ----------------------------------------------------- DirCreate ("D:Documents" & $Cust) $Doclocale = ("D:Documents" & $Cust) ;------------------------------------------------------ ; Copy Engagement Docs ;------------------------------------------------------ FileCopy ("C:ConsultDocs*.*", $Doclocale) ;FileMove ($DocLocale & "Daily Status.xls", $DocLocale & "" & $Cust & " Daily Status.xls") FileMove ($DocLocale & "Project Completion document.doc", $DocLocale & "" & $Cust & " Project Completion document.doc") ;FileMove ($DocLocale & "Health Check.docx", $DocLocale & "" & $Cust & " Health Check.docx") ;FileMove ($DocLocale & "Server Installation and Production Server Layout.docx", $DocLocale & "" & $Cust & " Server Installation and Production Server Layout.docx") ;------------------------------------------------------- ; Gather project information ;------------------------------------------------------- ;$oDStatus = ($DocLocale & "" & $Cust & " Daily Status.xls") $oProjDoc = ($DocLocale & "" & $Cust & " Project Completion document.doc") ;$oHlthDoc = ($DocLocale & "" & $Cust & " Health Check.docx") ;$oLayout = ($DocLocale & "" & $Cust & " Server Installation and Production Server Layout.docx") $oStartDate = Inputbox ("Start Date", "Start Date") ;$oEndDate = InputBox ("End Date", "End Date") ;$oConsultant = InputBox ("Consultant Name", "Consultant Name") ;$oSOWDate = InputBox ("SOW Date", "SOW Date") ;-------------------------------------------------------- ; Update Project Completion Document ;-------------------------------------------------------- $oWordApp = _WordCreate($oProjDoc,0, 0) $oWord = _WordDocOpen($oWordApp, $oProjDoc) _WordDocFindReplace($oWord, "RefStartDate", $oStartDate) Link to comment Share on other sites More sharing options...
GMK Posted July 10, 2012 Share Posted July 10, 2012 Looking at the error, _WordDocOpen doesn't see $oWordApp as a valid object. Try replacing $oWordApp = _WordCreate($oProjDoc,0, 0) with $oWordApp = _WordCreate("", 0, 0) Link to comment Share on other sites More sharing options...
BillyNelson Posted July 10, 2012 Author Share Posted July 10, 2012 That didn't help. I am going to uninstall this version and reinstall the old version and see if it gets resolved. Link to comment Share on other sites More sharing options...
MrMitchell Posted July 10, 2012 Share Posted July 10, 2012 (edited) What if it can't find $oProjDoc? Maybe do a ConsoleWrite on it or MsgBox or FileExists to see if it exists before trying to use it? You have a space before "Project" in the filename: $oProjDoc = ($DocLocale & "" & $Cust & " Project Completion document.doc") Windows can't be too happy about that Edited July 10, 2012 by MrMitchell Link to comment Share on other sites More sharing options...
bogQ Posted July 10, 2012 Share Posted July 10, 2012 (edited) project name is with $Cust variable, so that should not be the problem if the var is not empty the only thing that cross my mind is did he try to restart his comp after upgrading to new version, sometimes restart is the way to go because his replicated script works fine for me. and another thing how do he run >Running:(3.3.6.1) when i run >Running:(3.3.8.1) and Starting AutoIt3Wrapper v.2.1.0.33 when my is Starting AutoIt3Wrapper v.2.0.3.0 i'm a little confused on this spot Edited July 10, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Spiff59 Posted July 10, 2012 Share Posted July 10, 2012 (edited) i'm a little confused on this spotI can run 3.3.8.1 or 3.3.9.4 Beta, and both use AutoITWrapper 2.1.0.8So, I have a different AutoITWrapper installed than either of you and it's still older than the OP's that is run with 3.3.6.1.So... I'm also confused. Edited July 10, 2012 by Spiff59 Link to comment Share on other sites More sharing options...
BrewManNH Posted July 10, 2012 Share Posted July 10, 2012 Jos released an updated version of AutoIt3Wrapper on June 10th, the new version is 2.1.1.0, so maybe there was an interim version. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
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