Reputation: 109
I'm pretty new to AppleScript and Automator and I'm trying to figure out a way to do the following.
The clipboard contains something like <str://blahblahblah>
I'd like it to look at what is on the clipboard and if it begins with <str://
then it will remove the <
and it will remove a >
which is at the end of the clipboard data. Then when I go to paste, it will paste with the amended data.
Is this something that is possible, is anyone able to help me figure out how to get this to work in automator? Can I use the normal cmd-c and cmd-v for copy/paste or would it have to be a new shortcut?
Thanks for the help!
Upvotes: 0
Views: 635
Reputation: 3194
Automator has two built-in modules to work with the clipboard: Get Contents of Clipboard
and Copy to Clipboard
. They are both in the Utilities section. Add the 'Get Contents' to your workflow, then add a Run AppleScript
module with the following code:
on run {input, parameters}
set theClipText to item 1 of input
if theClipText begins with "<str://" then
set theClipText to text 2 through -2 of theClipText
end if
return theClipText
end run
then add the 'Copy to' module. it should look like this:
Upvotes: 1