• 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: AS Library Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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).

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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

References: 
 >Re: AS Library Question (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Scripting calendar - UIDs and moving from one cal to another
  • Next by Date: Re: AS Library Question
  • Previous by thread: Re: AS Library Question
  • Next by thread: Re: AS Library Question
  • Index(es):
    • Date
    • Thread