• Support
  • Articles
  • Resources
  • Products

How to put a content of a string on variable

Moderator: boris

5 postsPage 1 of 1

filegam
Newbie

Posts:
9
Joined: Thu Feb 07, 2013 4:53 pm
by filegam » Mon Nov 14, 2016 6:24 pm
Hello people,

Have a question and I would like to ask your help.

My question is simple, on script , How to put the content dm3000_nwy_17 in the variable msg

Code: Select all

  1. ;=====================================
  2. ; Start
  3. dm3000_nwy_10 = ' telnet 200.3.155.37'
  4. dm3000_nwy_11 = ' telnet 200.3.155.7'
  5. dm3000_nwy_12 = ' telnet 200.3.155.8'
  6. dm3000_nwy_16 = ' telnet 200.3.154.50'
  7. dm3000_nwy_17 = ' telnet 200.3.155.117'
  8. dm3000_nwy_19 = ' telnet 200.3.155.118'
  9. dm3000_nwy_21 = ' telnet 200.3.155.127'
  10. dm3000_nwy_24 = ' telnet 200.3.155.31'
  11. dm3000_nwy_27 = ' telnet 200.3.155.128'
  12. dm3000_nwy_32 = ' telnet 200.3.155.35'
  13. . other elements
  14. . other elements
  15. dm3000_nwy_100 =' telnet 200.4.28.12'
  16. ;
  17. inputbox 'Hit Switch ' '_Acesso_'                              ; for example i hit dm3000_nwy_17
  18. B = inputstr
  19. ;
  20. ;                  ?? how to put a content of dm3000_nwy_17 on msg
  21. ;
  22. connect msg
  23. ;
  24. ;################################################


thanks in advance,
best regards,
Magno
dpena
Coach

Posts:
144
Joined: Thu Jul 09, 2009 6:14 pm
by dpena » Mon Nov 14, 2016 11:54 pm
This may work: :smile:

Code: Select all

  1.  
  2.     ;=====================================
  3.     ; Start
  4.     strdim dm3000_nwy 10
  5.     dm3000_nwy[0]  = 'telnet 200.3.155.37'
  6.     dm3000_nwy[1]  = 'telnet 200.3.155.7'
  7.     dm3000_nwy[2]  = 'telnet 200.3.155.8'
  8.     dm3000_nwy[3]  = 'telnet 200.3.154.50'
  9.     dm3000_nwy[4]  = 'telnet 200.3.155.117'
  10.     dm3000_nwy[5]  = 'telnet 200.3.155.118'
  11.     dm3000_nwy[6]  = 'telnet 200.3.155.127'
  12.     dm3000_nwy[7]  = 'telnet 200.3.155.31'
  13.     dm3000_nwy[8]  = 'telnet 200.3.155.128'
  14.     dm3000_nwy[9]  = 'telnet 200.3.155.35'
  15.     ;
  16.     inputbox 'Hit Switch ' '_Acesso_'      ; for example i hit dm3000_nwy_17
  17.     str2int B inputstr
  18.  
  19.     ;
  20.     ;                  ?? how to put a content of dm3000_nwy_17 on msg
  21.     ;
  22.     connect dm3000_nwy[B]
  23.     ;
  24.     ;################################################
  25.  
filegam
Newbie

Posts:
9
Joined: Thu Feb 07, 2013 4:53 pm
by filegam » Tue Nov 15, 2016 4:21 pm
Hello Dpena,

Thanks for your reply,

Note that the list is not in sequence

But in fact what I would like is to have a list with the network elements and their addresses, and i need make a telnet for them without having to worry about the ip address ,

I have other elements but isn't in sequence, for exemple

dm3001 =' telnet 10.10.14.23'
dm4000 =' telnet 10.20.14.23'
dm4001 =' telnet 10.10.14.23'
dm4004 =' telnet 10.30.14.23'
dm880 =' telnet 10.40.14.23'

I would like to enter the name of the element , search in table above and make telnet to ip of it, like a dns,

thanks,
Best Regards,
Magno
IshmaelCallMe
Guru

Posts:
672
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Tue Nov 15, 2016 9:06 pm
I think the only way to do that kind of indirection in TeraTERM is via the execcmnd command.

sprintf2 com "msg=%s" B
execcmnd com

Should do the trick.
filegam
Newbie

Posts:
9
Joined: Thu Feb 07, 2013 4:53 pm
by filegam » Wed Nov 16, 2016 1:20 pm
Hi,

My thanks to IshmaelCallMe and to DPENA

The ideas were great, and the script worked perfectly,

I make a connection to a server and from it I connect in one element of the list,

The final script stayed like this,

Thank you,
My Best Regards,
filegam....

Code: Select all

  1. ;===================Start======================
  2. server = '100.120.193.50 /nossh' ; Connect a server
  3. connect server
  4. ;
  5. UsernamePrompt = 'login:'
  6. ;Username = 'xxxxxx'
  7. PasswordPrompt = 'Password:'
  8. Password = 'xxxxxx'
  9. ;
  10. wait   UsernamePrompt
  11. sendln Username
  12. ;
  13. wait   PasswordPrompt
  14. sendln Password
  15. ;===============================================================
  16. ;  above list of networks elements
  17. dm5000_dallba_01 =' telnet 201.134.155.11 '
  18. dm6000_setciv_01 =' telnet 201.134.155.37 '
  19. ; . other elements
  20. ; . other elements
  21. dm7000_nwy0mz_01 =' telnet 201.134.155.118 '
  22. dm8000_nwyarb_01 =' telnet 201.134.155.35 '
  23. dm1000_nwyjm_13 =' telnet 201.134.155.34 '
  24. dm3224f2_chymc_02 =' telnet 201.134.154.61 '
  25. dm4001_dall0i9_01 =' telnet 201.134.155.2 '
  26. dmsw_nwyjm_dv01 =' telnet 10.18.146.38 '
  27. ;
  28. :logins
  29. inputbox 'Hit Network Element Name' 'Router/Switch/Server' ; for exemple i hit dm7000_nwy0mz_01
  30. B = inputstr
  31. sprintf2 com "msg=%s" B
  32. execcmnd com
  33. ;
  34. sendln msg  ; here LTT sendln telnet 201.134.155.118
  35. ;
  36. UsernamePrompt = 'login:'
  37. Username = 'xxxxx'
  38. PasswordPrompt = 'Password:'
  39. Password = 'xxxx'
  40. wait   UsernamePrompt
  41. sendln Username
  42. ;
  43. wait   PasswordPrompt
  44. sendln Password
  45. ;===============================================================
Display posts from previous:
Sort by:

5 postsPage 1 of 1

Users browsing this forum: No registered users