panther Internet Connect -problem

hello,

until i recently updated to panther 10.3 i used a wonderful miniscript the connected me to the internet on startup or reconnected me after an external disconnect. it’s actually half perl, half apple script:

hiere it is:

#!/usr/bin/env perl

$IFCONFIG=`/sbin/ifconfig -a`;
$CONNECT=1;
@LS =split(/x0a/, $IFCONFIG);
for $l(@LS){
	$CONNECT=0 if $l=~m/ppp0/;
}
if($CONNECT){
	system("osascript -e 'tell application "Internet Connect" to connect configuration "Ethernet (integriert)"'");
}

since updating to panther the as part won’t work any more.

tell application "Internet Connect" to connect configuration "Ethernet (integriert)"

It seems as if apple has updated the scripting dictionary w/o updating the documentaion. according to the dictionary the old code should still work. i couldn’t find any working alternative. I also tried to do it w/o as but had no sucess so far in scripting the cl-interface of pppd.

Any ideas. Thanx

I have same problem. My simple script worked with OS 8.6 and OS X10.2.8, but does not work with 10.3.1:

Tell Application “Internet Connect”
Connect
end Tell

Curiously, the disconnect script works fine.

Tell Application “Internet Connect”
Disconnect
end Tell

Anyone know what’s changed in Panther>

I have same problem. My simple script worked with OS 8.6 and OS X10.2.8, but does not work with 10.3.1:

Tell Application “Internet Connect”
Connect
end Tell

Curiously, the disconnect script works fine.

Tell Application “Internet Connect”
Disconnect
end Tell

Anyone know what’s changed in Panther?

Does this work for you?

Try to catch the command that the “Internet Connect” Software sends under the hood to connect while you are connected. issue the following in the shell:


ps -xaww | grep pppd

you will find a line like

pppd serviceid ‘2698A2E4-0D52-11D8-9B1B-0050E479E721’ optionsfd 0 plugin ‘/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp’ logfile ‘/tmp/ppp.log’ plugin PPPoE.ppp device en0 remoteaddress myprovider lcp-echo-interval 10 lcp-echo-failure 4 mru 1492 mtu 1492 receive-all ipparam ‘192.168.50.254 0:0’ noipdefault ipcp-accept-local ipcp-accept-remote usepeerdns +ipv6 ipv6cp-use-persistent noacsp noauth user myname noccp refuse-eap noaskpassword nodetach call myprovider

this will look different for you, since these are my own parameters.

if you issue this on the cl as root in the on the cl you should connect.

it doesn’t work for me though, does it work for you?

I don’t know if it’s changed at all, but if you look at the dictionary for Internet Connect, you’ll see that ‘connect’ has a ‘reference’ parameter. This usually means that you need to tell it what you want to connect.

At a guess, I’d think something like:

tell application "Internet Connect"
  connect PPP configuration 1
end tell

would work. You need to be explicit in what you want it to connect to. It may be that earlier versions made assumptions about what to connect, or it may be that 10.3 adds additional configurations that didn’t exist under 10.2. I can’t tell since I never use Internet Connect, so I don’t know what it used to look like.

As to why the original poster’s script (which does include a reference to the configuration to use) fails, I have no idea. I assume you’ve checked the configuration exists, same spelling, etc.?

No. it dosen’t help what you suggest is what i started out with:

I have tried the following without success:

  1. Tell application “Internet connect”
    Connect
    End tell

  2. Tell application “Internet connect”
    Connect configuration 1
    End tell

  3. Tell application “Internet connect”
    Connect configuation “Built-in Ethernet”
    End tell

What is peculiar is that this script -

Tell application “Internet connect”
disconnect
End tell

works fine without a reference.

And if I activate Internal Modem rather than Built-In Ethernet, then script #1 (without reference for connect) also works fine.

All of the scripts worked without references in OS X 10.2.8.

my stupid workaround.

since i can’t find a way to force a PPPoE connect, (neither shell nor applescript work) i tried to solve the problem by enabling “connect when requested” in PPPoE-Options and launching an app the tries to connect. This also didn’t work. only if i start my machine it automatically connects now.

So instead of reconnecting when i get disconnected i just shutdown and restart my machine at fixed times.

i feel really stupid for doing that this way but iT#s the only way to keep my machine online i know.

Any better ideas?

Did you try this?

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

yes. it doesn’t work. syntax is fine but you start the script but nothing happens.

If you connect manually then run this script:

What are your results?

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

no results. the script doesn’t return anything. No error, no code … nothing I don’t believe it is a syntax problem.

i beieve the AS-solution fails for the same reason as the shell-version where i tried to call pppd directly. but i don’t know how it can be solved

This script returns the following:

"status of PPPoE configuration “Built-in Ethernet” of application “Internet Connect”

tell application "Internet Connect"
	connect [PPP/PPPoE/...] configuration "Device Name"
end tell

It works for me with Panther DP build 7B49…

thanks jon.

may last replay was nonsense. i didn’t read yor script carfully enough.

Internet connect returns the following (same as rongold, wxceot i’m running a german system):

This would lead to the conclusion that


tell application "Internet Connect" to connect PPPoE configuration "Ethernet (integriert)"

should connect

Nevertheless it won’t connect.
your suggestion was my starting point. see above

thanks anyways. i believe it works fine with modemdialup. When using modem dialup you might as well use the commend that you get from


ps -xaww | grep pppd

The following script fails to connect via Internet Connect. If I substitute disconnect for connect then the script to disconnect me from DSL/Ethernet connection.

tell application “Internet Connect”
connect PPPoE configuration “Built-in Ethernet”
end tell

If I substitute "PPP configuration “Internal Modem” in the above script, then it connects (and disconnects) me without problem.

System Profiler gives “Built-In Ethernet” as the configuration name for ethernet connect, yet the script doesn’t work.

cat weed. are you connectingto PPPoE or another device?

I’m kind of new to Applescript. I had the same problem with a script to connect my ADSL connection that broke after I updated to Panther. After some research I came to the conclusion that we must now control Internet Connect with GUI scripts. I found this info on the Apple website http://www.apple.com/applescript/uiscripting/index.html

So I have written a new script that works well for me; it makes my connection, opens and hides Mail, opens the NetNewsWire application and closes the window, because I use the app from the dock, and opens a weather bug for my menubar called Meteorology.

I saved the script as an application without the startup screen and placed it in my login items. Now all those little things I like when I finally sit down at the computer to work in the morning, all happen behind the scene once again in Panther, the way they used to in Jaguar!

Feel free to uses it as you like!

tell application “Internet Connect”
activate
end tell

tell application “System Events”
tell process “Internet Connect”
tell menu bar 1
tell menu bar item “Connect”
tell menu “Connect”
click menu item “Connect”
end tell
end tell
end tell
end tell
end tell
delay 30

tell application “Internet Connect”
quit
end tell

tell application “Mail” to activate
tell application “System Events”
tell process “Mail”
tell menu bar 1
tell menu bar item “Mail”
tell menu “Mail”
click menu item “Hide Mail”
end tell
end tell
end tell
end tell
end tell

tell application “NetNewsWire” to activate
tell application “System Events”
tell process “NetNewsWire”
tell menu bar 1
tell menu bar item “Window”
tell menu “Window”
click menu item “Close”
end tell
end tell
end tell
end tell
end tell
delay 10

tell application “Meteorologist” to activate

thanks for the info. very helpful.

David,

I can’t help with Internet Connect but here’s some code for Mail and NNW that doesn’t rely on scripting the UI.

tell application "Mail" to launch
tell application "System Events" to set visible of process "Mail" to false

tell application "NetNewsWire" to ¬
	try
		close front window
	end try

Tested with Mail 1.2.5, NNW 1.0.8 and OS X 10.2.8.

– Rob