iTunes activates hidden

Hi,

Is anyone experiencing this. When I run this:

tell application "iTunes" to activate

iTunes is hidden. So I have to do this:

tell application "iTunes"
	launch
	activate
end tell

to bring it to the front.

Thanks,

Model: MBP
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

This is weird. Don’t know what is happening. When I run this:

repeat 5 times
	set the_app to choose application
	tell the_app to activate
end repeat

The chosen apps’ windows become frontmost. Even the iTunes window! On the other hand, When I activate the apps with tell app “SomeAppName” to activate its window is not frontmost.

Model: MBP
AppleScript: 2.2.4
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

Update, I have to do this to activate an application:

tell application "iTunes"
	activate
	activate
end tell

I noticed this about three months ago, but couldn’t find anything on this since then. This happens even when run from a script app. ‘activate’ doesn’t work anymore. :confused:

THis activates iTunes making it frontmost:

do shell script "osascript -e 'tell application \"iTunes\" to activate'"

Hello.

I think this may be less resource demanding:

do shell script "open -a \"itunes\""

I think this should work too, but I haven’t tried it, and I am on SL still anyway, (dreaming of one of them black chugs, 64GB ram, and Maverick!

tell application "Finder" to tell application "iTunes" to activate

Have a good evening kel! :slight_smile:

Hi McUsr,

The first script worked and the second one didn’t. I think I’ll use the launch and activate one. That’s almost how you run script apps.

Edited: also, if you open with unix, then it has nothing to do with AppleScript. My first two scripts I posted showed strange results.

Edited: the third script was the strange one.

I restarted and zapped the pram and now iTunes is not hidden with the script:

tell application "iTunes" to activate

Now, it’s not working. Its intermittent. Don’t know what is going on with this. Might have to reinstall.

Thanks,
kel

Hi,

Finished erase disk and reinstalled. It takes a long time nowadays. Anyway, the apps still launch in the background. It’s an AppleScirpt thing.

Alright, I got a brand new system.

Have good days,
kel

Hello kel.

Maybe this can be a usable solution too?

Congrats with brand new machine.

tell application id "com.apple.systemEvents"
	if visible of application process "iTunes" then
		set visible of application process "iTunes" to true
	end if
	if not frontmost of application process "iTunes" then
		set frontmost of application process "iTunes" to true
	end if
end tell

You are not the only one I have heard about with pram/efi ram problems, I think you, and everybody else, should password protect it.