"expected type" error
"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.