Looks like I'm seeing a string I pull from the Windows clipboard causing occasional early execution of the line I am trying to construct and transmit. I think it's coming from a <CR> at end of the highlighted string and it's difficult in windows sometimes to copy a string at the end of a line - you can't see if you are including a hidden <CR> in the copied data.
Any help or suggestions welcomed. Here's what I am using now:
;RESET Modem using ID data from clipboard
proc main
string endOfMAC ; set string from the clipboard looking for XX.XXXX
usermsg "RESET MODEM: Highlight last 6 digits of MAC in format XX.XXXX."
cliptostr endOfMAC ; copy mixed alpha-numeric string from the clipboard
strlwr endOfMAC ; convert string to lower case
transmit "^M"
waitfor "#" ; make sure command prompt is ready
; transmits constructed string "clear cable modem 0090.83xx.xxxx reset^M"
; occasional problem seems to be <CR> captured in end of paste string
; causes command to execute as "clear cable modem 0090.83xx.xxxx^M" then " reset^M"
transmit "clear cable modem 0090.83"
transmit endOfMAC
transmit " reset^M"
pause 1
waitfor "#"
pause 2
usermsg "Modem RESET completed" ; ack completed process
;pwexit ; uncomment to autoclose session if desired
endproc
I think what I need to do is strip the <CR>. Even better I'd love to be able to validate the string is the correct format of XX.XXXX and pop a usermsg to copy the data to clipboard again if it doesn't fit that template, but I have no idea how to do this.
Is there a way to construct a transmit command using multiple strings on one transmit line?
for example:
transmit "xxxxxxxx"String "xxxxxxxx"
Or am corect in assuming I need to do multiple transmit lines to construct the line I want? I'm guessing I could probably also constrcut a larger string incorporating the cliptostr in it but didn't know how and this seems to do what I need. And I'd probably have the same issue with a hidden ^M in the string anyway.
Any help or suggestions welcomed. Here's what I am using now:
;RESET Modem using ID data from clipboard
proc main
string endOfMAC ; set string from the clipboard looking for XX.XXXX
usermsg "RESET MODEM: Highlight last 6 digits of MAC in format XX.XXXX."
cliptostr endOfMAC ; copy mixed alpha-numeric string from the clipboard
strlwr endOfMAC ; convert string to lower case
transmit "^M"
waitfor "#" ; make sure command prompt is ready
; transmits constructed string "clear cable modem 0090.83xx.xxxx reset^M"
; occasional problem seems to be <CR> captured in end of paste string
; causes command to execute as "clear cable modem 0090.83xx.xxxx^M" then " reset^M"
transmit "clear cable modem 0090.83"
transmit endOfMAC
transmit " reset^M"
pause 1
waitfor "#"
pause 2
usermsg "Modem RESET completed" ; ack completed process
;pwexit ; uncomment to autoclose session if desired
endproc
I think what I need to do is strip the <CR>. Even better I'd love to be able to validate the string is the correct format of XX.XXXX and pop a usermsg to copy the data to clipboard again if it doesn't fit that template, but I have no idea how to do this.
Is there a way to construct a transmit command using multiple strings on one transmit line?
for example:
transmit "xxxxxxxx"String "xxxxxxxx"
Or am corect in assuming I need to do multiple transmit lines to construct the line I want? I'm guessing I could probably also constrcut a larger string incorporating the cliptostr in it but didn't know how and this seems to do what I need. And I'd probably have the same issue with a hidden ^M in the string anyway.