Re: Writing one script for two versions of an application
Re: Writing one script for two versions of an application
- Subject: Re: Writing one script for two versions of an application
- From: Olivier Destrebecq <email@hidden>
- Date: Fri, 24 May 2002 09:20:38 -0500
here is a sample that i used for appleworks 5 and 6
global documentfolder
on run
tell application "Finder"
set documentfolder to path to temporary items folder as string
set test to (application file id "BOBO") as string
end tell
tell application test
set AppleWorksVersion to version as string
set Filelocation to ""
if (AppleWorksVersion b % "6.0.0") then
my AppleWorks6()
set Filelocation to result
else
if (AppleWorksVersion b % "5.0.0") then
my AppleWorks5()
set Filelocation to result
else
display dialog "AppleWorks 5.0 is requiered for the
CellSheet Converter to be able to convert AppleWorks File" buttons
{"OK"} default button {"OK"}
end if
end if
end tell
return Filelocation
end run
on AppleWorks5()
tell application "AppleWorks 6" --this used to change
automatically, it would just ask on the first run where is appleworks
and kept going after that
--command here
end tell
return FileWithFormulas
end AppleWorks5
on AppleWorks6()
tell application "AppleWorks 6"
--command here
end tell
return FileWithFormulas
end AppleWorks6
olivier
On Thursday, May 23, 2002, at 08:48 PM, Wadson, David wrote:
>
Because I was hoping that there was a more elegant way of doing it! :-)
>
>
As I make a script more and more complex (mainly due to putting in error
>
trapping et al), it would be much simpler to have one copy of the
>
program
>
and for the few commands that are different between application
>
versions,
>
I'd just need a simple if/then/else statement that executes the
>
applicable
>
code.
>
>
I've started to experiment with script objects but I must say that I'm
>
more
>
fond of having a self-contained applet rather than having to keep track
>
of
>
where different script objects might be. It's not a problem if the
>
script is
>
just going to be used on my workstation, but when you're deploying it
>
on a
>
number of workstations or sending it to someone else to use then you
>
have to
>
contend with where things might be located on their system. And if a
>
user
>
accidentally moves something, or deletes it, etc., what's the easiest
>
way to
>
handle that? Do you develop a script that will reinstall all the
>
components?
>
>
But maybe that will be the approach I have to take in order to do this.
>
On
>
reflection, maybe that might not be a bad idea - install the
>
version-detection applet on each machine, and keep the script objects
>
on a
>
common server volume. Can multiple workstations access a script object
>
simultaneously?
>
>
Dave
>
>
-----Original Message-----
>
From: email@hidden
>
To: email@hidden
>
Sent: 5/23/02 6:42 PM
>
Subject: Re: Writing one script for two versions of an application
>
>
>
David... Just thinking out loud here, but why not write your two Acrobat
>
>
snippets as separate scripts, then write an applet that detects which
>
version
>
of Acrobat is in play and loads the appropriate script object?
>
>
Robert Kyle
>
Star Tribune
>
Minneapolis
>
_______________________________________________
>
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.
_______________________________________________
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.