2011-08-01 9 views
0

で、現在のAdobe Readerのウィンドウタイトルを取得し、私はそれがうまく働いているが、私は日干しにFirefoxのを変更したときに、私は次のエラーを取得するのAppleScript

tell application "Firefox" 
    set window_name to name of front window 
    display dialog window_name 

end tell 

、Firefoxウィンドウのタイトルを取得するために、次のコードを書きました

「Adobe Readerでエラーが発生しました:ウィンドウ1の名前を取得できません。

どのようにウィンドウタイトルを取得するか知っていますか?

答えて

1

質問に答えが書かれました!

tell application "System Events" to set adobe_windows to (get the title of every window of every process whose name contains "Adobe") as list 
set prevTIDs to AppleScript's text item delimiters 
set AppleScript's text item delimiters to {", "} 
set adobe_windows to adobe_windows as string 
display dialog adobe_windows 
set AppleScript's text item delimiters to prevTIDs 

ウィンドウタイトルを参照するときにエラーが発生した場合は、System Eventsにアクセスしてください。これはFinderにも当てはまります! System Eventsは、Finderが行うことができるすべてのことを行うことができます。ご不明な点がございましたら、お気軽にお問い合わせください。 :)

+0

私はAppleScriptの新機能ですので、私はさらに調査します(私は空の文字列を取得していますが、私はあなたに気を遣う前に宿題をします:))乾杯 – Pompon

+0

@ポンポンスクリプトを実行する前にAdobeが実際に開いていることを確認してください。それ以外の場合は、空の文字列を返します。 Adobeが本当に開いていて、まだ*空の文字列で返ってきたら、私に教えてください。私はあなたの答えを更新します。 :) – fireshadow52

+0

アドビリーダーが開いていて、スクリプトが空の文字列を返していますので、ありがとうございます。 – Pompon