• 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: puzzling Safari
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: puzzling Safari


  • Subject: Re: puzzling Safari
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 27 Dec 2013 22:24:32 +1100

On 27 Dec 2013, at 7:42 PM, koenig.yvan <email@hidden> wrote:

When the asker got your answer he said : OK, it works but it doesn't.
In fact we discovered  that he was trying to save the contents of a page containing only a picture.

If he's using Mavericks or ASObjC Runner, it's simple enough in ASObjC. Here's a library handler:

use framework "Foundation"

on saveImageURL:thePicURL toPath:thePath
set theNSURL to current application's NSURL's URLWithString:thePicURL
set picData to current application's NSData's dataWithContentsOfURL:theNSURL
picData's writeToFile:thePath atomically:true
end saveImageURL:toPath:

And the calling script:

use theLib : script "<name of lib>" 
set thePicURL to "http://www.macosxautomation.com/applescript/apps/gfx/EverydayCover300.jpg"
set thePath to POSIX path of ((path to desktop as text) & "Test.jpg")
theLib's saveImageURL:thePicURL toPath:thePath


-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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: 
 >puzzling Safari (From: "koenig.yvan" <email@hidden>)
 >Re: puzzling Safari (From: Shane Stanley <email@hidden>)
 >Re: puzzling Safari (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: puzzling Safari
  • Next by Date: Re: puzzling Safari
  • Previous by thread: Re: puzzling Safari
  • Next by thread: Re: puzzling Safari
  • Index(es):
    • Date
    • Thread