作者equal (min)
看板MacDev
标题[问题] 请教apple script 与Internet 连线的问题
时间Mon Apr 4 22:39:55 2005
请教一下..我用的是 PPPoE 连接ADSL上网
但是似乎断线後不会重新拨号..
所以我想说写在cronjob里面去跑shell script去run
无奈也找不到如何在command line下拨号的方法..
拜问google大神之後..
可以利用apple script的方式去操作GUI下的动作
...问题来了..
找到别人写好的apple script
只要用
tell application "Internet Connect"
connect
end tell
就可以连线
用disconnect可以断线..
可是我怎麽run都没有动作
加了侦错..看结果应该也是可行的才对
tell application "Internet Connect"
launch -- starts in background
try
connect
-- if it fails to connect, it will go to the error section skipping the next message
--display dialog 'Connected to the Internet'
on error
--display dialog 'FAILED to connect to the Net'
-- there are fun and fancy things to do here that I don't have with me like showing the actual error returned.
end try
quit
end tell
然後又找到另外一种写法..去指定要连线的装置
tell application "Internet Connect"
set configName to "连线装置的名称..(我是取 HINET ADSL)"
set currentStatus to status of configuration configName
connect configuration configName
end tell
//
connect configuration configName
这一行无法动作.
但是换成
disconnect configuration configName
却可以中断连线
不知道哪位前辈有做过相关的东西可以提供一下参考吗?谢谢^^;
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.137.137.163
1F:→ equal:对了..我的OS版是 10.3.8.网路上的资料都是N年前的220.137.137.163 04/04
2F:→ equal:不知道是否有差别?220.137.137.163 04/04
3F:推 tren:有没有可能不是script不work而是硬体不work? 140.112.30.32 04/05
4F:推 equal:手动按按钮连线倒是可以连.自动script只能中断连线220.137.137.163 04/05