2013-12-15 6 views
5

時々私はPdaNetを私のiPhoneを使ってテザーに使う。 OSX用のデスクトップクライアントは、Windows用のデスクトップクライアントほど豊かではありません。主な違いの1つは、OSXがiPhoneに接続されると自動的にiPhoneに接続することができないということです。Macメニューバーの特定のアイコンをクリックするAppleScript

Applescriptを使用してメニューバーのPdaNetアイコンをクリックする方法を知っていますか?それを選択して[接続]オプションをクリックしますか?

enter image description here

私は次の質問に見えたが、AppleScriptの初心者ですと上のPdaNetのアイコンを検索する方法を確認していないています。ここ

は「PdaNetMac」アプリケーションのメニューバーのアイコンが次のようになりますメニューバー:

  1. Click menu item on Mac OSX Lion using AppleScript
  2. Applescript: on clicking Menu Bar item via gui script
  3. Accessing dock icon right-click menu items with AppleScript

「補助デバイスのアクセスを有効にする」が有効になっていることを確認しました。上記の2番目の質問に基づいて

が、ここではこれを行うに私の現在の試みです:

ignoring application responses 
    tell application "System Events" to tell process "PdaNet" 
     click menu bar item 1 of menu bar 2 
    end tell 
end ignoring 
do shell script "killall System\\ Events" 
delay 0.1 
tell application "System Events" to tell process "PdaNet" 
    tell menu bar item 1 of menu bar 2 
     click menu item "Connect" of menu 1 
    end tell 
end tell 

私はFluxPdaNetを変更すると興味深いことに、上記のスクリプトは、罰金私のために動作します。

ありがとうございます!

答えて

4

あなたは非常に近くでした!

これをテストするためにPdaNetアプリケーションをダウンロードしましたが、スクリプトに加えた唯一の編集は 'PdaNetMac`に変更PdaNetでした(私はこれがプロセス名であると考えていました。アクティビティモニタ)。

だから、これは私の作品:

ignoring application responses 
    tell application "System Events" to tell process "PdaNetMac" 
     click menu bar item 1 of menu bar 2 
    end tell 
end ignoring 
do shell script "killall System\\ Events" 
delay 0.1 
tell application "System Events" to tell process "PdaNetMac" 
    tell menu bar item 1 of menu bar 2 
     click menu item "Connect" of menu 1 
    end tell 
end tell 

が、これはあまりにもあなたのために働くホープ!

(非常に便利なスクリプト、btw。乾杯!)

+0

これは機能します。ありがとうございました !! –

関連する問題