%SystemClipboard% means clipboard on KM,it’s very useful. how to express same function :%SystemClipboard% in applescript ? Thank you.
For example:in this applescript ,I want here the path is the system clipboard's content, how to do that?
set thePath to get the clipboard
works.
I googled for 'applescript assign text to variable' and used @ComplexPoint link.
Just to be clear (your statement runs onto the "works" comment), and you don't need "get":
set thePath to the clipboard
@som, if you wish to set the clipboard, it is as simple as this:
set thePath to "/Users/UserName/Library/"
set the clipboard to thePath
Many thanks,It's work!
Hey @som,
You can pare that down to:
set thePath to the clipboard -- Input --> on the clipboard is a POSIX Path.
tell application "Finder"
activate
set target of front window to (POSIX file thePath)
end tell
But I would normally write it this way for easier debugging:
set thePath to the clipboard -- Input --> on the clipboard is a POSIX Path.
set theAlias to alias POSIX file thePath --> Easier to debug.
tell application "Finder"
activate
set target of front window to theAlias
end tell
** In this case the Finder will handle a Posix File without issue, but I generally prefer to feed the Finder aliases due to occasional hiccoughs with other file formats.
For maximum tersification you can do this:
tell application "Finder"
activate
set target of front window to (POSIX file (get the clipboard))
end tell
-Chris