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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.