Expected end tell error on AppleScript

Asked By 10 points N/A Posted on -
qa-featured

Hi,

Using AppleScript, I am trying to select a menu item in iTunes but I get this following error message when I try to run this script. The error shows the following “Expected “end” or “end tell” but found end of script”.

I have searched for the solution from internet.

Any help would be grateful to you.

Expected “end” or “end tell” but found end of script.

 

SHARE
Answered By 0 points N/A #176779

Expected end tell error on AppleScript

qa-featured

This error generally means that Applescript compiler did not find some terminator.

This is what you might experience: 

Tell Application "System Preferences
"Reveal pane ID "com.apple.preferences.Bluetooth"
     tell application "System Events" to tell process "System Preferences"
        set bluetooth to checkbox "On" of window 1
            set bluetoothBool to value of checkbox "On" of window 1 as boolean
             Tell bluetooth
        if bluetoothBool = false then
            click bluetooth
            display dialog " Bluetooth on " with title " Bluetooth "
             default button "OK"
           else if bluetoothBool = true then
            click bluetooth
            display dialog " Bluetooth off " with title " Bluetooth "
                buttons " OK " " Turn Bluetooth on "
                default button " OK "
        end if
    end tell
end tell
quit

First try looking for a missing double quote ("). This are a bit difficult to find but try saving often while searching and continue your search for the missing (") until you are sure enough that none of the (") are missing.

Related Questions