• Support
  • Articles
  • Resources
  • Products

Open the port, get a ">" and move on

Moderator: boris

4 postsPage 1 of 1

TIgerV
Newbie

Posts:
2
Joined: Fri Oct 25, 2013 12:15 pm
by TIgerV » Fri Oct 25, 2013 12:21 pm
I tried (and failed) at making a simple macro.

All I want to do is:
open Com3, send an [ENTER], wait for a ">" prompt then move on.
open Com4, send an [ENTER], wait for a ">" prompt then move on.
open Com5, send an [ENTER], wait for a ">" prompt then exit.
Trevor
Guru

Posts:
468
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Fri Oct 25, 2013 2:04 pm
Something like this:

Code: Select all

  1. timeout = 20
  2.  
  3. for com_port 3 5
  4.     sprintf2 connect_str "/c=%d" com_port
  5.     connect connect_str
  6.     if result != 2 then
  7.         ; handle connect error
  8.         messagebox "Failed to connect" "Error"
  9.         break
  10.     endif
  11.     flushrecv
  12.     sendln ""
  13.     wait ">"
  14.     if result != 1 then
  15.         ; handle no prompt error
  16.         messagebox "Failed to get '>'" "Error"
  17.         break
  18.     endif
  19.     disconnect
  20.     pause 1
  21. next
  22.  
  23.  
  24. testlink
  25. if result == 2 disconnect


Regards
Trevor
TIgerV
Newbie

Posts:
2
Joined: Fri Oct 25, 2013 12:15 pm
by TIgerV » Fri Oct 25, 2013 3:14 pm
Thank you! I have proven my lack of skill at macros. :-D

How do I tell TTerm to exit when completed?
Everything else is perfect!
Trevor
Guru

Posts:
468
Joined: Wed Jul 26, 2006 8:47 am
by Trevor » Fri Oct 25, 2013 9:42 pm
You're welcome.
To close Tera Term use the closett command:
http://ttssh2.sourceforge.jp/manual/en/macro/command/closett.html

Regards
Trevor
Display posts from previous:
Sort by:

4 postsPage 1 of 1

Users browsing this forum: No registered users