Bring window to front.

I’m trying to write a script that brings a different application to the front.

I was using

bring application "TextEdit" to front

but it doesn’t work.

Please tell me how I would do it.

Thanks.

Hi,

it’s still easier

activate application "TextEdit"

If you want it to the front for the purposes of the script, use “activate”.

activate application “TextEdit”

If you run this from a script editor, however, the editor will always end up in front when the script has finished running. If you run it with a hot key (in Butler, Quicksilver, etc.) or from a script menu, then it will leave the activated app. in front.

You might try the following:


tell application "TextEdit" to activate
tell application "System Events"
tell process "TextEdit"
set frontmost to true
end tell
end tell

Hi,

:lol:

this is tautologic.

activate application "TextEdit"

and


tell application "System Events"
	tell process "TextEdit"
		set frontmost to true
	end tell
end tell

does exactly the same