Ahhh - - - perhaps that's the problem.  I was looking for an Applescript solution in OS 8/9 that would set the user's networking to DHCP.  So, if this was designed to run in 10, then that sheds some light on the issue.

In the long-run, I'll need to do this on both Mac OS 9 _and_ Mac OS X.  I was assuming that the technique would be radically different, with OS X relying on more unix-calls.  Resources on the web that detail how to script the networking control pane are few and far between, it seems.

>From what I gather from the script, it appears that there's some sort of networking database that is being opened up, that contains different networking settings.  The script appears to go through the list in the database until it finds the active setting, and attempts to modify it to "Use DHCP" - - is that the correct description of what's going on?

If this script is designed to run on OS X - - - can anyone shed light on how different the OS 9 version would be?

Thanks again for your help - - - this is indeed one of the best Listserve's I've been on.  Folks here are very helpful and knowledgeable.

- Rob

In a message dated 10/11/02 9:01:45 PM, [EMAIL PROTECTED] writes:


Rob,

What version of AppleScript/Mac OS are you using? It is possible that this
configuration didn't work properly in earlier versions...

The reason I say that is that since I was the original poster of the
AppleScript (to which Sarah added her valuable additions), and it worked for
me on an iMac running OS 10.1...

Let us know,

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 5:53 PM
Subject: Re: Anyone know how to prevent this type mismatch error?


Sarah - - - thanks so much for this script.   I've hit one stumbling block
that's keeping it from running, and no one seems to know how to fix it - - -
was wondering if someone on this list might:

The problem is with this line:

if (class of configuration i of config) is (TCPIP v4 configuration)

appleScript is complaining of a type mismatch problem.   I thought perhaps
putting

if (class of configuration i of config) as string is (TCPIP v4
configuration)

might fix the problem, but that gave me a syntax error.   I've only been
scripting for about 2 months.   Would anyone happen to know how to solve
such
type-matching errors?   The impression I get is that you can't compare a
string to a class.

- Rob

In a message dated 10/2/02 7:08:18 PM, [EMAIL PROTECTED] writes:

>
> Hi Rob,
>
> Here is Ken's script with an added section that changes the relevant
> setting to DHCP. As Ken mentioned, this just handles the first TCP
> configuration it finds, so you might need to add a check for other
> configs, but it should get you started:
>
> set configMethod to ""
> set configName to ""
> set cfg to ""
>
> tell application "Network Setup Scripting"
> open database
> set config to current configuration set
> repeat with i from 1 to count of configuration of config
> if (class of configuration i of config) is (TCPIP v4 configuration)
> then
> set cfg to configuration i of config
> set configName to name of config -- so you can check the name
> to see
> if it's the right one
> exit repeat
> end if
> end repeat
> set configMethod to configuration method of cfg
>
> try
> if configMethod ≠ "DHCP" then
> begin transaction
> set protec to get protection of configuration method of cfg
> if protec = locked then return "Setting is locked"
> set the configuration method of cfg to DHCP
> end transaction
> end if
> on error errMsg number errNum
> close database
> return "Error: " & errMsg & " " & errNum
> end try
>
> close database
> return "Setting changed to DHCP"
> end tell
>
> Note: there is a line above that uses the Mac's Not-equal sign
> (option-equal): if configMethod **not-equal** "DHCP" then
> It may not translate via email. Also beware of long lines wrapping. If
> you want me to send you the actual script, send me an email off-list.
>
> Sarah
>
> _______________________________________________
> use-revolution mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>


_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution



Reply via email to