What is the best way to share properties (that have been updated) between scripts in a single project?
I have outgrown my initial script and moved some parts to the “B script.” While in B, I call routines (which in turn call other routines) in the “A script” that rely on a long list of properties established and constantly updated within A.
I thought loading script A and then calling for AScript’s name-of-property would work, but it seems not to.
I have had the same problem for a while, and I have tried everything without success. I believe that with applescript studio this is not possible. But it has been discussed in the AppleScriptObjC forums that this was now possible with ASOC. See this thread:
So far, I have limited offloading tasks to my “secondary” scripts only the ones that do not require a two-way street in order to work. This makes my main script quite large (in fact i can’t even compile in Debug mode anymore, probably because of that), but it works.
As soon as we (my office) have a go to switch to 10.6, I will begin working on the ASOC equivalent of my app, which will save a lot of code with the new cool things we now have access to in ASObjC.
If you ever found a solution, I would be glad to hear what you have, I’d still like to “relax” my main script!
Regards,
Leon
Model: MacBookPro2,2
Browser: Safari 531.9
Operating System: Mac OS X (10.6)
My script has grown beyond the ability to simply divide like tasks between separate scripts. The app requires a lot of shared properties.
Anyway, I never found a solution, just a clunky workaround.
When I make the call from the “A” script, I send along a long list of properties as parameters. I re-establish them as properties in the “B” script. Not elegant, but it works for now.
I have encountered the same problem and came up with my own clunky work arounds.
I ended up re-declaring the property in each script or referring back to the interface to establish the value of a property - the name of the data source of table so and so, or the state of the button so and so…
I’ve stored properties in a text file and had the on launch or on awake from nib handler in each script read that file.
if some one has a better solution, I also would be interested in hearing it.
I thought about doing the same thing, but came to the conclusion that it would be too much trouble for what it’s worth, except maybe for one app (which is roughly 6000 lines of code). This app does not compile in debug mode anymore, I think I am over some strange AppleScript limit somewhere. Can’t wait to switch it over to ASOC, this will save me at least 1000 lines! Just waiting for the office to approve the new OS…
And I too would be interested in a better solution than what we have shared so far…
Model: MacBookPro2,2
Browser: Safari 531.9
Operating System: Mac OS X (10.6)