Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to use Script Editor to open iTunes visualizer?

I have an AppleScript which I used to use in previous versions of OS X to open a visualizer and put it into full screen if music was currently playing. If no music was playing, then it would turn off the visualizer and take iTunes out of full screen. This script still works, but only if iTunes is already open and you can see iTunes on the desktop. If iTunes is open with music playing, but not visible(not visible on the desktop aka minimized or you clicked the red "x" to close iTunes, but not actually quit it), then I get the error...

"Can’t set «class pVsE» of application "iTunes" to true.

iTunes got an error: Can’t set visuals enabled to true. (-10006)"


How can I fix this error so it no longer happens?

I believe I just need to find a way to bring iTunes to the desktop, even if it's already open. Again, it works just fine if you can see iTunes on the desktop

Any suggestions?


I am using Mac OS X Yosemite 10.10.3.


Thanks for any help!


Here is the Apple Script...


tell application "iTunes"

activate

delay 1

if player state is playing then

if visuals enabled is true then

set full screen to false

delay 3

set visuals enabled to false

else if visuals enabled is false then

set visuals enabled to true

set full screen to true

end if

end if

end tell

MacBook Pro with Retina display, OS X Yosemite (10.10.3)

Posted on Apr 25, 2015 8:00 PM

Reply
Question marked as Best reply

Posted on Apr 26, 2015 11:19 AM

The visualizer appears to be bound to the browser window - if there is no browser window, enabling the visualized fails.


The simplest solution, therefore, may be to show the browser window before trying to enable the visualizer:


else if visuals enabled is false then

set visible of browser window 1 to true -- add this line to show the browser window

set visuals enabled to true

set full screen to true

end if

2 replies
Question marked as Best reply

Apr 26, 2015 11:19 AM in response to mdee4

The visualizer appears to be bound to the browser window - if there is no browser window, enabling the visualized fails.


The simplest solution, therefore, may be to show the browser window before trying to enable the visualizer:


else if visuals enabled is false then

set visible of browser window 1 to true -- add this line to show the browser window

set visuals enabled to true

set full screen to true

end if

How to use Script Editor to open iTunes visualizer?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.