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)