Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><code>argv</code> is always initialized to a list.</li> <li>You cannot keystroke a list (you have to coerce each item to a string first).</li> <li><p>You can never tell the exact number of parameters that will be sent to the script, so a better route would be to iterate through the list and do whatever needs to be done, as shown below:</p> <pre><code>tell application "System Events" tell process "Sparrow" key code 3 using {command down, option down} repeat with this_item in argv keystroke (this_item as string) end repeat end tell end tell </code></pre></li> </ol> <hr> <p>@Runar </p> <ol> <li>The script is implying that Sparrow is already activated.</li> <li><p>You can't do this as written (the result of <code>every text item of argv</code> is still a list). However, if you coerce the result into a string, this will work, but it will squash everything together (assuming <code>AppleScript's text item delimiters</code> is <code>""</code>). If you <code>set AppleScript's text item delimiters to space</code>, then this would actually be better than the previous script...</p> <pre><code>on run argv tell application "Sparrow" to activate tell application "System Events" tell process "Sparrow" --implying Sparrow is already activated set prevTIDs to AppleScript's text item delimiters key code 3 using {command down, option down} set AppleScript's text item delimiters to space keystroke (every text item of argv) as string set AppleScript's text item delimiters to prevTIDs end tell end tell end run </code></pre></li> </ol>
 

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