• 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
"expected type" error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"expected type" error


  • Subject: "expected type" error
  • From: email@hidden
  • Date: Mon, 7 Oct 2002 22:19:51 EDT

set configMethod to ""
I've got an Applescript below which I suspect will permit me to set my
network settings to DHCP, if I can figure out what's causing this last bug.

When I run this script, I get a "Can't make some data into the expected type"
error. It highlights line 9, which says:

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

Unfortunately, I don't know how to fix the problem. Is the problem that you
can't compare a "class" to a string?




set configName to ""
set cfg to ""
set config 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 b "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
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: and people wonder why I curse Microsoft
  • Next by Date: Re: top <repeat 100 times \r rant \r end repeat>
  • Previous by thread: Re: and people wonder why I curse Microsoft
  • Next by thread: Automatic PowerBook Synchronize
  • Index(es):
    • Date
    • Thread