youtuber Posted September 12, 2017 Share Posted September 12, 2017 (edited) if needs single error message Multiple line breaks give error the messages! ElseIf Not StringInStr($sitelisturl[$i] <> $aUrlArrayFind2[0],1) Then ConsoleWrite($aUrlArrayFind2[0] & " This site " & "not in rankings") expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 338, 438) $aRankingEdit = GUICtrlCreateEdit("", 32, 32, 225, 193) GUICtrlSetData(-1, "https://www.autoitscript.com/testurlsimilar" & @CRLF & _ "https://www.autoitscript.org/autoitscript2.com/autoitscriptasdf.com" & @CRLF & _ "https://www.autoitscript3.com/autoitscript.com" & @CRLF & _ "https://www.autoitscript2.com/autoitscript5.com/autoitscript.com") $Button1 = GUICtrlCreateButton("Button1", 96, 264, 75, 25) GUISetState(@SW_SHOW) $Count = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $aFindofrowsReadUrl = "https://www.autoitscript.com/test213213" $aUrlArrayFind2 = StringRegExp($aFindofrowsReadUrl, 'https?://[^/]+',1) $sitelisturl = StringSplit(StringStripCR(GUICtrlRead($aRankingEdit)), @LF) For $i = 1 To UBound($sitelisturl) - 1 $sitenamestr = StringRegExp($sitelisturl[$i], 'https?://[^/]+', 1) If StringInStr($sitelisturl[$i], $aUrlArrayFind2[0]) Then ConsoleWrite($sitenamestr[0] & " This site " & $i & "." & "ranking" & @CRLF) ElseIf Not StringInStr($sitelisturl[$i] <> $aUrlArrayFind2[0],1) Then ConsoleWrite($aUrlArrayFind2[0] & " This site " & "not in rankings") EndIf Next EndSwitch WEnd Edited September 12, 2017 by youtuber Link to comment Share on other sites More sharing options...
czardas Posted September 12, 2017 Share Posted September 12, 2017 (edited) This makes no sense to me. ElseIf Not StringInStr($sitelisturl[$i] <> $aUrlArrayFind2[0],1) The following is a case sensitive string search. ElseIf Not StringInStr($sitelisturl[$i], $aUrlArrayFind2[0],1) Then Edited September 12, 2017 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
youtuber Posted September 12, 2017 Author Share Posted September 12, 2017 ElseIf Not StringInStr($sitelisturl[$i], $aUrlArrayFind2[0],1) Then There is no error for this GUICtrlSetData(-1, "https://www.autoitscriptasdf.com/testurlsimilar" & @CRLF & _ "https://www.autoitscript.org/autoitscript2.com/autoitscriptasdf.com" & @CRLF & _ "https://www.autoitscript3.com/autoitscript.com" & @CRLF & _ "https://www.autoitscript2.com/autoitscript5.com/autoitscript.com") Link to comment Share on other sites More sharing options...
czardas Posted September 12, 2017 Share Posted September 12, 2017 (edited) Please explain what you are trying to do, because the code is not making much sense to me. The statement ==> Not StringInStr($sitelisturl[$i] <> $aUrlArrayFind2[0],1) will always be true, even though it's coding nonesense. Edited September 12, 2017 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
youtuber Posted September 12, 2017 Author Share Posted September 12, 2017 (edited) expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 338, 438) $aRankingEdit = GUICtrlCreateEdit("", 32, 32, 225, 193) GUICtrlSetData(-1, "https://www.autoitscriptasdf.com/testurlsimilar" & @CRLF & _ "https://www.autoitscript.org/autoitscript2.com/autoitscriptasdf.com" & @CRLF & _ "https://www.autoitscript3.com/autoitscript.com" & @CRLF & _ "https://www.autoitscript2.com/autoitscript5.com/autoitscript.com") $Button1 = GUICtrlCreateButton("Button1", 96, 264, 75, 25) GUISetState(@SW_SHOW) $Count = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $aFindofrowsReadUrl = "https://www.autoitscript.com/test213213" $aUrlArrayFind2 = StringRegExp($aFindofrowsReadUrl, 'https?://[^/]+',1) $aUrlArrayFind3 = StringRegExp($aFindofrowsReadUrl, '(?:http[s]?://[^/]+)',1) $sitelisturl = StringSplit(StringStripCR(GUICtrlRead($aRankingEdit)), @LF) For $i = 1 To UBound($sitelisturl) - 1 $sitenamestr = StringRegExp($sitelisturl[$i], 'https?://[^/]+', 1) $sitenamestr2 = StringRegExp($sitelisturl[$i], '(?:http[s]?://[^/]+)',1) If StringInStr($sitelisturl[$i], $aUrlArrayFind2[0]) Then ConsoleWrite($sitenamestr[0] & " This site " & $i & "." & "ranking" & @CRLF) ElseIf Not StringInStr($sitenamestr2, $aUrlArrayFind3[0]) Then ConsoleWrite($aUrlArrayFind2[0] & " This site " & "not in rankings") EndIf Next EndSwitch WEnd Edited September 13, 2017 by youtuber Link to comment Share on other sites More sharing options...
czardas Posted September 13, 2017 Share Posted September 13, 2017 (edited) I'm not an expert in regexp. However I think using forward slash as a delimiter is not a good idea for web URLs. Can you change that to use bar | instead? It should make your task a lot easier. Edited September 13, 2017 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
youtuber Posted September 13, 2017 Author Share Posted September 13, 2017 (edited) regex no problem What I mean is that If StringInStr($sitelisturl[$i], $aUrlArrayFind2[0]) Then ConsoleWrite($sitenamestr[0] & " This site " & $i & "." & "ranking" & @CRLF) Else ConsoleWrite($aUrlArrayFind2[0] & " This site " & "not in rankings" & @CRLF);But there is more explanation than one line here EndIf I do not want multiple explanations Edited September 13, 2017 by youtuber 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