saywell 3 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 Share this post Link to post Share on other sites
Richard Robertson 187 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. Share this post Link to post Share on other sites
saywell 3 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 Share this post Link to post Share on other sites
water 2,391 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 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
saywell 3 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 Share this post Link to post Share on other sites