iTunes new song notifications: how to turn off when using miniplayer?
You can manually turn it on and off in the Notifications System preferences.





Update to this Answer:

This works on my Mac quite well. But it is not localised and is really a quick script put together as a proof of concept.. ( thats the disclaimer )

The idea is the place this script in to the Applescript menu and run it when you want to toggle the iTunes player from Main to mini player.

The script wil do the toggle for you, check which window is active and then open the system prefs try and find the iTunes notifications and switch to either "None" or "Banners" depending. I have completely ignored "Alerts" in this because I am sure most people would not have that selected!.

       property delayTimeMax : 2
property windowTitle : ""
set windowTitle to ""
property delayCounter : 0
set delayCounter to 0
property theList : ""
tell application "System Events"
    tell application "iTunes" to activate
    delay 1

    keystroke "m" using {command down, shift down} --//Toggle the itunes window

    my windowTheTitle() --//-- try and get the window title

end tell

tell application "System Events"
    if delayCounter &gt; delayTimeMax then return --//-- too many trys, lets stop
    set delayCounter to 0

    my openSystemEvents() --//-- try and open the  system  prefs window  

    if delayCounter &gt; delayTimeMax then return --//-- too many trys, lets stop
    set delayCounter to 0

    tell application process "System Preferences"

        set this_item to ""
        my findTable() --//-- try and find the app list in the system  prefs window 

        if delayCounter &gt; delayTimeMax then return --//-- too many trys, lets stop
        set delayCounter to 0

        set counter to 0 --// the counter will increment for each row that represents an app

        --// find the correct one using it's static text which will be the app name
        repeat with i from 1 to number of items in theList
            set this_item to item i of theList
            set counter to counter + 1
            try
                set theValue to value of static text of this_item
            end try
            if item 1 of theValue is equal to "iTunes" then
                exit repeat --// found it exit repeat
            end if
        end repeat

        select row counter of table 1 of scroll area 1 of window "Notifications" --// select the app in the table

        set theRadiaGroup to radio group 1 of group 1 of window "Notifications" --// the Radio buttons for the Notification type
        if windowTitle is "MiniPlayer" then
            --// mini player is active
            set theVal to value of radio button "None" of radio group 1 of group 1 of window "Notifications"
            --// we do not want to click the button if it is already selected. Which may or may not deslect all of them. (poss bug)
            if theVal is 0 then
                --//select no alert
                click radio button "None" of radio group 1 of group 1 of window "Notifications"
            end if
        else
            --// MAIN window is active
            set theVal to value of radio button "Banners" of radio group 1 of group 1 of window "Notifications"
            if theVal is 0 then
                --// we do not want to click the button if it is already selected. Which may or may not deslect all of them. (poss bug)
                click radio button "Banners" of radio group 1 of group 1 of window "Notifications"
            end if
        end if
    end tell
end tell
tell application "System Preferences" to quit

on windowTheTitle()
    tell application "System Events"
        try


            tell application process "iTunes" to set windowTitle to get title of window 1 --//Get the window title : iTunes or MiniPlayer
        on error
            set delayCounter to delayCounter + 1
            if delayCounter &gt; delayTimeMax then return --//-- too many trys, lets stop

            delay 1
            my windowTheTitle()
        end try
    end tell
end windowTheTitle
on openSystemEvents()
    tell application "System Events"
        try

            tell application "System Preferences"
                activate
                delay 1
                set the current pane to pane id "com.apple.preference.notifications" --//  Open System Events at the notifications prefs


                if id of current pane is not "com.apple.preference.notifications" then
                    set delayCounter to delayCounter + 1
                    if delayCounter &gt; delayTimeMax then return --//-- too many trys, lets stop

                    delay 1
                    my openSystemEvents()
                end if

            end tell
        on error
            set delayCounter to delayCounter + 1
            if delayCounter &gt; delayTimeMax then return --//-- too many trys, lets stop

            delay 1
            my openSystemEvents()
        end try
    end tell
end openSystemEvents
on findTable()
    tell application "System Events"
        try

            tell application process "System Preferences"
                set theList to (get group 1 of UI element 1 of every row of table 1 of scroll area 1 of window "Notifications") -- get all the radio groups : the Apps grouped icon and text it the table
            end tell
        on error
            set delayCounter to delayCounter + 1
            if delayCounter &gt; delayTimeMax then return --//-- too many trys, lets stop

            delay 1
            my findTable()
        end try
    end tell
end findTable


As I said proof of concept. You most likely can put it in an Automator Service and use a hot key with it.

Also note: depending on your system you may need to add more delays to wait for the user interface to catch up



Update 2

It works better actually as a Automator service with a Hotkey.

In Automator use a Run Applescript Action and replace it's template code with the above..

Set the input to non. and Any Application. Save it.

Open up the Shortcut prefs. Find your service under the Services and add a shortcut.

done.