(disclaimer: I tried 1st to post this in the Unscripted forum but the “Post new topic” button was not to be found at the top of the page. :/)
While testing a pair of scripts I ran into something unfamiliar; an invisible item in an apparently empty list!
1. My ‘Applescript.app’ uses ‘run script’ to call my ‘beep.scpt’ into action.
2. ‘beep.scpt’ is nothing more than the word ‘beep’, so it does that nicely.
3. ‘Applescript.app’ receives no result from ‘beep.scpt’ (because there was nothing to return).
4. Since ‘Applescript.app’ also calls other scripts which (unlike ‘beep.scpt’)
may return something, it uses this sloppy trick* to catch any non-result…
set rslts to {} & (run script posixPathToOtherScript)--some return some do not.
...
5. What I see ''returned'' in Script Editor (Version 2.9 (191), AppleScript 2.5) is
either [1.] an empty set of brackets ( {} from 'beep.scpt' )
or [2.] properly bracketed text or numbers from other scripts.
6. But, when I ask for the count of the empty list from 'beep.scpt',
it mysteriously claims [b]the empty set has 1 item![/b]
7. A display dialog test of item 1 of the empty bracket revealed that
this invisible item's class is "capp". However, the following tests return more mystery...
set rslts to {} & (run script posixPathToOtherScript) ---
say (count of rslts)--says 1
say rslts is {}--says false
say (class of item 1 of rslts) as text is "capp"--says false
display dialog class of (item 1 of rslts)--displays "capp"
say (item 1 of rslts)-- err "Can’t make current application into type text."
return properties of item 1 of (rslts as list)--err "Can’t get properties."
Can anyone shed some light on this one? What is class "capp"?...
Thanks in advance.
[i]*Yes, I could trap it some other way.[/i]
Model: Mac Pro
AppleScript: 2.9
Browser: Safari 602.1.50
Operating System: macOS 10.14