litecold Posted October 24, 2014 Share Posted October 24, 2014 (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 October 24, 2014 by litecold Link to comment Share on other sites More sharing options...
Danp2 Posted October 24, 2014 Share Posted October 24, 2014 Not tested, but I believe either of the following would work: If Not StringInStr($read_link, $searchstring1) Or Not StringInStr($read_link, $searchstring2) Then If Not (StringInStr($read_link, $searchstring1) Or StringInStr($read_link, $searchstring2)) Then Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jdelaney Posted October 24, 2014 Share Posted October 24, 2014 (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 October 24, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now