1

問題

AppleScript から、特定のチャット名を探して、Adium チャット ウィンドウ内のすべてのチャットのリストにアクセスしたいのですが、うまくいきません:

Adium の辞書には、[S] Adium > [C] アプリケーション > [E] チャット ウィンドウが含まれます。

私がやりたいと思っていることは、

tell application "System Events"
  tell application "Adium" to activate
  repeat with tw in chat windows of process "Adium"
    repeat with ch in chats of tw
      if name of ch is "nickserv" then
        -- do some stuff
      end if
    end repeat
  end repeat
end tell

しかし、「チャットウィンドウ」への参照で「構文エラー:行末が予想されますが、複数のクラス名が見つかりました」と表示されます。

回答(回答、および今後の作業から)

「システムイベント」からではなく、プロセスから直接ウィンドウリストを取得すると、「複数のクラス名」でのチョークを回避できます。

tell application "System Events"
  repeat with tw in chat windows of process "Adium"
    -- is a syntax error: you're not getting an Adium window, it's a SysEvents window

tell application "Adium"
  repeat with tw in chat windows
    -- works

ただし、「システム イベント」で認識されるウィンドウ (またはチャット ウィンドウ) のプロパティは、Adium で認識されるウィンドウのプロパティとは大きく異なります。私が実際に行っているのは、ウィンドウを画面上に配置することです。システム イベント ウィンドウでは、次のようなことを行います。

set position of tw to {440, 1600}
set size of tw to {993, 578}

...しかし、直接 Adium ウィンドウを使用すると、

set bounds of tw to {440, 1600, 440+993, 1600+578}

Lauri Ranta のコメントで多かれ少なかれほのめかされているように、「プロパティ tw」を振りかけると、これらの違いが明らかになります。

その他の回答

私もそれを見つけました

repeat with tw in (chat windows) of process "Adium"

「ウィンドウのプロパティが異なる」問題ではありませんが、「マルチワード要素名」の問題は解決します。

4

2 に答える 2

1

チャット要素とチャット ウィンドウ要素は、application 要素に含まれています。

tell application "Adium"
    properties of chat "nickserv"
    --chat window "nickserv"
end tell
于 2013-06-06T09:07:56.210 に答える