Possible Causes and Fixes: Incorrect COM Port Selection Handling
The connect command needs a string as an argument. In your script, com_port is an integer. Try using strconcat to convert the number into a string before passing it to connect. Fix: strconcat inputstr "/C=" strconcat inputstr com_port connect inputstr