Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vars/routines across different files



Hmmm... someone suggested script objects too, I'll have to mull this one
over after all, don't have much experience with them. But offhand I'd say
this still isn't what I was hoping for. As a workflow it seems very
similar to loading library files, which I already do for some often-used
generic routines. Anyway, I'll look a bit deeper into this method.

To clarify my question a bit: now that in Project Builder I can include
multiple AS files in one project, I had hopes that this would make it
easier to manage big projects by splitting code into multiple files. I
know you can use Interface Builder to target different files, but those
look rather self-contained, ie. the vars and routines in those different
files can not access achother.

For instance, I built a rather complex dialog, with four basis phases in
the script:
- initialisation (entering previous dialog values, check if they
correspond to one of the presets)
- dialog management (en/disabling dialog objects based on values in
others),
- input validation (after 'ok', check for format in fields and see if
required stuff is entered), and
- processing (once validated, close dialog and perform the actual work).

The script has a property list holding all the values, and in all four
stages there has to be read/write access to that property.

In PB, I had hopes that there would be an easy way to put those four
phases in four different files. (The best analogy is probably the
#include in C?)

Perhaps this explanation triggers some extra ideas?

Thanks, Wim

>>Can you use variables and routines across different Applescript files?
>try something like this:
>first file: main.applescript
> script myScript
> property x: 5
> on clicked theObject
> test()
> end clicked
> end script
>
>second file: sub.applescript
> to loadscript()
> set scrpt to load script POSIX file
> (path for main bundle script "main" extension "scpt")
> return myScript of scrpt
> end loadscript
> on test()
> set myScript to loadscript()
> tell myScript to display dialog x
> end



-----
email (home): email@hidden
email (office): email@hidden
http://www.noorderlicht.com * Noorderlicht photofestival
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.