Anyone know how to set to use DHCP with Revolution?

Sarah sarahr at genesearch.com.au
Wed Oct 2 18:13:01 EDT 2002


> Thanks for this information about how to get the network settings.  
> I'm still at a loss as to how one goes about making the setting to 
> DHCP.  I've tried all kinds of techniques from:
>
> "set configuration method of TCP v4 configuration 1 to DHCP"
>
> to various effort to "unlock" the control-settings.
>
> I think this is going to take some heavy-lifting/network guru type to 
> figure this one out.  Is there anyone else who's tried something like 
> this before (setting the user's Networking Control panel to DHCP via 
> Applescript)  Perhaps I could pay someone to write a routine for me, 
> if it can be done at all.
>

Hi Roger,

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




More information about the Use-livecode mailing list