Re: [OT] Custom AppleScript editor
Re: [OT] Custom AppleScript editor
- Subject: Re: [OT] Custom AppleScript editor
- From: Brian Webster <email@hidden>
- Date: Mon, 20 May 2002 12:45:41 -0500
On Monday, May 20, 2002, at 10:03 AM, cocoa-dev-
email@hidden wrote:
I have a textView where the user can write an appleScript,
and i want to do syntax coloring.
Is there a file somewhere in the system that contains the applescript
keywords?
I've actually dealt with this before, although I was just
displaying Applescript, not editing it. The OSA framework has a
function called OSAGetSource() which will return you an AEDesc
containing the styled source. This source will automatically
have all the appropriate styles applied to it as per the user's
preferences that they set in Script Editor.
You have to coerce that AEDesc into a record, get the text from
the keyAEText keyword, and get the style runs from the
keyAEStyles keyword. You then have to translate this into an
NSAttributedString to display in your text view, which will
required learning how the old Carbon TextEdit style runs work.
It's not much fun. I think that they'll be providing a method
for this in the future in Cocoa, but you'll have to either wait
until Jaguar comes out or write it yourself.
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.