Re: Supporting several applications
Re: Supporting several applications
- Subject: Re: Supporting several applications
- From: email@hidden
- Date: Wed, 27 Jun 2001 10:25:36 -0400
On Mon, 25 Jun 2001 20:02:01 +0200, Jan Erik =?iso-8859-1?Q?Mostr=F6m?=
<email@hidden> asked,
>
I'm writing an AppleScript where I try to give the users the option of
choosing
>
different database programs. About 95% of the script is generic while the last
>
5% is specific to the database application. I would prefer to make one script
>
since supporting all combinations of database programs A, B, C, and D would
make
>
it to much work for me to bother. However I would avoid getting the questions
>
"where is application A" the first time the script is launched.
>
>
So, let's say that user X downloads my script and wants to use database A.
What
>
I would like to avoid are the questions for B, C, and D since they are
>
non-existent of X machine.
I would put the interfaces into separate scripts, and load the correct one as a
script object at run time.
-- (Pseudo-code only. The Mac is busy defragmenting, so I can't look up
-- some of the commands, particularly the "choose from list")
property DBs : {"Filemaker", "Oracle", "IBM DB2", "Valentina", "SQL Server"}
choose from list DBs with prompt "Pick your database" returning DBname
set DBinterface to ,
(load script alias ("path:to:your:modules:" & DBname & " Interface"))
tell DBinterface to
-- your commands go here.
end tell
Name your interface modules to match the displayed name in the list, and ensure
that they all implement the same interface. You may end up with some
do-nothing modules for some databases. For example, if database A requires you
to open a certain view before using it, while B provides a default view, you may
have
to initialize()
tell application "Database A" to open view "X"
end initialize
in one interface script, while the other says simply,
to initialize()
end initialize
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden