Can someone tell me why this takes so long?

Hi There,

The script below seems to take between 3-5 seconds to return an answer, please can someone tell me why that is.

tell application "System Events"
	if exists process "Safari" then
		set x to 1
		else
		set x to 0		
	end if
end tell

Thanks

Nick

hi nick,

on my dual 450 running 10.4.7 it takes less than a second. i’ve got 512mb of ram, and am running FireFox, Terminal, TextEdit, and iTunes (oh, and i tried it w/ Safari running too–no difference).

HTH.

ps–the only change i made is below. wanted the answer, doncha know :smiley:


tell application "System Events"
	if exists process "Safari" then
		set x to 1
	else
		set x to 0
	end if
end tell

display dialog x

Hi Technik

Less than a second here also…

2ghz dual G5 with a lot of apps open…

cheers

0.09s

MacBook Pro 17"
2.16 GHz
2GB Ram
10.4.7

It may be that either System Events or Safari is busy doing (scripting or other) tasks.
Try calling another app via System Events to see if that helps or either (force-) quit System Events or Safari and launch it again.
Safari is generally busy when many pop-up of moving graphics are active.

Hi,

Also, fyi here’s a different version:

tell application “System Events” to set x to (exists process “Safari”) as integer

gl,