Re: How to properly include a script library?
Re: How to properly include a script library?
- Subject: Re: How to properly include a script library?
- From: Jenni via AppleScript-Users <email@hidden>
- Date: Mon, 18 Apr 2022 16:44:08 -0700
> On Apr 18, 2022, at 9:55 AM, Gil Dawson via AppleScript-Users
> <email@hidden> wrote:
>
> Here's how I do it:
>
> global HandyLibrary
>
> set HandyLibrary to load script POSIX file "/Users/gil/Gil's
> Stuff/Projects/GilWare/AppleScript/AppleScripts/Subroutines/HandyLibrary.scpt"
>
> I use POSIX file because it makes the file path easy to spell: I simply drop
> the icon of HandyLibrary from the Finder into Script editor between quotes
> and let them spell it.
>
> Then when I want to use one of the subroutines in my library (say, TrimLT):
>
> tell HandyLibrary to ¬
> set ReturnText to TrimLT(ReturnText as text)
Thanks, Gil. Nice tip about the drag and drop! I found another way
which seems to be a middle ground between your solution and mine. It's also a
little shorter - no path required when you save the library file in a Script
Library folder.
property myLib : script "Library Name"
set my_server to myLib's get_server()
set my_username to myLib's get_username()
set username to myLib's fmp_record
This works, and it's not that verbose, but I'm still not sure why
simply calling the library with "use" doesn't work. I know I read that it
should, I just don't remember where since I've been doing a lot of searching.
Marc
_______________________________________________
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