Sign in to follow this  
Followers 0
pervezshaikh

Opening Microsoft Word File

5 posts in this topic

Yesterday I asked for help, but surprisingly it is not available now. It seems my question is lost in cyberspace.

I have run into AutoIT couple of days ago. It is interesting to me as I keep on working to a MS Word file where I am to perform a number of repetitive actions of mouse clicks and keystrokes. I opened the file through following code

$MSWordPath= "D:Program FilesMicrosoft OfficeOffice12WINWORD.EXE"
$parameter = ' "E:Backup-requiredBackupKnowledgeManagementEbooksMainDoc.docx"'
Run($MSWordPath & $parameter)
 
Afterwards, I need to send few keystrokes as ALT+w. I used
 
Send("!w")
 
Here comes my problem. As MainDoc.docx requires certain time to get open the keystrokes were lost. There can be a possible solution. A dialogue box may be inserted with an OK button to get manual pause. When OK button is clicked, the dialogue box may disappear and focus should shift to Word file. Will someone help me how to code it?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Have a look at

RunWait()

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

Hi Breathe!

RunWait()=Runs an external program and pauses script execution until the program finishes.

No doubt the script stops, but it stops till I exit MainDoc.docx file. This tip is not helpful.

Share this post


Link to post
Share on other sites

pervezshaikh, welcome to AutoIt and to the forum!

AutoIt is shipped with a UDF (a library of functions) to manipulate Word by COM - that's an API (advanced programming interface), with which you can automate pretty much everything in Word, without relying on mouse click and key press.

look in the help file: Contents > User Defined Functions > Word Management

Share this post


Link to post
Share on other sites

Hi orbs!

It is a helpful tip.

Share this post


Link to post
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
Sign in to follow this  
Followers 0