Shane.
On pages 43 of “Everyday AppleScriptObjC 3.4” the script C9-1 the roundTrip() handler shows an example of handling 2 records. The first record got both items in the list while the second record showed up as empty. I got the same results when typed the same way as the book. When i added 4 pipes it behaved differently.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"
set Record1 to {firstName:"Martin", lastName:"Rohde"}
set Record2 to {|button returned|:"OK", |text returned|:"Hello"}
set Result1 to current application's NSDictionary's dictionaryWithDictionary:Record1 --> (NSDictionary) {firstName:"Martin", lastName:"Rohde"}
set Result2 to current application's NSDictionary's dictionaryWithDictionary:Record2 --> (NSDictionary) {button returned:"OK", text returned:"Hello"}
When I added the pipes both records showed up in the output of roundTrip().
That is to say in the second line in the script, that sets the value of Record2, I changed button returned to |button returned| and text returned to |text returned| and both record showed up while with no added pipes record2 contents vanished. A few lines below the handler the book says “The scripting bridge cannot handle such record entries.” Am I missing something or does this actually work. I am still running El Capitan.
The script returned:
(NSDictionary) {
button returned:“OK”,
text returned:“Hello”
}
The line before the last line returned:
(NSDictionary) {
firstName:“Martin”,
lastName:“Rohde”
}
Bill