Anyone know how to prevent this type mismatch error?
kray at sonsothunder.com
Fri Oct 11 20:06:00 CDT 2002
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,
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
----- Original Message -----
From: <RGould8 at aol.com>
To: <use-revolution at lists.runrev.com>
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
if (class of configuration i of config) as string is (TCPIP v4
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
type-matching errors? The impression I get is that you can't compare a
string to a class.
In a message dated 10/2/02 7:08:18 PM, sarahr at genesearch.com.au 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)
> 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
> 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.
> use-revolution mailing list
> use-revolution at lists.runrev.com
More information about the use-livecode