1. I guess there are a few ways.. if you just want to get the preferences folder as an alias path, you could use (path to preferences folder); if you wanted a Finder reference to it for copying/moving files, you could ask the Finder for its reference format (usually not necessary, since in most situations the Finder recognizes both forms):
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>set theFolder to (path to preferences folder)
-- alias <font color = red>"Macintosh HD:System Folder

references:"</font>
tell application <font color = red>"Finder"</font> to set theFolder to preferences folder
-- folder <font color = red>"Preferences"</font> of folder <font color = red>"System Folder"</font> of startup disk of application <font color = red>"Finder"</font></font>[/code]
The Finder can also coerce its format into a string or an alias path by adding as string or as alias:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>tell application <font color = red>"Finder"</font> to set theFolder to preferences folder as string
-- <font color = red>"Macintosh HD:System Folder

references:"</font></font>[/code]
For Finder functions, usually either method works, but if one doesn't for some reason, the other should.
2. In OS 9, using the Finder's process class calls up the refs to all running apps, so something like this should do it:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>tell app <font color = red>"Finder"</font> to set processList to name of processes
<font color = green>if</font> <font color = red>"Internet Explorer"</font> is in processList then
<font color = green>if</font> <font color = red>"Netscape Communicator™ <font color = blue>4.7</font>"</font> is in processList then
display dialog <font color = red>"Can't run both!"</font>
<font color = green>else</font>
display dialog <font color = red>"Running Internet Explorer subscript..."</font> giving up after <font color = blue>2</font>
do_ExplorerStuff()
end <font color = green>if</font>
<font color = green>else</font> <font color = green>if</font> <font color = red>"Netscape Communicator™ <font color = blue>4.7</font>"</font> is in processList then
display dialog <font color = red>"Running Netscape Comm. subscript..."</font> giving up after <font color = blue>2</font>
do_CommunicatorStuff()
end <font color = green>if</font>
on do_ExplorerStuff()
-- <font color = green>do</font> Explorer stuff
end do_ExplorerStuff
on do_CommunicatorStuff()
-- <font color = green>do</font> Communicator stuff
end do_CommunicatorStuff</font>[/code]
Unfortunately, there's no equivalent in plain old Applescript for OS X yet (the Finder doesn't understand processes)... maybe in the 10.1 final...
But a scripting addition that can send commands to the shell, a UNIX process list (ps -wwx or something similar) can be generated. Although a messy listing, the name of the apps can be picked out of the list. With the
KinderShell scripting addition, something like this should work:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>set processList to list processes -- list processes runs ps -wwx
<font color = green>if</font> <font color = red>"Internet Explorer"</font> is in processList then display dialog <font color = red>"IE is running"</font></font>[/code]
There's also a Classic scripting addition set called Script Tools 1.3.6 (formerly LNS Scripting Additions) from Late Night Software Ltd. - available
here that has a scripting addition called "Processes" that also uses "list processes" to get a list of running apps without the Finder. So, with both "Processes" installed in OS 9 & "KinderShell" installed in OS X, one could conceivably use the same script in both OS 9 & OS X... just a thought. It's possible the 10.1 Finder could provide a cleaner way.
edit: oops... list processes was from a scripting addition called "Processes" (see above)... the Finder's processes class will do the same. & UBB code... ugh!
[ 08-31-2001: Message edited by: acur128 ]