«Installs or de-installs items installed by AppleScript
«we need this for testing code with and without AppleScript present
«works with a folder called "AppleScript Install Files" in the same folder as this script
«if we're de-installing, we copy the extensions into that folder
«if we're installing, we copy from that folder into the System Folder
«can be used as sample code for installing/deinstalling other system components
local (restartneeded = false)
local (extensionsfolder = file.getSpecialFolderPath ("", "Extensions", false))
local (safefolder = file.folderFromPath (system.deskscripts.path) + "AppleScript Install Files:")
file.sureFolder (safefolder)
on move (sourcefile, destfolder)
local (name = file.fileFromPath (sourcefile))
if not file.exists (sourcefile)
local (sourcefoldername = file.fileFromPath (file.folderFromPath (sourcefile)) - ':')
scriptError ("Couldn't locate "" + name + "" in the " + sourcefoldername + " folder.")
if file.volumeFromPath (sourcefile) [not equal] file.volumeFromPath (destfolder)
file.copy (sourcefile, destfolder + name)
if file.isFolder (sourcefile)
file.deleteFolder (sourcefile)
else
file.delete (sourcefile)
else
file.move (sourcefile, destfolder)
if file.exists (safefolder + "AppleScript[trademark]")
if dialog.yesNo ("Install AppleScript in your System Folder?")
move (safefolder + "AppleScript[trademark]", extensionsfolder)
move (safefolder + "Apple® Event Manager", extensionsfolder)
move (safefolder + "Scripting Additions:", extensionsfolder)
restartneeded = true
else
if dialog.yesNo ("Remove AppleScript from your System Folder?")
move (extensionsfolder + "AppleScript[trademark]", safefolder)
move (extensionsfolder + "Apple® Event Manager", safefolder)
move (extensionsfolder + "Scripting Additions:", safefolder)
restartneeded = true
if restartneeded
if dialog.twoWay ("Restart your Macintosh?", "Restart", "No")
fileMenu.save ()
Finder.restart ()
This page was last built on Sat, Aug 16, 1997 at 6:37:07 PM. You can download the current set of sample scripts from our FTP site. Dave |