advice please.. Fix errant TCP/IP connection --
advice please.. Fix errant TCP/IP connection --
- Subject: advice please.. Fix errant TCP/IP connection --
- From: Xandra Lee <email@hidden>
- Date: Thu, 22 Nov 2001 09:02:02 -0500
Occassionaly, It's necessary for me to disable then enable TCP/IP in
order to get my connection working again.
So, I'm trying to turn off (NOT switch configurations)- as if I used the
options button in the TCP/IP control panel - and chose inactive), then do
the reverse.
I need to send the following to a few people who would be freaked if
something went wrong..
I'm a novice at anything network related, So I'd appreciate comments,
improvements to the following:
-------DESCRIPTION------------------
--Make TCP/IP inactive then active again, for those times when your
connection's gone blooey.
--REQUIRES: Network Setup Scripting (in Scripting Additions folder)
--OS9??? AS 1.6??? or later
--TESTED: OS9.2, AppleScript 1.6
------------SCRIPT START------------------
global gOptions
global gOpts2
global gFailMsg
global gOKMsg
set gFailMsg to ""
set gOKMsg to ""
tell application "Network Setup Scripting"
--First make TCP inactive:
try
open database
set the transaction_ID to begin transaction
set gOptions to TCPIP active of TCPIP v4 options
if gOptions is {true} then
set TCPIP active of TCPIP v4 options to {false}
set gOKMsg to "TCP was made inactive..."
end if
end transaction
close database
on error errMsg
set gFailMsg to errMsg
try
-- abort the transaction
if the transaction_ID is not "" then
abort transaction
end if
-- close the database if it was left open
close database
end try
end try
-- now turn it back on again:
try
open database
set trans2 to begin transaction
set gOpts2 to TCPIP active of TCPIP v4 options
if gOpts2 is {false} then
set TCPIP active of TCPIP v4 options to {true}
set gOKMsg to gOKMsg & ("& then it was made active again.")
end if
end transaction
close database
--make damned sure db is closed:
on error errMsg
set gFailMsg to errMsg
try
if the trans2 is not "" then
abort transaction
end if
close database
end try
end try
end tell
--USER FEEDBACK:
tell application (path to frontmost application as text)
if gFailMsg is not "" then
display dialog gFailMsg buttons {"OK"} ,
default button 1 giving up after 60 with icon caution
else
display dialog gOKMsg buttons {"OK"} ,
default button 1 giving up after 60 with icon note
end if
end tell
Alixandra Leigh
AceDesign
email@hidden
------------------------------------------
Furniture:
><
http://home.rochester.rr.com/alexleighs/furniture/furniture.htm>
Renderings:
><
http://home.rochester.rr.com/alexleighs/interiors/interiors.htm>