in Robotics, My robot have to call this script to Open MS Word in first instance and search given Bookmark name in that ( I wanted to pass bookmark name and .Jpg file location path as 2 input arguments).
If we find respective bookmark, I have to attach the .jpg file as a screen dump instead of just file attachment. if I can't find any given name bookmark in MS Word, this script should give return back with number like 1 or 0. I wanted to call this script multiple times in the robot with different bookmark and .jpg file names, then after completion of all bookmark names , script should close the MS Word return the control completely back to Robot. could you please help me to provide the script.
This is likely to require some C# programming as the Word Connector is not built to handle images. You can do some research on Word Interop to see if there is code available to insert images into a Word doc. Here's one I found that might get you started.
When you setup the connector, it will detect bookmarks in the document and add them as properties, making them easy to fill out in an automation (you simply drag the name of whatever bookmark out and pass text to it). If your document is variable, then you will not be able to take advantage of that and would also need to program that in yourself. The link above shows how you could iterate the bookmarks in the doc if they are variable.