• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Applescript AppleTalk Config??? -SOLUTION SCRIPT
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript AppleTalk Config??? -SOLUTION SCRIPT


  • Subject: Re: Applescript AppleTalk Config??? -SOLUTION SCRIPT
  • From: Xandra Lee <email@hidden>
  • Date: Thu, 25 Oct 2001 09:22:42 -0400

>At 10:47 AM -0400 10/24/01, Xandra Lee wrote:
>>Is there any way to AppleScript which configuration is Active in
>>Appletalk...

Cornwall, email@hidden responded:
>While I don't have any Apple Talk configs to test with, something
>along the following lines should* work. ****UNTESTED****

>tell application "Network Setup Scripting"
> try
> open database
> begin transaction
> set active of AppleTalk configuration "some config" to true
> end transaction
> close database
> end try
>end tell
>Corny

Bless you Corny,

Pretty damned close for an untested script. At first I couldn't get this
to work, seems NSS didn't like the name of my config "Stylus RIP - Remote
Only". Go Figure?!
Unfortunately, since it failed before "end transaction/close database"..
No other commands to NSS would work. I SHUDDA caught this earlier.
Anyway, the following is an easily editable working script, in case
others would find useful:

----------------SCRIPT START-----------------
--Sets AppleTalk to "Remote Only" (or whatever configName it's set to),
-- optionally displays confirmation or error
-- REQUIRES: Network Setup Scripting (included with OS 8.5? and later)
-- CREATED: 10/25/01, TESTED: MacOS 9.2, AS 1.6 (likely works back to 8.5)
-- AUTHOR: Cornwall, email@hidden (adapted by alixandra leigh)

property showResult : true
property configName : "Remote Only"
set theMessage to ""

--Change to Remote
tell application "Network Setup Scripting"
try
open database
begin transaction
--get active config:
name of every AppleTalk configuration whose active is true
set thisConfig to result as string --> "Ethernet"
--only switch if necessary:
if thisConfig is not configName then
set active of AppleTalk configuration configName to true
end if
end transaction
close database
--if it gets this far then it's "Remote Only" :
set theMessage to (configName & " is active")
-- on failure make sure to end transaction & close db - capture error:
on error errMsg
try
set theMessage to "Houston, we have a problem
" & return & errMsg
end transaction
close database
end try
end try
end tell

if showResult is true then
beep
if theMessage is not configName & " is active" then
display dialog theMessage with icon caution
else
display dialog theMessage buttons {"OK"} default button "OK" with icon
note giving up after 1
end if
end if
------------END SCRIPT ------------------

Thanks Corny,
xandra

Alixandra Leigh
AceDesign
email@hidden
------------------------------------------
Furniture:
><http://home.rochester.rr.com/alexleighs/furniture/furniture.htm>
Renderings:
><http://home.rochester.rr.com/alexleighs/interiors/interiors.htm>


  • Prev by Date: Re: OT: Open Source Apple Mods
  • Next by Date: Re: Open Source Apple Mods
  • Previous by thread: Fwd: Re: OT: Open Source Apple Mods
  • Next by thread: how to set an item to invisible
  • Index(es):
    • Date
    • Thread