Re: Script to save webloc
Re: Script to save webloc
- Subject: Re: Script to save webloc
- From: Philip Aker <email@hidden>
- Date: Thu, 8 Jan 2009 13:31:50 -0800
On 2009-01-08, at 12:23:33, Scott Haneda wrote:
I don't use tabs in Safari but this works for me:
set dest to (path to desktop)
tell application "Safari"
set curl to URL of document 1
set dnam to name of document 1
end tell
tell application "Finder"
make new internet location file at dest to curl with properties {name:dnam}
end tell
I have been trying every which way I can. Applescript paths are getting in my way. I want to save the file to ~/somefolder which is in my home folder, but nothing I try works:
There are path calls available to access commonly used folders easily. To see what's available choose " Open Dictionary…" from Script Editor's File menu, and then choose " StandardAdditions" from the list of vocabularies available. When that dictionary opens up, then click the " File Commands" suite and in the second column click " path to".
Look at the the path to command which returns folders. All of those are available. The ones you might want to know for this case are: home folder and documents folder.
To use path to to obtain paths from your user account you can call it like:
set dest to (path to documents folder from user domain) set dest to (path to home folder from user domain)
To get a folder or file path relative to one of the built-in folders call it like:
set dest to (path to documents folder from user domain as text) & "some_file.txt" set dest to (path to home folder from user domain as text) & "bin"
Philip Aker
Democracy: Two wolves and a sheep voting on lunch.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden