sco_b
asked on
Disconnecting via AppleScript
I'v got 2 computers on a local network. The ISDN-software is installed on one computer and I can go online on the other computer via the network, but I can't disconnect the connection via the network. I have to disconnect the internet-connection on the computer where the ISDN-sofware (Sagem ISDN) is installed.
I'm using MacOS 9 and I think I use Remote Acces (I saw some extensions)
I'm using MacOS 9 and I think I use Remote Acces (I saw some extensions)
Can you tell us the actions that you want to script on the remote computer? Are you using Remote Access or something else? What version of MacOS are you using?
ASKER
Edited text of question.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Any feedback on this answer? Do you need more information?
ASKER
I'm sorry but it doesn't work
error : -7108
RA disconnect
I've tried to replace RA by PPP (that's what I use to connect so..)
But still the same error
Do you know what's wrong?
error : -7108
RA disconnect
I've tried to replace RA by PPP (that's what I use to connect so..)
But still the same error
Do you know what's wrong?
I'm sorry my suggestion did not work. You should probably have rejected my answer.
It turns out Apple made some changes for MacOS 9.0 that I didn't notice until now.
Try this:
Configure to use Remote Access, not ppp.
On your target machine, make sure that program linking is on.
Make sure that "Network Setup Scripting" in the Scripting Additions folder of your System Folder is running. This is a faceless background app that in MacOS 9 handles network scripting. You can start it manually, or put an alias in your Startup Items folder.
Then run the following script, replacing YOUR_REMOTE_ACCESS_CONFIG with the name of your Remote Access configuration, and replacing REMOTE_MACHINE with the name of your internet-connected computer, as seen in the chooser:
set the config_name to "YOUR_REMOTE_ACCESS_CONFIG "
set remote_machine to "REMOTE_MACHINE"
using terms from application "Network Setup Scripting"
try
tell application "Network Setup Scripting" of machine remote_machine
-- open the Networking Database
open database
-- start the connection process
disconnect Remote Access configuration config_name
--close the Network Database
close database
end tell
display dialog "Disconnect succeeded"
on error
try
-- close the database if it was left open
tell application "Network Setup Scripting" of machine remote_machine to close database
display dialog "Disconnect failed"
on error
display dialog "tell failed"
end try
end try
end using terms from
If this doesn't work, tell me what the dialogs say.
If it does work, you can delete the "display dialog" commands if you like.
The first time you execute this, it should ask you to connect to your remote machine. You can add the connection to your keychain to bypass this in the future.
It turns out Apple made some changes for MacOS 9.0 that I didn't notice until now.
Try this:
Configure to use Remote Access, not ppp.
On your target machine, make sure that program linking is on.
Make sure that "Network Setup Scripting" in the Scripting Additions folder of your System Folder is running. This is a faceless background app that in MacOS 9 handles network scripting. You can start it manually, or put an alias in your Startup Items folder.
Then run the following script, replacing YOUR_REMOTE_ACCESS_CONFIG with the name of your Remote Access configuration, and replacing REMOTE_MACHINE with the name of your internet-connected computer, as seen in the chooser:
set the config_name to "YOUR_REMOTE_ACCESS_CONFIG
set remote_machine to "REMOTE_MACHINE"
using terms from application "Network Setup Scripting"
try
tell application "Network Setup Scripting" of machine remote_machine
-- open the Networking Database
open database
-- start the connection process
disconnect Remote Access configuration config_name
--close the Network Database
close database
end tell
display dialog "Disconnect succeeded"
on error
try
-- close the database if it was left open
tell application "Network Setup Scripting" of machine remote_machine to close database
display dialog "Disconnect failed"
on error
display dialog "tell failed"
end try
end try
end using terms from
If this doesn't work, tell me what the dialogs say.
If it does work, you can delete the "display dialog" commands if you like.
The first time you execute this, it should ask you to connect to your remote machine. You can add the connection to your keychain to bypass this in the future.