• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Script to save webloc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
echo email@hidden@nl | tr a-z@. p-za-o.@

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

References: 
 >Script to save webloc (From: Scott Haneda <email@hidden>)
 >Re: Script to save webloc (From: Fuller Luther <email@hidden>)
 >Re: Script to save webloc (From: Scott Haneda <email@hidden>)
 >Re: Script to save webloc (From: Philip Aker <email@hidden>)
 >Re: Script to save webloc (From: Scott Haneda <email@hidden>)

  • Prev by Date: Re: Script to save webloc
  • Next by Date: Re: Script to save webloc
  • Previous by thread: Re: Script to save webloc
  • Next by thread: Re: Script to save webloc
  • Index(es):
    • Date
    • Thread