saywell Posted August 3, 2010 Posted August 3, 2010 (edited) Tucked away in the examples of the word udf are some interesting feature like: $sText = $oWordApp.Activedocument.Range.Text for getting text and $oDoc.Range.insertAfter for entering text However, I can't find anything in the help files to explain their syntax. For example, the first example seems only to get the first line of text - how do I get ALL the text? Presumably something to do with 'range'? I'd be grateful if anyone could point me towards a source of info on what similar functionality might be tucked away with these examples, and some details on how to use them. Do they, perhaps, use syntax from another language? Thanks, William Edited August 5, 2010 by saywell
Richard Robertson Posted August 3, 2010 Posted August 3, 2010 They are using COM objects which are documented by Microsoft. AutoIt has no control over them. You need to figure out which COM object is being used and look up the documentation for it.
saywell Posted August 5, 2010 Author Posted August 5, 2010 (edited) OK so this is Visual Basic for Applications - VBA - as used in Word etc macros, I think.Lots of documentation on the web.BUT I need help with the syntax for calling these from AutoitFor example, I can use $oDoc.Range.insertAfter to insert at end of text or $0Doc.Selection.EndKey to put cursor at end of line.However, if I try $oDoc.Selection.EndKey Unit:=wdStory to put cursor at the end of the document [as per <ctrl>-End] I get an error due to the space.So my question is, how do I get Autoit to implement commands with an argument separated by the space?Regards,William Edited August 5, 2010 by saywell
water Posted August 5, 2010 Posted August 5, 2010 However, if I try $oDoc.Selection.EndKey Unit:=wdStory to put cursor at the end of the document [as per <ctrl>-End] I get an error due to the space. Everything after the space are parameters to the method. So the above statement should read in AutoIt: $wdStory = 6 $oDoc.Selection.EndKey($wdStory) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
saywell Posted August 5, 2010 Author Posted August 5, 2010 (edited) Everything after the space are parameters to the method. So the above statement should read in AutoIt: $wdStory = 6 $oDoc.Selection.EndKey($wdStory) Many thanks. That's the syntax sorted, but where did the $wdStory = 6 come from? Specifically, the value 6? Found it - 6 is the value for end of text! William Edited August 5, 2010 by saywell
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