Jump to content

Recommended Posts

Posted

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.

Posted

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

Posted

Why do you want to go to the last page? To the top or the end of the last page?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)
  On 9/5/2015 at 6:04 PM, water said:

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 by alexzhao
repost with change
Posted

 

  On 9/5/2015 at 5:52 PM, Jfish said:

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. 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...