alexzhao 0 Posted September 5, 2015 I am new to autoIT script, I have a requirement to open a Word and a PPT file, then goto the last Page of Word and PPT file. Could someone share the sample code of this? Thank you very much. Share this post Link to post Share on other sites
Jfish 125 Posted September 5, 2015 This will get you to the end of the Word doc:#include <MsgBoxConstants.au3> #include <Word.au3> ; Create application object Local $oWord = _Word_Create() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocOpen Example", _ "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $sDocument = @ScriptDir & "\testdoc.docx"; YOUR FILENAME GOES HERE _Word_DocOpen($oWord, $sDocument, Default, Default, True) $oWord.ActiveDocument.Characters.Last.Select; puts cursor after the last characters Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Share this post Link to post Share on other sites
water 2,359 Posted September 5, 2015 Why do you want to go to the last page? To the top or the end of the last page? 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
alexzhao 0 Posted September 6, 2015 (edited) Why do you want to go to the last page? To the top or the end of the last page?To Water,Yes, the test step require to open the Word first and then goto the last page, Top or end of the last page doesn't matter. Edited September 6, 2015 by alexzhao repost with change Share this post Link to post Share on other sites
alexzhao 0 Posted September 6, 2015 This will get you to the end of the Word doc:#include <MsgBoxConstants.au3> #include <Word.au3> ; Create application object Local $oWord = _Word_Create() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocOpen Example", _ "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $sDocument = @ScriptDir & "\testdoc.docx"; YOUR FILENAME GOES HERE _Word_DocOpen($oWord, $sDocument, Default, Default, True) $oWord.ActiveDocument.Characters.Last.Select; puts cursor after the last characters Hi Jfish,This code works for me, by the way, how about the same function with PPT, open the PPT, then goto the last page, any suggestion? Thank you for the kindly help. Share this post Link to post Share on other sites
Jfish 125 Posted September 6, 2015 (edited) Try this:$oPPT = ObjCreate("PowerPoint.Application") $oPresentation = $oPPT.Presentations.Open(@ScriptDir&"\test.pptx"); YOUR FILE NAME HERE $oPresentation.Slides($oPresentation.Slides.Count).Select Edited September 6, 2015 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Share this post Link to post Share on other sites
computergroove 33 Posted September 6, 2015 Send("{CTRLDOWN}{END}{CTRLUP}") might help Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Share this post Link to post Share on other sites
Jfish 125 Posted September 6, 2015 Send("{CTRLDOWN}{END}{CTRLUP}") might help@computergroove - That could also work but I think sending keystrokes would be much less reliable than going through the com API. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Share this post Link to post Share on other sites