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)
Who is Participating?
boonstraConnect With a Mentor Commented:
As long as you are using MacOS 8.6 or later, the following should work.

First, verify that there is a "Remote Access Commands" file in the Scripting Additions folder of your System Folder on the target machine (the one that has the internet connection).  That file makes remote access commands accessbile to AppleScript.

Second, make sure that Program Linking is on in the File Sharing control panel on the target computer.  That allows the computer to respond to remote AppleScript commands.

Third, on the remote machine, use the Script Editor to create the following AppleScript:

set hostMachine to "targetMachine"
tell application "Finder" of machine hostMachine
      RA disconnect
end tell

where you replace "targetMachine" with the name of the machine connected to the internet (as seen in the Chooser).

You can do more remote access commands remotely.  From the Script Editor, open the Remote Access Commands file as a dictionary and examine the commands.
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?
sco_bAuthor Commented:
Edited text of question.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Any feedback on this answer?  Do you need more information?
sco_bAuthor Commented:
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?
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"
  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
   -- 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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.