I have an url in the clipboard and I need to add “file://” to the beginning.
I tried:
set adreca to file:// & clipboard
It gives me that error:
Expected end of line, etc. but found “:”.
How can add file:// to an address I have in the clipboard?
I have an url in the clipboard and I need to add “file://” to the beginning.
I tried:
set adreca to file:// & clipboard
It gives me that error:
Expected end of line, etc. but found “:”.
How can add file:// to an address I have in the clipboard?
set thePath to (choose file) as text --> HFS path
-- or,
-- set thePath to POSIX path of (choose file) --> Posix path
set the clipboard to thePath -- this is copy to the clipboard command
-- or,
-- you don't need code lines above, because the path is already copied to the clipboard manually
tell application "System Events"
set fileURL to URL of file (get the clipboard as text)
end tell
NOTE: the clipboard should contain the HFS path or the Posix path (and not some URL). Both of them is a text.
As for the snippet you provided, your mistakes is: 1) using “file://” without quotes, 2) using clipboard property of System Events instead of the clipboard command (“the” is required here!!!). So, proper code should be like this:
set adreca to "file://" & (the clipboard)
thank you