Re: AS Library Question
Re: AS Library Question
- Subject: Re: AS Library Question
- From: Shane Stanley <email@hidden>
- Date: Thu, 03 Dec 2015 10:05:44 +1100
On 3 Dec 2015, at 9:49 AM, Stan Cleveland <email@hidden> wrote:
Um, that very example was in my email. :-)
That's what happens when I post before I'm fully awake :-(That makes sense, Shane. I’d read Matt’s ASTDG book, but that bit didn’t jump out at me. Until now, I’d never realized, nor imagined, that handlers were objects. Am still wrapping my brain around it.
I'm not sure there's any use to it, other than its being a reminder not to use a handler name also as a variable name.
But I can't help tinkering with your script:
use AppleScript version "2.4" use framework "Foundation" use scripting additions property name : "Test" property id : "com.colortechnology.Lib.Test" property version : "v1r0" on stripWhiteSpace(str) set str to current application's NSString's stringWithString:str return (str's stringByTrimmingCharactersInSet:(current application's NSCharacterSet's whitespaceAndNewlineCharacterSet())) as text end stripWhiteSpace
Much faster ;-)
One other thing: consider saving script libraries as .scptd bundles. It gives you a better UI for id and version (you can see the version in Finder's Get Info window, for example), and it lets you easily add other resources (even nested libs, if you want). |
_______________________________________________
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