Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Version with line-wrapping' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Version with line-wrapping
Authored by: Krioni on Apr 16, '10 06:32:50AM
Broke this down so the lines don't stretch out so long.

(*
(c) Copyright 2010 Joris Berthelot <admin at eexit dot net> httpt://www.eexit.net
*)
property ffEnableCode : "sysctl -w net.inet.ip.forwarding=1 net.inet.ip.fastforwarding=1"
property ffDisableCode : "sysctl -w net.inet.ip.forwarding=0 net.inet.ip.fastforwarding=0"

set currentState to "Current state of IP Forwarding:" & return & return & 
	(do shell script "sysctl net.inet.ip.forwarding") & return & 
	(do shell script "sysctl net.inet.ip.fastforwarding")

display dialog currentState with title "IP Forward  eexit.net" with icon note 
	buttons {"Enable", "Disable", "Quit"} cancel button 3 default button 1
set choice to button returned of result
try
	if choice contains "Enable" then
		set ffEnableResult to (do shell script ffEnableCode with administrator privileges)
		display dialog ffEnableResult with title "IP Forward  eexit.net" with icon note 
			buttons {"Done"} default button 1 giving up after 10
	end if
	if choice contains "Disable" then
		set ffDisableResult to (do shell script ffDisableCode with administrator privileges)
		display dialog ffDisableResult with title "IP Forward  eexit.net" with icon note 
			buttons {"Done"} default button 1 giving up after 10
	end if
on error the error_message number the error_number
	beep
	display dialog "Error: " & the error_number & return & the error_message 
		with title "IP Forward  eexit.net" with icon stop buttons {"Quit"} default button 1
end try
---
http://www.danshockley.com


[ Reply to This | # ]