Jump to content

Detecting if File Exists or not!


Kash
 Share

Recommended Posts

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

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.

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

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.

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

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.

Regards

Kash

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