Note that there are some explanatory texts on larger screens.

plurals
  1. POAppleScript multiword element name
    primarykey
    data
    text
    <h1>Problem</h1> <p>From AppleScript, I want to visit the list of all chats in an Adium chat window, looking for a particular chat name, but it doesn't work:</p> <p>Adium's Dictionary includes: [S] Adium > [C] application > [E] chat window</p> <p>What I think I want to do is</p> <pre><code>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 </code></pre> <p>But I get "Syntax Error: Expected end of line but found plural class name" at the reference to "chat windows".</p> <h1>Answer (from responses, and further work)</h1> <p>Getting the window list directly from the process, rather than from "System Events" avoids the choke at "plural class name":</p> <pre><code>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 </code></pre> <p>However, the properties of a window (or chat window) as known to "System Events" are very different from those for a window known to Adium. What I'm actually doing is positioning the window on screen. With a System Events window, I do something like this:</p> <pre><code>set position of tw to {440, 1600} set size of tw to {993, 578} </code></pre> <p>... but with a direct Adium window, it's</p> <pre><code>set bounds of tw to {440, 1600, 440+993, 1600+578} </code></pre> <p>Sprinkling "properties tw" about, as more or less hinted in the comments by Lauri Ranta, reveals these differences.</p> <h1>Other Answer</h1> <p>I also found that</p> <pre><code>repeat with tw in (chat windows) of process "Adium" </code></pre> <p>gets past the "multiword element name" issue, though not the "windows have different properties" one.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload