AppleScript - How do I select a text ?

Joined
Sep 21, 2020
Messages
2
Reaction score
0
Hi,

I want to select/highlight a text after inserting it into current cursor location on a PPT slide. My PowerPoint version is Microsoft PowerPoint for Mac version:16.41. Here is the AppleScript code which inserts text into currently selected text range:

AppleScript:
tell application "Microsoft PowerPoint"
    activate
    
    tell active window
        set txtRnge to get text range of its selection
        set cnt to get content of txtRnge
        
        # content is empty
        if cnt is equal to "" then
            display dialog "empty"
            
            set startRange to get text range of its selection
            #content is empty
            insert the text "CLICK HERE!!!!" at the end of txtRnge
            set endRange to get text range of its selection
            
            # Select / Highlight inserted text
            
            
            # add hyperlink
            set theAction to get text action setting txtRnge
            set action of theAction to action type hyperlink action
            set hyperlink address of hyperlink of theAction to "http://www.microsoft.com/"
        end if
    end tell
end tell


How do I select / highlight the inserted text? In the above code sample it's "CLICK HERE!!!!"
 
Joined
Sep 21, 2020
Messages
2
Reaction score
0
I need to select a text object after inserting text into slide. I didn't see any direct method or property for selecting the text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top