• 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: Axel Luttgens <email@hidden>
  • Date: Sat, 20 Mar 2010 12:50:33 +0100

Le 19 mars 2010 à 21:28:53, Yvan KOENIG a écrit :

> Here is the end of the script :
>
> [...]

Hello Yvan,

Playing a bit further with Pages' scripting model (or its idiosyncrasies...), I ended with this one:


-- A skeleton of Yvan's script
property theColor : {}

tell application "Pages"
	tell front document

		set {btn1, btn2, btn3} to {"Cancel", "Pick", "Remove"}
		set maybe to button returned of (display dialog "What?" buttons {btn1, btn2, btn3})

		if maybe is btn2 then
			if class of selection is {text box} then
				set theColor to single color of graphic id (id of (item 1 of (get selection)))
			else
				-- not a single text box (multiple selection, insertion point...)
			end if
		else
			set fill type of graphics whose class is text box and single color is theColor to none
		end if

	end tell
end tell


Since Pages seems to maintain global ids, at least within a document, "text box id NNNN" and "graphic id NNNN" refer to the same object; as a result, the trick relying on «class pSFC» appears to be avoidable.

On the other hand, I can't set the single color property to missing value here (Pages '09), even if for example this one works as expected:

	set single color of graphics whose class is text box and single color is theColor to {0,0,0}

But setting the fill type to none appears to reset the single color property; not sure whether this is exactly what you want, though.


Axel

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

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