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