• 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: AppleScript, Pages and Text boxes (part 2)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript, Pages and Text boxes (part 2)


  • Subject: Re: AppleScript, Pages and Text boxes (part 2)
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 19 Mar 2010 21:28:53 +0100

Here is the end of the script :



property theColor : {}

--=====

on run
if my parleAnglais() then
set prompt to "What to do ?"
set {btn1, btn2, btn3} to {"Cancel", "Pick background colour", "Remove backgrounds matching our colour"}
else
set prompt to "Que faire ?"
set {btn1, btn2, btn3} to {"Abandonner", "Prélever couleur de fond", "Oter les fonds de notre couleur"}
end if


set maybe to button returned of (display dialog prompt buttons {btn1, btn2, btn3} default button 3)
if maybe is btn1 then (*
maybe = btn1 *)
error number -128


else if maybe is btn2 then (*
maybe = btn2 *)


tell application "Pages" to tell front document
if class of the selection is {text box} then
set bprops to item 1 of (get properties of the selection)
else
if my parleAnglais() then
error "The selection isn‘t a text box !"
else
error "La sélection n‘est pas un bloc texte !"
end if
end if
end tell -- Pages
set theColor to get «class pSFC» of bprops


else (*
maybe = btn3 *)


if theColor is {} then
if my parleAnglais() then
error "The color to remove isn‘t defined !"
ellse
error "La couleur à supprimer n‘est pas définie !"
end if
end if -- theColor…


tell application "Pages" to tell front document
repeat with g in every graphic
tell g to if get class is text box then if single color is theColor then set single color to missing value
end repeat
end tell -- Pages
end if -- maybe is…
end run

--=====

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

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

Yvan KOENIG (VALLAURIS, France) vendredi 19 mars 2010 21:28:40


 _______________________________________________
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: AppleScript, Pages and Text boxes (part 2)
      • From: Axel Luttgens <email@hidden>
References: 
 >AppleScript, Pages and Text boxes (part 1) (From: Yvan KOENIG <email@hidden>)
 >Re: AppleScript, Pages and Text boxes (part 1) (From: Axel Luttgens <email@hidden>)
 >Re: AppleScript, Pages and Text boxes (part 1) (From: "email@hidden" <email@hidden>)
 >Re: AppleScript, Pages and Text boxes (part 1) (From: Yvan KOENIG <email@hidden>)
 >Re: AppleScript, Pages and Text boxes (part 1) (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: AppleScript, Pages and Text boxes (part 1)
  • Next by Date: Re: AppleScript, Pages and Text boxes (part 2)
  • Previous by thread: Re: AppleScript, Pages and Text boxes (part 1)
  • Next by thread: Re: AppleScript, Pages and Text boxes (part 2)
  • Index(es):
    • Date
    • Thread