[問題] 請教apple script 與Internet 連線的問題

看板MacDev作者 (min)時間19年前 (2005/04/04 22:30), 編輯推噓2(202)
留言4則, 2人參與, 最新討論串1/1
請教一下..我用的是 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

220.137.137.163 04/04, , 1F
對了..我的OS版是 10.3.8.網路上的資料都是N年前的
220.137.137.163 04/04, 1F

220.137.137.163 04/04, , 2F
不知道是否有差別?
220.137.137.163 04/04, 2F

140.112.30.32 04/05, , 3F
有沒有可能不是script不work而是硬體不work?
140.112.30.32 04/05, 3F

220.137.137.163 04/05, , 4F
手動按按鈕連線倒是可以連.自動script只能中斷連線
220.137.137.163 04/05, 4F
文章代碼(AID): #12KK-Mpb (MacDev)