• 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: "koenig.yvan" <email@hidden>
  • Date: Wed, 15 Jan 2014 22:34:59 +0100


Here is my GUI Scripting code in case I prove to be enable to discover why the vanilla script refuses now to apply.

--{code}
(*

Save frontmost Safari document as WebArchive 

Yvan KOENIG (VALLAURIS, France)
2014/01/15
*)

on run
local smallSheetAvailable, sourceName

# open location "http://www.mac4ever.com/actu/86634_une-application-de-chirurgie-esthetique-pour-fillettes-retiree-de-l-app-store"
tell application "Safari"
activate
make document with properties {URL:"http://www.mac4ever.com/actu/86634_une-application-de-chirurgie-esthetique-pour-fillettes-retiree-de-l-app-store"}
end tell
(*
I use always this syntax to get rid of cases where the process 's name is not the application's one  *)
tell application "System Events" to tell (first process whose frontmost is true)
(*
Some times I get a small sheet asking to make choice and offering the button "Cancel" and the default "Continue" *)
tell window 1
set smallSheetAvailable to false
repeat 20 times
delay 0.1
if exists sheet 1 then
set smallSheetAvailable to true
exit repeat
end if
end repeat
if smallSheetAvailable then
tell sheet 1
# class of UI elements
(*
Trigger Continue *)
keystroke return
end tell # sheet 1
end if
(*
Trigger the menu item Save As…  *)
keystroke "s" using {command down}
(*
Wait for the availability of the save as sheet *)
repeat 5 times
delay 0.1
if exists sheet 1 then exit repeat
end repeat
(*
Sheet available, force target folder to Desktop *)
keystroke "d" using {command down}
(*
Define the file format thru the Format: menu *)
tell sheet 1 to tell group 1 to tell pop up button 1
click it
click menu item 2 of menu 1
end tell
(*
Really Saves *)
keystroke return
end tell # window 1
end tell # System Events …
end run
--{code}

I'm not fully satisfied because I don't understand what is deciding that a small sheet must appear just after opening the document.
I got it with make document as well as with open location.
The file is created on the Desktop so it's easy to move it elsewhere if needed.

Yvan KOENIG (VALLAURIS, France) mercredi 15 janvier 2014 22:31:28




 _______________________________________________
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: 
 >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>)
 >Re: Save as web archive (From: Bryan Harris <email@hidden>)
 >Re: Save as web archive (From: "koenig.yvan" <email@hidden>)

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