• 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: Axel Luttgens <email@hidden>
  • Date: Thu, 26 May 2011 09:23:29 +0200

Le 25 mai 2011 à 23:24, Luther Fuller a écrit :

> [...]
>
> 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!!!!!!!!!!!!!!!!!!!!!

Hello Luther,

Since I'm not sure to exactly understand above description as well as the one in your previous post, I'll ask. ;-)
Do you mean that if you have following script:

	on DoThis()
		DoThat()
	end DoThis

saved as "B.scpt" on the desktop, then this script:

	set scriptB to load script alias (((path to desktop) as text) & "B.scpt")
	tell scriptB to DoThis()

	on DoThat()
		return "DoThat() in main script"
	end DoThat

runs flawlessly for you?


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

There must be an explanation, provided we precisely know the context you are encountering that behavior (with vs without "my").

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