• 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: Sat, 28 May 2011 13:11:18 +0200

Le 28 mai 2011 à 00:13, Luther Fuller a écrit :

> On May 27, 2011, at 4:40 PM, Axel Luttgens wrote:
>
>> After all, it doesn't make very much sense for a script supposed to be a standalone entity liable to be called from everywhere to depend on characteristics of the caller.
>>
>> Moreover, I'm not sure that the notion of parent (and, more generally, of inheritance in AppleScript sense) is relevant in this precise context.
>
> I should explain the nature of my project. The previous version consisted of 6 applications, all of which are used to do tasks related to disk image files. These applications are named: New, Convert, Burn, Inspect, Preferences and SetBGpict and are located in a folder in the Dock. There is a lot of duplicate code in these applications.
>
> The idea is to rewrite all of these applications as runnable .scpt files and put all the common code in the main application code. The main application bundle contains the folders: MenuItemAppls and MenuItemScripts in its Resources folder.
>
> [...]

Hello Luther,

Thanks for having taken the time to explain your layout.

I've tried to reproduce a skeleton here; could you have a look and see whether this accurately mimics the spirit of your code?

Script of DiskImages.app, the "main" application:

	on run
		installMe()
	end run

	on installMe()
		-- Install in Application Support, Dock...
		display dialog "Install done!"
	end installMe

	on entryPointHandler(AppName)
		(((path to me) as text) & "Contents:Resources:MenuItemScripts:" & AppName & ".scpt") as alias
		run (load script the result)
	end entryPointHandler

	on Common()
		display dialog "Performing common code..."
	end Common

Script of DiskImages.app/Contents/Resources/MenuItemAppls/Burn.app:

	on run
		set MyName to name
		tell application "Finder" to set hostAppl to (container of container of container of container of (path to me)) as text
		launch application hostAppl
		tell application hostAppl to entryPointHandler(MyName)
	end run

Script of DiskImages.app/Contents/Resources/MenuItemScripts/Burn.scpt:

	on run
		Common()
		Burn()
	end run

	on Burn()
		display dialog "Burning..."
	end Burn




 _______________________________________________
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>)
 >Re: Load Script (From: Alex Zavatone <email@hidden>)
 >Re: Load Script (From: Luther Fuller <email@hidden>)
 >Re: Load Script (From: Ron Hunsinger <email@hidden>)
 >Re: Load Script (From: Luther Fuller <email@hidden>)
 >Re: Load Script (From: Axel Luttgens <email@hidden>)
 >Re: Load Script (From: Luther Fuller <email@hidden>)
 >Re: Load Script (From: Axel Luttgens <email@hidden>)
 >Re: Load Script (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: tell app, name in string var
  • Next by Date: Re: Load Script
  • Previous by thread: Re: Load Script
  • Next by thread: Re: Load Script
  • Index(es):
    • Date
    • Thread