• 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: Converting application classes to raw codes in chevrons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting application classes to raw codes in chevrons


  • Subject: Re: Converting application classes to raw codes in chevrons
  • From: kai <email@hidden>
  • Date: Wed, 4 Oct 2006 02:06:51 +0100


On 2 Oct 2006, at 16:11, T&B wrote:

How can I convert application specific class names to raw Apple Event codes (in chevrons etc), so I can use them outside of a tell app block?

[snip]

set myBounds to <<boundsClass>> of myProperties
set myFillColor to <<fillColorClass>> of myProperties

Actually Tom, you should get away with using 'bounds' (along with 'class', 'index' and 'name') outside an AppleWorks tell block - without recourse to additional techniques.


Just to add to the previous suggestions, another option might be to wrap the subsequent code in a 'using terms from' block - or to initially assign the value of each required property to its own variable (and then to simply refer to the appropriate variable later).

Another way to determine the raw codes of a collection of properties might be to use a script application along these lines:

----------------

on text_elements from r
	try
		r's r
	on error r
	end try
	set text item delimiters to "{"
	set r to r's text from text item 2 to end
	set text item delimiters to "}"
	set r to r's text from beginning to text item -2
	set text item delimiters to ":"
	r's text items
end text_elements

on translation for r from a
set r to text_elements from r
set l to text_elements from (run script "tell application \"" & a & "\" to {" & r & "}")
set text item delimiters to ", "
repeat with i from 1 to count l
tell l to set item i to text item -1 of item i & ":" & text item -1 of r's item i
end repeat
"{" & l & "}"
end translation


----------------

With the above script saved as an application named (say) "Raw Codes.app", the calling code from Script Editor might look something like:

----------------

tell application "AppleWorks 6" to set myProperties to properties of graphic object 1 of drawing area of front document

launch application "Raw Codes"
translation of (application "Raw Codes") from "AppleWorks 6" for myProperties


--> "{class:class, index:index, bounds:bounds, fill color:«class flcl», fill pattern:«class flpt», fill gradient:«class pFGd», fill texture:«class pFTx», name:name, pen color:«class ppcl», pen pattern:«class pppa», pen width:«class ppwd», rotation:«class prot», text wrap:«class pWrp», wrap gutter:«class pGtr», lock:«class ppro», read write:«constant ****modf»}"

----------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Converting application classes to raw codes in chevrons (From: T&B <email@hidden>)

  • Prev by Date: Re: Can't turn off screen savers in System Preferences
  • Next by Date: Re: Best way to get at these text elements
  • Previous by thread: Re: Converting application classes to raw codes in chevrons
  • Next by thread: Excel Script can't get proper values
  • Index(es):
    • Date
    • Thread