Multi application support in single script
Multi application support in single script
- Subject: Multi application support in single script
- From: CasBaH Software <email@hidden>
- Date: Sat, 28 Jun 2003 00:36:33 +0200
Hi there
I am trying to build an AppleScript (for Mac OS X) that supports
several clients providing the same service - but with mixed luck.
What I'm trying to do is to support different email applications in the
same script, but the applications referenced in the script might not be
installed on all computers running the script. For now I have
implemented the wanted functionality for Mail, Entourage, Eudora, and
Mailsmith. When I run my script and e.g. Eudora is not launched it will
be launched by my script. I have also gotten reports from users without
Entourage installed that the script asks for Entourage.
I thought I had solved this problem by checking that said application
is running at the time of running the script - see enclosed script
snippets.
Is it not possible to create this kind of AppleScript? Must I create a
separate script for each email client?
Script snippets to (perhaps) ease the understanding:
on run {}
set messageList to {}
if ProcessNamedIsRunning("Mail") then
set messageList to GetMailList(messageList)
end if
if (count of messageList) = 0 then
if ProcessNamedIsRunning("Microsoft Entourage") then
set messageList to GetEntourageList(messageList)
end if
end if
if (count of messageList) = 0 then
if ProcessNamedIsRunning("Eudora") then
set messageList to GetEudoraList(messageList)
end if
end if
if (count of messageList) = 0 then
if ProcessNamedIsRunning("Mailsmith") then
set messageList to GetEudoraList(messageList)
end if
end if
ProcessMessages(messageList, true)
end run
on ProcessNamedIsRunning(processName)
tell application "System Events"
return (exists application process processName)
end tell
end ProcessNamedIsRunning
on GetMailList(msgList)
tell application "Mail"
-- Do stuff
end tell
return msgList
end GetMailList
on GetEntourageList(msgList)
tell application "Microsoft Entourage"
-- Do stuff
end tell
return msgList
end GetEntourageList
on GetEudoraList(msgList)
tell application "Eudora"
-- Do stuff
end tell
return msgList
end GetEudoraList
on GetMailsmithList(msgList)
tell application "Mailsmith"
-- Do stuff
end tell
return msgList
end GetMailsmithList
Regards,
Christian Bxtker Hxj
CasBaH Software
www.casbahsoft.com
_______________________________________________
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.