MACSCRPT Archives

March 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Delacour <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 17 Mar 2006 20:00:58 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (57 lines)
At 2:19 pm -0500 17/3/06, David Freels wrote:

>I have been unsuccessful in compiling the script posted here a few 
>days ago. When I "run" it in Script Editor, it comes back with the 
>following note:
>
>"Syntax Error
>
>Expected end of line, etc., but found identifier."
>
>Some questions:
>
>1. What is meant by Syntax Error?
>2. What is "end of line"?
>3. Is "end of line" a good thing to seek? Why?
>4. What is "identifier"? Is identifier good or bad? Why or why not 
>(as the case may be)?


The problem is simply that Bill's mailer or the list server 
introduced line-breaks in the script.  If you remove the improper 
line-breaks or use continuation characters as below, you will be able 
to compile it:

(Bill uses Entourage, which is incapable of sending long lines in 
plain text messages)


-- Set the bluetoothIndex to suit your setup
-- (for best stability, count from the end)

property bluetoothIndex : -6

activate application "SystemUIServer"
tell application "System Events"
   tell process "SystemUIServer"
     set bluetoothItem to menu bar item Â
       bluetoothIndex of menu bar 1
     click bluetoothItem
     tell menu 1 of bluetoothItem
       if title of menu item 1 does not start with "BlueTooth" then
         beep
         display dialog "
This is not the BlueTooth menu extra." buttons Â
           {"OK"} default button "OK"
         return
       end if
       if title of menu item 2 ends with "Off" then
         click menu item 2
       end if
     end tell
   end tell
end tell


--JD

ATOM RSS1 RSS2