where [.]Port Number = "GigabitEthernet1/0/1"
looking for evaluate to "1"
but doesn't work like this. I suspect it is how I am calling args[0] but not sure how to fix.
It is terrible to modify the string that runScript uses. What you are trying to do with the first expression is precisely what my objectScript() expression function supports, including using args in that fashion. (But omitting the polling interval.)
When IA added the ability to pass args to runScript() in v7.8.0 (note the comment in that changelog), they chose to not support one-liners with an args tuples, but instead require the string to name a function or method that would implicitly receive the args tuple.
Your choices are:
Move the split operation into a function in your gateway scripting project's script library and call with runScript()'s arg-passing syntax, or
Continue using the very non-optimal string contortions, or
Install my Simulation Aids module and use objectScript().
Use Kevin's expression, but be aware that if {[.]Port Number} changes while the expression is executing, you can get a broken result.
thanks, Using Kevins solution. In this case I am not concerned with changing value since it should be set when first instanced and shouldn't change after that.