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: Gil Dawson via AppleScript-Users <email@hidden>
- Date: Mon, 18 Apr 2022 09:55:26 -0700
Hi, Mark--
Her'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)
Easy-Peasy.
--Gil
> On Apr 18, 2022, at 7:51 AM, Jenni via AppleScript-Users
> <email@hidden> wrote:
>
> I'm trying to include a script library I created into another script of
> mine. I thought I could just include it with:
>
> use script "Library Name"
>
> and it would then be available in the current script. However, that's not
> working for me. SD tells me my variables aren't defined. So I created a
> very simple test setup. My TestLib library file contains just the following:
>
> set my_server to "set.server.com <http://set.server.com/>"
> property server : "property.server.com <http://property.server.com/>"
> property fmp_record : "Test String"
>
> Then in my calling script I have:
>
> use AppleScript version "2.7"
> use scripting additions
> use script "TestLib"
>
> display dialog fmp_record
>
> but SD says "The variable fmp_record is not defined." Same response whether
> it's a property or using set.
>
> Testing doesn't get any simpler than this, but I just can't see the
> problem. Any ideas?
>
> Thanks,
> Marc
>
> MacOS 10.15.7
> ScriptDebugger 6.0.4
> TestLib.scpt is in ~/Library/Script Libraries/
>
> _______________________________________________
> 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
_______________________________________________
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