I want to write a script to convert clipboard or selected text into a clipping.
So, first i am trying to make a new clipping with desired text.
But I am unable to do it. I could only make a new clipping and give it a name. I cannot set its contents. Any help please.
tell application "Finder"
make new clipping at desktop to "whatever"
end tell
I was able to name a new clipping what I wanted and give it a spotlight comment, but I can’t specify where the contents come from either. Weird. The scripting Dictionary is pretty much useless for this.
set PathToDesktop to path to the desktop as text
tell application "Finder"
make new clipping at desktop to "asdf" with properties {name:"Matt", comment:"Hello there"}
get properties of clipping (PathToDesktop & "Matt.textClipping")
end tell
Thanks a lot, Jacques.You have helped me clutter my desktop with clippings. :lol:
(maybe, i will change the folder path)
Is there a way to make the script use the current selection instead of the clipboard?
Presently, I have added these lines to the script and they seem to work efficiently without taking any (noticeable) extra time.
tell application "System Events"
keystroke "c" using command down
end tell
But at the end of the day, you know UI scripting is UI scripting.
Any ideas?