I spent most of the day working on a self contained application bundle only to find out it wouldn’t take in iChat. To make things easier to install on several systems I am attempting to create my own Applescript installer program. Nearly as I can tell this should all work. BUT I am unable to copy the files from the Application bundle to where I would liek them to go for some reason.
property iChatPlugins : missing value
property iChatInstall : missing value
on run
set iChatPlugins to ((path to home folder) & "Library:Scripts:iChat:")
set answer to the button returned of (display dialog "This will install AAIR. Press Install to continue." buttons {"Install", "Cancle"} default button 1)
if the answer is "Install" then
if appIsRunning("iChat") then
display dialog "iChat is currently running.
Please quit iChat to continue." buttons {"Continue"}
if appIsRunning("iChat") then
display dialog "iChat is still running....
I'll take care of it..." buttons {"}:-|"}
tell application "iChat"
quit
end tell
end if
end if
display dialog "This will take just a moment...
Click Ok to continue." buttons {"Ok"} default button 1
set iChatInstall to ((path to me as text) & "Contents:Resources:Install")
tell application "Finder"
copy entire contents of iChatInstall to iChatPlugins
end tell
display dialog "Installation complete!
Lets configure this in iChat!
1. Start iChat.
2. Open iChat Prefrences (Command + ,)
3. Click Alerts.
4. Select Event 'Message Recieved'.
5. Check Run an AppleScript script.
6. Select AAIR from the drop down menu.
7. Close iChat Prefrences."
else
display dialog "You have choose to not install AAIR." buttons {"=("} default button 1
return
end if
end run
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
I got it to copy the files. I couldn’t do that all at once for some reason. The proplem I am having now is I want to beable to overwrite these files as needed in the future… For when I update this script. Is there a way to use duplicate and to overwrite without throwing an error?
New script
property iChatPlugins : missing value
property iChatInstall : missing value
on run
--set iChatPlugins to ((path to home folder as text) & "Library:Scripts:iChat:")
set iChatPlugins to (path to desktop as text)
set answer to the button returned of (display dialog "This will install AAIR. Press Install to continue." buttons {"Install", "Cancle"} default button 1)
if the answer is "Install" then
if appIsRunning("iChat") then
display dialog "iChat is currently running.
Please quit iChat to continue." buttons {"Continue"}
if appIsRunning("iChat") then
display dialog "iChat is still running....
I'll take care of it..." buttons {"}:-|"}
tell application "iChat"
quit
end tell
end if
end if
display dialog "This will take just a moment...
Click Ok to continue." buttons {"Ok"} default button 1
set iChatInstall to alias ((path to me as text) & "Contents:Resources:Install:AAIR")
tell application "Finder"
duplicate iChatInstall to iChatPlugins
end tell
set iChatInstall to alias ((path to me as text) & "Contents:Resources:Install:AAIRv4.0.2a")
tell application "Finder"
duplicate iChatInstall to iChatPlugins
end tell
display dialog "Installation complete!
Lets configure this in iChat!
1. Start iChat.
2. Open iChat Prefrences (Command + ,)
3. Click Alerts.
4. Select Event 'Message Recieved'.
5. Check Run an AppleScript script.
6. Select AAIR from the drop down menu.
7. Close iChat Prefrences."
else
display dialog "You have choose to not install AAIR." buttons {"=("} default button 1
return
end if
end run
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
.
display dialog "This will take just a moment...
Click Ok to continue." buttons {"Ok"} default button 1
set installFolder to POSIX path of (path to me) & "Contents/Resources/Install/"
do shell script "/bin/cp -pR " & quoted form of (installFolder & "AAIR") & space & quoted form of POSIX path of iChatPlugins
do shell script "/bin/cp -pR " & quoted form of (installFolder & "AAIRv4.0.2a") & space & quoted form of POSIX path of iChatPlugins
display dialog "Installation complete!
.