#1
|
|||
|
|||
vbs script first-match-and-stopped
Hi Van,
I need you help in doing some script. I´m doing some search in a server files to find IP address match. For example: crt.Screen.Send "isearch -w 172.30.16.226" & chr(13) crt.Screen.WaitForString "-bash-3.2$" crt.Screen.Send "isearch -w 172.30.16.227" & chr(13) crt.Screen.WaitForString "-bash-3.2$" The problem with this script is that i need the script stop on first match e continuous to the next command. May you give some help? Thanks in advance, Alexandre Guia Ferraro |
#2
|
|||
|
|||
Hi Alexandre,
I am not sure I understand what you are trying to accomplish. Quote:
In general, you can exit early if your code lends itself well to being in a looping construct. Or it may be as simple as an If/Then statement: Code:
If "string found" Then ' Do work End If
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
Quote:
I have been studing the ReadString(). Now, I will do some test. Thanks again. Alexandre. |
#4
|
|||
|
|||
Quote:
Yes, i need to know only the first match. This situation stop me to reuse that ip address until the rules will be clear. I have been studing the ReadString(). Now, I will do some test. Thanks again. |
#5
|
|||
|
|||
Hi Alexandre,
So a super simplistic example is: Code:
strText = crt.Screen.ReadString("-bash-3.2$") vLines = Split(strText, vbcrlf) For line in vLines If InStr(line, "string_searching_for") > 0 Then ' Do work Exit For Next ![]()
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#6
|
|||
|
|||
Quote:
I will report back. |
![]() |
Tags |
#first-matchvbscript |
Thread Tools | |
Display Modes | Rate This Thread |
|
|