• 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: [OT] Custom AppleScript editor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Sending mail from Cocoa Apps
  • Next by Date: Re: Launch Email or Browser
  • Previous by thread: [OT] Custom AppleScript editor
  • Next by thread: Tear off...
  • Index(es):
    • Date
    • Thread