Re: building an AppleScript editor app
Re: building an AppleScript editor app
- Subject: Re: building an AppleScript editor app
- From: sqwarqDev <email@hidden>
- Date: Mon, 08 Dec 2014 00:04:42 +0700
> IMO you're almost certainly wasting your time.
I've been told this since I first mentioned it over a year and a half ago. I'm not a professional developer, it's a hobby. Wasting my time on this is no worse than watching re-runs of "Kung Fu" and sure beats suffering on the sofa watching Leeds United getting hammered again... :(
>
> You don't. You use the OSA to do it for you. OSAExecute and friends return an OSAID for a newly created ScriptValue object containing the raw result. You pass that ID to something like OSADisplay if you want that result as a display string, or to OSACoerceToDesc if you want it as an AEDesc.
Great news. Just the sort of tip I was looking for.
> Or you use OSAScript, which has a very stupid method that returns both a display string and an AEDesc at the same time.
Huh? Which method are you talking about? I can't see anything in OSAScript that returns much anything than various ints, none of which seem obviously useful for getting human readable text out of.
> Honestly, calling out to `sdef` is probably the least horrid option.
>
Great, thanks for the time-saver. I won't bother looking elsewhere.
> As to dictionary viewers in general: OSAKit contains the dictionary viewer classes used by SE, though needless to say it doesn't work right,
I was thinking I'd just build my own besoke XML viewer. Aside from the fact I won't be able to load any old dictionary files that aren't sdefs (I'm happy to forsake them) that seems the easiest part of the job.
> As to general advice: I suggest you find yourself the original Inside Macintosh sections on Apple Event Manager and Scripting Components and read those to get some idea of how OSA works. (Be aware that even these are horribly light on specifics.) Also William Cook's HOPL paper on the early history of AppleScript is useful background.
Thanks, I'll take a look at those. In case anyone else is in the madhouse, I collated all these and other AppleScript legacy docs last year:
https://applescriptlibrary.wordpress.com
> Bear in mind too that OSA and the AS component are twenty year-old tech, and hopelessly obsolete by modern standards. There's no support for incremental parsing, for example, which you need to support stuff like dynamic code coloring and auto-complete which modern scripters expect. There's no hooks for debuggers or profilers,
This is what first got me interested in writing a decent editor to start with...well, that and I refuse to pay $199 for the only alternative.
> The only person who's ever managed is Mark Aldritt, and I doubt he'll want to share his secrets.
If it can be done by one person, it can be done by another. Not to say that it'll be me. I'm really not smart enough, and I've really scaled down my ambitions. In fact, I only got into this again (after letting it lie for nearly a year) because I was building another app and realized I'd discovered the answer to one of the puzzles that had frustrated me last year.
So, I (foolishly) started thinking, "Ohh, maybe I'm nearly there..." well, I've solved almost all the puzzles this project has presented me with so far (with some help)...and there's been a lot...I just don't know yet whether that's 1% of the total or 99%...
I'll keep plugging away till TV re-runs get the better of me or Leeds go on a winning streak. Thanks for the tips, has. Amongst the discouragement, there was some useful leads. :)
Best
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden