Jump to content

Opening Microsoft Word File


Recommended Posts

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?
Link to comment
Share on other sites

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

 

Link to comment
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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

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