Checking for existing process

Hi there,

I have two Applications and I need to run one after one. I got this script and make some changes. It works fine. This is the script:

tell application "Finder"
	activate
	open application file "NetInfo Manager.app" of folder "Utilities" of folder "Applications" of startup disk
	repeat
		delay 5 --Ideally more frequest than this, but remaining low on resource usage
		tell application "System Events"
			if not (exists process "NetInfo Manager") then
				activate application "Directory Access"
				exit repeat
			else
			end if
		end tell
	end repeat
end tell

After I quit netinfo Manager the Directory Access start. tel here ok
then I tried to do it again in this way.

tell application "Finder"
	activate
	open application file "ArabicXTâ„¢ 6.1 Installer" of folder "For QuarkXPressâ„¢ 6.1" of disk "ArabicXTâ„¢ 6"
	repeat
		delay 5 --Ideally more frequest than this, but remaining low on resource usage
		tell application "System Events"
			if not (exists process "ArabicXTâ„¢ 6.1 Installer") then
				activate application "NewspaperXTâ„¢1.1 Installer"
				exit repeat
			else
			end if
		end tell
	end repeat
end tell

but both the two applications open (only delay 5 )
any one can explane it to me ?
also I have a long script … if any one like to help I can send it to him by mail for same case but includ some IFs and display dialogs
thank you all

Hi, alsadr.

The only explanations I can think of are that either:

  1. “ArabicXTâ„¢ 6.1 Installer” is taking more than 5 seconds to open, so that it’s not yet installed as a process when you check for it five seconds later, or:

  2. The process itself has some other name. You can check the process names by opening “ArabicXTâ„¢ 6.1 Installer” and then running this script in Script Editor:

tell application "System Events" to get name of processes

The names of all the running processes will be seen in Script Editor’s “Result” pane.

Moving to OS X forum.

hi NG
yes … I think it takes more than 5 sec to run . I did the script like this …

tell application "Finder"
	activate
	display dialog "Did you installed Quark 6.1?" buttons {"Cancel", "No", "Yes"} default button "Yes"
	if button returned of result is "Yes" then
		open application file "NewspaperXT1.1 Installer" of folder "quark" of folder "source" of disk "G5 Software"
		repeat
			delay 3 --Ideally more frequest than this, but remaining low on resource usage
			tell application "System Events"
				if not (exists process "NewspaperXT1.1 Installer") then
					activate application "ArabicXT6.1  Installer"
					exit repeat
				end if
			end tell
		end repeat
	else
		if button returned of result is "No" then
			display dialog "You should have Quark 6.1 .. Would you like to install Quark 6.1 First?" buttons {"Cancel", "No", "Yes"} default button "Yes"
			if button returned of result is "Yes" then
				set the clipboard to "T8ZZNZXJR9GHMYQ8NUCDZJB92QN2M4CY1ZSG688HFHAHNT2"
				open application file "Setup QuarkXPress 6.1" of folder "QuarkXPress 6.1" of folder "Quark" of folder "source" of disk "G5 Software"
				delay 3 --Ideally more frequest than this, but remaining low on resource usage
				repeat
					tell application "System Events"
						if not (exists process "Setup QuarkXPress 6.1") then
							activate application "QuarkXPress 6.5 Updater"
							exit repeat
						end if
					end tell
					delay 5 --Ideally more frequest than this, but remaining low on resource usage
					
				end repeat
				delay 5 --Ideally more frequest than this, but remaining low on resource usage
				repeat
					tell application "System Events"
						if not (exists process "QuarkXPress 6.5 Updater") then
							activate
							activate application "NewspaperXT1.1 Installer"
							exit repeat
						end if
					end tell
					delay 5 --Ideally more frequest than this, but remaining low on resource usage
				end repeat
				delay 5 --Ideally more frequest than this, but remaining low on resource usage
				repeat
					tell application "System Events"
						if not (exists process "NewspaperXT1.1 Installer") then
							activate
							activate application "ArabicXT6.1  Installer"
							exit repeat
						end if
					end tell
					delay 5 --Ideally more frequest than this, but remaining low on resource usage
				end repeat
				
			else
				if button returned of result is "No" then
					display dialog "You R Playing .. Go to die..  I will tel your Dad" buttons {"ok"}
				end if
			end if
		end if
	end if
end tell

it is working fine but sometimes it jumb to the forth process but tell now it is enough for me…
I hope if there is something better advice me Pls
thank you
ahmed alsadr