What happened to "getProp"?

Continuing the discussion from [eggPlant Functional] Useful SenseTalk Functions:

Whenever I’m inspired to try using a “getProp” handler, I get the following message on save:
image
“NSInvalidArgumentException Tried to add nil to array”

I can see that getProp is still a senseTalk keyword, but Todd’s thread about useful functions was posted in 2008. Has getProp been deprecated? Or is there some rule I’m unaware of about setting up a script that will contain at least one getProp?

I figured out that if I add an “<any>” handler, the error goes away. My handler is slightly more complex than the one below, but if you’re having this error try adding these 3 lines to the script that contains a “getProp” handler:

on <any>
pass message
end on <any>
As I said, my "any" handler does more than "pass message", but if you read up on <any> in docs.eggplantsoftware.com, it might give you some ideas that are suited to your own situation. If a simple "pass message" doesn't cause any problems for you, though... I recommend applying the KISS principle.

GetProp works fine and has not been deprecated — feel free to use it. There does seem to be a bug that will display an error message when saving a script with a getProp handler. It appears the problem was inadvertently introduced when the script checker was added (and wasn’t noticed because getProp handlers are rarely used), but it doesn’t seem to prevent things from working.

It sounds like you’ve discovered an interesting workaround which prevents the annoying error message from popping up. I think we’ll probably implement a fix for this soon, so hopefully that won’t be necessary any more.

1 Like