Re: Maintaining "State" information between scripts in an AS application
Re: Maintaining "State" information between scripts in an AS application
- Subject: Re: Maintaining "State" information between scripts in an AS application
- From: has <email@hidden>
- Date: Sat, 2 Apr 2005 14:12:50 +0100
Thomas Berry wrote:
>My application consists of several scripts, each tied to which tab is selected in a tab view on the interface. [...] What I need is a way to initialize the variable that defines the script on application launch and then maintain its state such that I would be able to call it from a different script.
Short answer: you can't. There's no way for scripts managed by the Studio framework to communicate with one another.
The Studio framework, like the AppleScript language, sucks at module management. With AppleScript you can ameliorate this mess by building your own module management system on top of what few facilities do exist. With Studio you have no access to its existing module management mechanisms so there's no way to extend or enhance them yourself.
Since you can't do anything to compensate for Studio's crappy module system, the only thing you can do is shift the problem back into AppleScript. This means restructuring your application so that there's just a single script (let's call it "MyApp.applescript") responsible for handling all GUI interaction, instead of several. With small applications you'll probably just stick all your code in that one script for simplicity's sake. For larger, more complex programs you may want to use a modular construction, in which case you'd arrange for the MyApp script to load and initialise other modules containing the application's core logic, support routines, etc. from the application bundle and act as the go-between between the GUI and these other modules, kind of like a central telephone exchange (see the MVC design pattern - Studio provides the View layer, the MyApp script provides the Controller layer and the other modules contain the Model layer's code).
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden