Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I paste text into an blank AppleScript?

Hi all,


Just started using Yosemite (up from Snow Leopard), and I'm trying to figure out how to create a simple AppleScript from scratch, by pasting text into the script. Automator doesn't seem to want to let me do this, and it forces me to drop items from the preselected apps on the left.


What I'd like to create is a Word script that pastes text according to the format in the file. The script is below:


tell application "Microsoft Word"

paste and format (text object of selection) type format surrounding formatting with emphasis

end tell

(I grabbed this from http://word.mvps.org/mac/pastetextas.html)


So in other words, how do I create a script using the code above? Any advice would be appreciated. Thanks!

MacBook Pro with Retina display, OS X Yosemite (10.10.3)

Posted on Apr 23, 2015 12:52 PM

Reply
Question marked as Best reply

Posted on Apr 23, 2015 3:32 PM

Single-click the Launchpad icon in the left end of the Dock. Dead center of the icon array is the category Other. Single-click, and then single-click Script Editor. Chose new document. Copy/Paste your Word Script content from above into the Script Editor. Click the compile icon. If there are no errors, you content will change into black, magenta, green colors.


File > Save… into home/Documents/myScripts/Paste Matching Destination Format.applescript

Option+File+Save As… into home/Documents/Microsoft User Data/Word Script Menu Items/Paste Matching Destination Format.scpt

At the bottom of this save panel is a Format selection. Choose script, and the applescript extension will change to scpt.


You will then have a new Word Edit menu item named Paste Matching Destination Format entry, that will run the AppleScript when clicked.


Quit your Script Editor session. No need for Automator, as you are enhancing Word menus.

2 replies
Question marked as Best reply

Apr 23, 2015 3:32 PM in response to Mike Amin

Single-click the Launchpad icon in the left end of the Dock. Dead center of the icon array is the category Other. Single-click, and then single-click Script Editor. Chose new document. Copy/Paste your Word Script content from above into the Script Editor. Click the compile icon. If there are no errors, you content will change into black, magenta, green colors.


File > Save… into home/Documents/myScripts/Paste Matching Destination Format.applescript

Option+File+Save As… into home/Documents/Microsoft User Data/Word Script Menu Items/Paste Matching Destination Format.scpt

At the bottom of this save panel is a Format selection. Choose script, and the applescript extension will change to scpt.


You will then have a new Word Edit menu item named Paste Matching Destination Format entry, that will run the AppleScript when clicked.


Quit your Script Editor session. No need for Automator, as you are enhancing Word menus.

How can I paste text into an blank AppleScript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.