Sign in to follow this  
Followers 0
litecold

If not for 2 checks

3 posts in this topic

#1 ·  Posted (edited)

$searchstring1 = "2394JF"
$searchstring2 = "9345DC"

$read_link = clipget()

If Not StringInStr($read_link, $searchstring1) Or StringInStr($read_link, $searchstring2) Then

Here's my code, the problem is I want to do this on a single line, and it works fine if I use: "if not for the first : "If Not StringInStr($read_link, $searchstring1)"

But I also wanna use if not, for the next check, something like: 

If Not StringInStr($read_link, $searchstring1) Or if not StringInStr($read_link, $searchstring2) Then

But that causes a syntex error, does someone got a suggestion :)?

Edited by litecold

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Or do a regexp:

$searchstring1 = "2394JF"
$searchstring2 = "9345DC"

ClipPut("blah2394JF")
$read_link = clipget()
If Not StringRegExp($read_link, $searchstring1 & "|" & $searchstring2,0) Then
    ConsoleWrite("no match" & @CRLF)
Else
    ConsoleWrite("match" & @CRLF)
EndIf

ClipPut("blah9345DC")
$read_link = clipget()
If Not StringRegExp($read_link, $searchstring1 & "|" & $searchstring2,0) Then
    ConsoleWrite("no match" & @CRLF)
Else
    ConsoleWrite("match" & @CRLF)
EndIf

ClipPut("blah239")
$read_link = clipget()
If Not StringRegExp($read_link, $searchstring1 & "|" & $searchstring2,0) Then
    ConsoleWrite("no match" & @CRLF)
Else
    ConsoleWrite("match" & @CRLF)
EndIf

output:

match
match
no match

Your way, you would probably want "if not blah and not blah"...that would enter the block if both strings were not found.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0