![]() |
FreePPP Control 1.2Scripting addition for FreePPP 2.6
|
||||||||||||||||||
|
Berlin, 6 May 02
About FreePPP Control...FreePPP Control is a scripting addition which gives Applescript access to the main functions of the FreePPP 2.6 system extension. For more information about FreePPP please visit <http://www.rockstar.com/>.HistoryI've been using the scripting addition "MacPPP Control" by Mark Aldritt to automate my daily PPP access. It allows Applescript to open and close a specific PPP connection and set or ask for current state information's.MacPPP Control always worked fine with MacPPP and FreePPP up to version 2.5v2 but the developers of FreePPP changed the API and the structure of the preferences file in a way that it wont function with FreePPP 2.6 which at the time of this writing is available as a part of the GearBox 1.1 software. Having some spare time I started to work on my own replacement for the MacPPP scripting addition based on the public interface for FreePPP 2.6. How to install FreePPP ControlAssuming that FreePPP 2.6 and Applescript are properly installed on your computer you just have to place the "FreePPP Control" Scripting Addition in your "Scripting Additions" Folder which should be located in your "System Extensions" Folder. Since version 1.2 "FreePPP Control" comes in two flavous.
What features does it add ?FreePPP Control adds six new commands and one new class to your Applescript environment. If you're starting your Scripteditor and open the dictionary of FreePPP Control or simply drag the Scripting addition onto it you will get short information's about the newly added features.New commands
The command takes no arguments and returns no value. It simply tries to open the current PPP connection with the current settings. If there already is an active connection nothing happens. Note: "open FreePPP" initiates a new connection without waiting
for success. If you want to be sure that you have an active connection
you have to call "FreePPP is" or "FreePPP
state".
Tries to close the current connection. If there is none nothing happens. As with "open FreePPP" there is no return value. You have to use the "FreePPP is" command or the "FreePPP state" verb to check for success. New to v1.1 The "close FreePPP" verb accepts one optional argument. If you write "close FreePPP hard" the scripting addition tries to force a hard close the command "close FreePPP soft" just closes the PPP stack without closing the telephone line. If you omit this argument the behavior is determined by the "Allow applications to open connection" button in the FreePPP setup. If this option is turned off closing is equivalent to a hard close. If the option is turned on it's equivalent to a soft close. Caution: The hard/soft feature is not very well tested. My ISP closes
the telephone line on hard and soft closes. Please keep me informed if
it works.
There are two different ways to use the "FreePPP is" command to check
for a current connection. If you write "FreePPP is connected" the
function returns true if your computer is currently connected otherwise
false. A different approach is to ask if the computer is not connected
by issuing the "FreePPP is not connected" command. The following
statements within the if clause both are executed whenever FreePPP is currently
on-line.
-- do something very useful end if if not FreePPP is not connected then
to string There is no return value. If the function fails the command returns an error to Applescript and the script gets terminated. Valid arguments for new accounts, locations or modems have to be a part of the corresponding list (see "FreePPP get"). Names are case sensitive. The command also fails if there is a current connection. The following example first checks for FreePPP to be off-line and changes
the name of the current modem to "MyBrandNew 56k Modem".
the list of accounts/list of locations/list of modems The next example first determines the name of the current location and shows it in a dialog. Afterwards it'll show the list of valid account names one after the other . display dialog the_account -- set the_list to FreePPP get the list of accounts repeat with a in the_list
"FreePPP state" returns various information?s about the current PPP
connection. The function takes no arguments and returns a record of class
FreePPP-State.
New classes
The boolean value "active" reflects the on-line state of your computer. If it?s false there is no connection. In this case the rest of the properties are not defined and can not be evaluated. Checking the "active" property gives the same result as calling "FreePPP is connected". The "duration" Property contains the number of seconds since the connection has been opened. "bytes in" and "bytes out" are counters holding the number of bytes written to and read from the PPP Server. The properties "local IP" and "remote IP" are lists of four integers which represent the IP of your computer and the server on the other side of the telephone. The following example gets the current FreePPP-State, determines if there currently is a connection and shows the local IP if FreePPP is active.
set a to FreePPP state -- if active of a then
-- -- Transform the List into a string with dots -- repeat with b in local IP of a
-- -- delete the trailing "." -- set IP to items 1 thru ((number of items of IP) - 1) of IP as text display dialog IP Error MessagesIf something goes wrong the FreePPP Control Applescript addition returns an error message to the scripting system and terminates the script execution. There are (hopefully only) six types of error messages returned by the scripting addition.
Please keep me informedI've been testing the program thoroughly but I don't have the time to do this checking on various hardware platforms with different system configurations. Please keep me informed if there is any misbehavior of my program.You can reach me via e-mail under <kloska@mpimp-golm.mpg.de>. FreePPP Control is FreewareYou may use FreePPP Control free of charge make as many copies as you like and distribute it on a non profit basis as long as it stays bundled with the unaltered documentation. For-profit companies that sell software programs must receive explicit written permission from the author before distributing the program.DisclaimerI make no warranty whatsoever, either implied or expressed, as to the correct functioning of this software. When using this software, the user assumes all responsibility for any damages caused, directly or indirectly, by its use.FreePPP, the FreePPP Icon and FreePPP Setup are copyrights owned by the FreePPP Group Inc. GearBox is a trademark of Rockstar Studios Inc. Applescript is a registered trademark of Apple Computer, Inc. |
|||||||||||||||||||
|