Re: How to make scripts reference multiple revs of an app
Re: How to make scripts reference multiple revs of an app
- Subject: Re: How to make scripts reference multiple revs of an app
- From: Michael Terry <email@hidden>
- Date: Tue, 2 Mar 2004 22:45:35 -0800
On Mar 2, 2004, at 10:28 AM, Richard 23 wrote:
I think it was Ken Tozier who said something along the lines of
I've been scripting for a long time now but have never found a way
to reference multiple versions of an application. For example: Say
you need to write a script that works with three versions of
QuarkXPress, there are only two options as far as I can tell:
1. Recompile the script on each machine where it will be used
2. Rename Quark on all target machines to the name you used in your
script.
Is there a more elegant way to reference an app say by it's creator
code or something?
Something like:
tell application whose creator type = "XPR3"
-- do amazing stuff here
end
Then I wrote a separate script to implement the set of text editor
handlers for several different applications. The "interface" script
generated and put to use would depend on a variable target application
determined at runtime.
each "interface" exists as a string and no actual "tell" occurs
until runtime when the name of the target application is discovered
and the application/version appropriate script is selected and
instantiated.
I can post or send the script or at least the relevant bits
if it would be useful.
My approach expects an eligible application to be running although
this isn't strictly necessary.
To find out the default version of an application that would be
run before using "tell",
tell application "Finder" to get application file id "XPR3"
set {theName, theVersion} to result's {name, version}
then you could roll out your version-specific script
I'd like to see the techniques you use. As it happens, I'm working on a
project right now for which it might be of some use. One script,
several applications that can all do the same thing, and I want to
substitute them in depending on what the user has.
The problem is that if you include app "Whatever"'s then anyone who
doesn't have the application can't recompile the script, right? As far
as I know, it's safe until then, but that's annoying enough as it is.
If the app terminology is just aeut stuff, then you can confuse the
matter with:
set appName to "Smile"
tell app named appName
or what-have-you, but that won't work for me this time.
Then there's just putting in the raw codes, but who wants to do that?
So what have you got?
Mike
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.