• 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: Copying the path of files selected in Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copying the path of files selected in Finder


  • Subject: Re: Copying the path of files selected in Finder
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 29 Apr 2017 20:54:39 -0500

On 04/29/2017, at 19:31, Jean-Christophe Helary <email@hidden> wrote:
So I guess using use myLib : script "fakeLib"
allows to call the handler through that myLib instead of of script "fakeLib" which is way longer, right?


Hey Jean-Christophe,

Right.  And your label for the script library can be any non-reserved word.

I thought the terms used by the library were automatically imported with the "use" statement and there was no need to refer to it into the script.

This is true of applications – not script libraries.
You are required to use a reference to the library.

Thank you. And, is there a reference to that in the ASLG?

The documentation is not very satisfactory...

I should have mentioned that script libraries with a proper sdef and their own terminology WILL work with a non-referenced use script <myLib> statement.

Here's an example using Shane Stanley's BridgePlus library:

-----------------------------------------------------------------------------------
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
use script "BridgePlus"

set theStr to "Now is the time for all good men to come to the aid of their country."
set nsStr to current application's NSString's stringWithString:theStr
set asStr to ASify from nsStr
-----------------------------------------------------------------------------------

For a script library without an sdef you simply have to put up with the reference in order to call it's handlers.

A use statement in that context is essentially a more compact form of the old load script protocol:

-----------------------------------------------------------------------------------
set fLb to load script alias ((path to library folder from user domain as text) & "Script Libraries:FLb.scptd:")

set _data to "Now is the time for all good men to come to the aid of their country."
set newStr to fLb's cng(".", "•", _data) of me
-----------------------------------------------------------------------------------

But as of Mavericks the macOS knows where to look for libraries and doesn't need an explicit path.

You have to watch out for terminology imported with use statements, because it doesn't always work the way you think it should.

Try running this from Script Debugger and/or Script Editor:

-----------------------------------------------------------------------------------
use application "Finder"
set winName to name of front window
-----------------------------------------------------------------------------------

The terminology space tends to be different than you think.

--
Take Care,
Chris

 _______________________________________________
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

  • Follow-Ups:
    • Re: Copying the path of files selected in Finder
      • From: Yvan KOENIG <email@hidden>
References: 
 >Copying the path of files selected in Finder (From: Jean-Christophe Helary <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Yvan KOENIG <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Jean-Christophe Helary <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Yvan KOENIG <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Jean-Christophe Helary <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Yvan KOENIG <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Jean-Christophe Helary <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Christopher Stone <email@hidden>)
 >Re: Copying the path of files selected in Finder (From: Jean-Christophe Helary <email@hidden>)

  • Prev by Date: Re: display as text anomaly
  • Next by Date: Re: display as text anomaly
  • Previous by thread: Re: Copying the path of files selected in Finder
  • Next by thread: Re: Copying the path of files selected in Finder
  • Index(es):
    • Date
    • Thread