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:
David Freels <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 17 Mar 2006 14:19:29 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (179 lines)
Mr Cheeseman and company,

I've hesitated to reply as I'm not at all fluent in Applescript. I'm 
subscribed to this list primarily to read and learn, but even then, I 
am struggling. Please bear with me as there's a lot of things, 
probably very simple things that I do not understand.

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)?

Another script with the same concept/purpose was posted in the Forum 
of the Salling Clicker website, but it's in German, and I can't read 
German. From http://www.salling.com/forums/viewtopic.php?t=2009


tell application "System Preferences"
   activate
   set current pane to pane "com.apple.preference.security"
end tell

tell application "System Events"
   tell window "Sicherheit" of process "System Preferences"
      if value of checkbox "Beim Beenden des Ruhezustandes oder 
Bildschirmschoners
ein Kennwort verlangen" is 1 then
         click checkbox "Beim Beenden des Ruhezustandes oder Bildschirmschoners
ein Kennwort verlangen"
      end if
   end tell
end tell
tell application "System Preferences"
   quit
end tell


Can anyone here translate? Which script is better? Mr Cheeseman's or 
the German--and how would you know?

Thanks.

mailto:[log in to unmask]




Date:    Sat, 11 Mar 2006 06:07:36 -0500

From:    Bill Cheeseman <[log in to unmask]>

Subject: Re: activate/deactivate Bluetooth on the Mac via Applescript?

MIME-Version: 1.0

Content-Type: text/plain; charset="US-ASCII"

Content-Transfer-Encoding: 7bit



on 2006-03-11 12:05 AM, David Freels at [log in to unmask] wrote:



>  I would really like to activate/deactivate Bluetooth on the Mac via

>  Applescript (hopefully) via the computer keyboard and/or phone keypad.



Here's a script that turns Bluetooth off. I'll leave it to you to figure out

how to run it from the keyboard.



Notice that the property identifying the location of the Bluetooth menu in

the menu bar has to be set according to the particular arrangement of menu

extras on your machine. You'll have to set it again if you install or remove

menu extras.



-- 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





--



Bill Cheeseman - [log in to unmask]

Quechee Software, Quechee, Vermont, USA

http://www.quecheesoftware.com



PreFab Software - http://www.prefab.com/scripting.html

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com

Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes

-- 


David Freels
2948 Windfield Circle
Tucker, GA 30084-6714
770-491-6776 (phone)
404-725-4520 (cell)
815-366-7962 (fax)
mailto:[log in to unmask]

http://www.freelanceforum.org/df

ATOM RSS1 RSS2