Re: Load Script
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