• 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: Load Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Load Script


  • Subject: Re: Load Script
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 25 May 2011 16:24:08 -0500

On May 25, 2011, at 2:04 PM, Stan Cleveland wrote:

> The following method works, but may not be exactly what you're looking for:

Interesting and informative. Thanks! But, you are right, it's not what I'm looking for.

I've been experimenting this afternoon. (I've done this before, but apparently didn't do the right experiment.) The solution to my problem is really, really simple.

But, first, let me restate the problem: My MAIN scripted application bundle contains a lot of short simple handlers that I need to use everywhere. If I write ...

	run script <path to .scpt file>

then I want handlers in the MAIN script to be available within the script called, above.

The original script was located in MAIN, but this was becoming unwieldy. I moved one section of code to a file which I compiled and saved in ASE as a .scpt file. This file goes in the Resources folder in the MAIN application bundle. When a handler in this script file is called, I write ...

	my someHandler(...)

Of course this does not work, because the called script object does not contain this handler.
So, I simply deleted the word 'my' before handlers in MAIN, recompiled and saved.

It is now working perfectly!!!!!!!!!!!!!!!!!!!!!

It seems that 'my' restricts the scope of the availability of handlers. Deleting 'my' includes the parent (calling) script in the scope of the handler.

So, where is this documented? I've Googled and looked thru some old books (remember when you could actually buy a book printed on real paper?) and I've found absolutely nothing. Zero. If anyone knows where this is documented, let us know!

 _______________________________________________
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: Load Script
      • From: Axel Luttgens <email@hidden>
    • Re: Load Script
      • From: Stan Cleveland <email@hidden>
References: 
 >Load Script (From: Luther Fuller <email@hidden>)
 >Re: Load Script (From: Stan Cleveland <email@hidden>)

  • Prev by Date: Re: Load Script
  • Next by Date: Re: Load Script
  • Previous by thread: Re: Load Script
  • Next by thread: Re: Load Script
  • Index(es):
    • Date
    • Thread