• 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: Save as web archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Save as web archive


  • Subject: Re: Save as web archive
  • From: Bryan Harris <email@hidden>
  • Date: Wed, 15 Jan 2014 12:26:20 -0600

Hello Ivan,

On Jan 15, 2014, at 10:00 AM, koenig.yvan <email@hidden> wrote:

set p2d to path to desktop as text

tell application "Safari"
name of document 1
save document 1 in (p2d & result & ".webarchive")
end tell

does the job

Thanks for your help.

From within the Safari window I get the message The document "Untitled" could not be exported as "Untitled.webarchive".  From within the AppleScript editor window I get the message "Safari got an error: AppleEvent handler failed."

When I search google I find similar postings for the error shown in the AppleScript editor window "Safari got an error: AppleEvent handler failed." number -10000.

I went ahead and rebooted and also tried on another computer but no change, I still get the error.  I looked in the System Console but I don't see any messages relating to this.  I'm not quite sure where I would look for log files or anything of that nature to sort of nudge me in the right direction.

Here is the script I used.  Am I doing something wrong by making the document with properties statement?

set p2d to path to desktop as text

tell application "Safari"
make document with properties {URL:"http://google.com"}
name of document 1
save document 1 in (p2d & result & ".webarchive")
end tell


Also, I remember my trouble with using the AS-Obj-C library.  I even still have the library from last year still saved in my Script Libraries folder, and I tried again just for fun.  What happens is that when I successfully save a page, it shows me the login screen even though I already logged in via the visible Safari window on my desktop.  I had recently learned how to tell Safari to make a document with properties { URL:"" } so  I thought I'd try to save that as a webarchive.

Alex, sorry I never answered your question.  Print to PDF would be good to try as well.  I googled it and it appears to be GUI scripting, which I have not had much luck with.  When I change Ivan's script from ".webarchive" to ".pdf" I get the same error, so I suppose it is GUI scripting related to get it to do that.  I might try the GUI scripting, and that's where I ended up last year, but I ran into issues getting reproducible results all the time.

Thanks all for the responses.


V/r,
Bryan
 _______________________________________________
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

  • Follow-Ups:
    • Re: Save as web archive
      • From: Shane Stanley <email@hidden>
    • Re: Save as web archive
      • From: "koenig.yvan" <email@hidden>
References: 
 >Save as web archive (From: Bryan Harris <email@hidden>)
 >Re: Save as web archive (From: Alex Zavatone <email@hidden>)
 >Re: Save as web archive (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: Save as web archive
  • Next by Date: Re: Save as web archive
  • Previous by thread: Re: Save as web archive
  • Next by thread: Re: Save as web archive
  • Index(es):
    • Date
    • Thread