Kash Posted August 11, 2009 Share Posted August 11, 2009 Hi, I would like to peform following task through AutoIT program. Program should check if file A.doc exists at a specified location. If file exists is should open it in append mode and write in file. IF file does not exist then it should create it and then write into document. I have below code snippet. I know how to crate file and write into it but i am unable to check if it already exists or not. $oWordApp = _WordCreate("E:\Data\Test.doc",0,0,0) $oDoc = _WordDocGetCollection ($oWordApp, 0) ;This function adds picture into the document _WordDocAddPicture ($oDoc, "E:\Data\1.gif",1, 1) _WordDocSave($oDoc) first time it adds 1.gif in document, when i run it next time i want to add 2.gif in the document(1.gif should be as it is) and save it. Regards Kash. Link to comment Share on other sites More sharing options...
Scriptonize Posted August 11, 2009 Share Posted August 11, 2009 Hi,I would like to peform following task through AutoIT program.Program should check if file A.doc exists at a specified location. If file exists is should open it in append modeand write in file. IF file does not exist then it should create it and then write into document. I have below codesnippet. I know how to crate file and write into it but i am unable to check if it already exists or not.You need to take a look at the functions FileExists, FileOpen and FileClose.They may help you in achieving your goal. If you learn from It, it's not a mistake Link to comment Share on other sites More sharing options...
Manjish Posted August 11, 2009 Share Posted August 11, 2009 Hi,I would like to peform following task through AutoIT program.Program should check if file A.doc exists at a specified location. If file exists is should open it in append modeand write in file. IF file does not exist then it should create it and then write into document. I have below codesnippet. I know how to crate file and write into it but i am unable to check if it already exists or not.$oWordApp = _WordCreate("E:\Data\Test.doc",0,0,0)$oDoc = _WordDocGetCollection ($oWordApp, 0) ;This function adds picture into the document _WordDocAddPicture ($oDoc, "E:\Data\1.gif",1, 1)_WordDocSave($oDoc)first time it adds 1.gif in document, when i run it next time i want to add 2.gif in the document(1.gif should be as it is) and save it. RegardsKash.Please check help file for FileExists(), FileOpen() and filewrite() [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Kash Posted August 11, 2009 Author Share Posted August 11, 2009 Please check help file for FileExists(), FileOpen() and filewrite()Thanks. Can you please suggest how to open existing word document using _WordDocOpen function?Pleae note i am not adding plain text to document. I need to append screen shots captured by _ScreenCapture_Capture function.RegardsKash 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