• 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: iWorks Pages "Print" dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iWorks Pages "Print" dialog


  • Subject: Re: iWorks Pages "Print" dialog
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 16 Sep 2011 16:09:37 +0200

I never saw the "Save PDF to Evernote" item.

Here is a script which may help.

--{code}
--[SCRIPT]
(*
Pages_to_Evernote

Yvan KOENIG (VALLAURIS, France)
2011/09/16
*)
my activateGUIscripting()

tell application "Pages"
activate
set nomFenetre to name of document 1
end tell
tell application "System Events" to tell application process "Pages"
set frontmost to true
keystroke "p" using command down
tell window nomFenetre
repeat
try
if description of sheet 1 is "Print" then exit repeat
end try
end repeat
tell sheet 1
--properties of every button
(* --> {
(1) {minimum value:missing value, orientation:missing value, position:{835, 591}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Imprimer", size:{98, 32}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Imprimer", description:"bouton"}, 
(2) {minimum value:missing value, orientation:missing value, position:{737, 591}, class:button, role description:"bouton", accessibility description:missing value, focused:false, title:"Annuler", size:{98, 32}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:"Annuler", description:"bouton"}, 
(3) {minimum value:missing value, orientation:missing value, position:{49, 595}, class:button, role description:"bouton", accessibility description:"Aide", focused:false, title:missing value, size:{25, 25}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXButton", entire contents:{}, subrole:missing value, selected:missing value, name:missing value, description:"Aide"}}
*)
-- properties of every menu button
(* --> {
(1) {minimum value:missing value, orientation:missing value, position:{81, 593}, class:menu button, role description:"bouton de menu", accessibility description:missing value, focused:false, title:"PDF", size:{85, 26}, value:missing value, help:missing value, enabled:true, maximum value:missing value, role:"AXMenuButton", entire contents:{}, subrole:missing value, selected:missing value, name:"PDF", description:"bouton de menu"}}
*)
click menu button 1 (* PDF *)
set mNames to name of every menu item of menu 1 of menu button 1
(* --> {
"Ouvrir le PDF dans Aperçu",
"Enregistrer au format PDF…",
"Enregistrer au format PostScript…",
"Faxer le document PDF…",
missing value,
"@ PDF-BAT.qfilter",
"@ PDF-prépresse CMJN.qfilter",
"@ PDF-web.qfilter",
"@ PDFX3-ISO.qfilter",
"Envoyer le document PDF par courrier électronique",
"Enregistrer en PDF-X",
"Enregistrer le document PDF vers iPhoto",
"Enregistrer le document PDF dans le dossier de reçus Web",
missing value,
"Modifier le menu…"
} *)
set mIndex to 1
repeat with aName in mNames
set gotIt to aName contains "Evernote"
if gotIt then exit repeat
set mIndex to mIndex + 1
end repeat
if gotIt then
click menu item mIndex of menu 1 of menu button 1 (* click item Save as PDF… *)
keystroke return (* idem click OK *)
else
click button 2 (* Cancel *)
end if -- gotIt
end tell -- sheet 1
end tell -- window…
end tell -- System Events…

if not gotIt then
activate
if my parleAnglais() then
error "The menu item “Save PDF to Evernote” is unavailable !"
else
error "L’article de menu “Save PDF to Evernote” n’existe pas !"
end if
end if
(*
tell application "Pages" to quit
*)
--=====

on parleAnglais()
local z
try
tell application "Pages" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais

--=====

on activateGUIscripting()
(* to be sure than GUI scripting will be active *)
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true
end tell
end activateGUIscripting

--=====
--[/SCRIPT]
--{code}


Yvan KOENIG (VALLAURIS, France) vendredi 16 septembre 2011 16:09:32


 _______________________________________________
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: 
 >iWorks Pages "Print" dialog (From: "email@hidden" <email@hidden>)
 >Re: iWorks Pages "Print" dialog (From: KOENIG Yvan <email@hidden>)
 >Re: iWorks Pages "Print" dialog (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: INDESIGN: Problem Passing Doc Through Handlers of Called Script
  • Next by Date: Re: iWorks Pages "Print" dialog
  • Previous by thread: Re: iWorks Pages "Print" dialog
  • Next by thread: Re: iWorks Pages "Print" dialog
  • Index(es):
    • Date
    • Thread