Entourage Script

Hello All,

I’d like to thank you all in advance for your help. I am new to AppleScript and am trying to write the beginning of a script that will check to see if Entourage is running.

If , it is running then the script will proceed to exexcut additional steps.

If it is not running it will display a dialog box.

Any help is appreciated.


This will work for your needs:

	tell application "Finder" to set entourage_path to application file id "OPIM" as string
on error
	my dd("Entourage is not installed on this machine.", {"OK"}, 1, 0, true)
end try
if (my check_for_app(entourage_path)) = true then
	my dd("Entourage is currently running.", {"OK"}, 1, 1, true)
	my dd("Entourage is not currently running.", {"OK"}, 1, 2, true)
end if

on dd(the_message, the_buttons, default_button, the_icon, giving_up)
	if giving_up = true then
		display dialog the_message buttons the_buttons default button default_button with icon the_icon giving up after 10
		display dialog the_message buttons the_buttons default button default_button with icon the_icon
	end if
end dd

on check_for_app(the_path)
	tell application "System Events"
		repeat with this_app in processes
			if (file of this_app as string) is in {the_path, the_path & ":"} then return true
		end repeat
	end tell
	return false
end check_for_app

Thanks a lot for your help Jonn8.

Do you have any suggestions as far as reference materials that I can/could have used to figure this out myself. I appreciate the code, but I’m also trying to learn. It may take me a while to understand how you cam up with this code.

The internet is so cool.

Cheers my friend.

I use these little handlers:

on verifyProcess(processName)
if processName is in processEnumerator() then return true
return false
end verifyProcess

on processEnumerator()
tell application “System Events” to return name of every process
end processEnumerator

So in your script you can use the handler rather easily in the main script, like in an if statement, like so:

if verifyProcess(“The App Name”) then
– your script actions if app is running
end if

And, of course, be sure to replace the placeholder string with the name of the application. And if the handler is in a tell block addressing an application, be sure to use the term ‘my’ before it, i.e. 'if my verifyProcess(~) then…

For more info, there’s always the horse’s mouth: