youtuber Posted October 15, 2017 Posted October 15, 2017 (edited) Hello, I need subdomains But there is no response in GUICtrlSetData($Edit2, $aSubdomain[$i] & @CRLF, 1) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $aListUrl = "https://www.autoitscript.com/forum/" & @crlf & _ 'https://www.autoitscript.com' & @crlf & _ 'https://test.blogspot.com.tr' & @crlf & _ 'https://test.blogspot.com' & @crlf & _ 'http://test.blogspot.com.tr' & @crlf & _ 'http://test.blogspot.com' & @crlf & _ 'test.blogspot.com.tr' $Form1 = GUICreate("Form1", 830, 668) $Edit1 = GUICtrlCreateEdit("", 32, 48, 353, 545) GUICtrlSetData($Edit1, $aListUrl) GUICtrlSetLimit($Edit1, 90000000) $Edit2 = GUICtrlCreateEdit("" & @CRLF, 400, 48, 401, 553, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") GUICtrlSetLimit($Edit2, 90000000) $ExtractSubDomain = GUICtrlCreateButton("Extract", 32, 616, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ExtractSubDomain $TestString = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF, 2) $aSubdomain = StringRegExp($TestString, 'https?:\/\/[\w+\.]+[blogspot.com][blogspot.com.tr]', 3) For $i = 0 To UBound($aSubdomain) - 1 GUICtrlSetData($Edit2, $aSubdomain[$i] & @CRLF, 1) Next EndSwitch WEnd Edited October 15, 2017 by youtuber
kylomas Posted October 16, 2017 Posted October 16, 2017 youtuber, This is what I think you are trying to do. Note sub domain is the 1st node after protocol. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> Global $aListUrl = "https://www.autoitscript.com/forum/" & @CRLF & _ 'https://www.autoitscript.com' & @CRLF & _ 'https://test.blogspot.com.tr' & @CRLF & _ 'https://test.blogspot.com' & @CRLF & _ 'http://test.blogspot.com.tr' & @CRLF & _ 'http://test.blogspot.com' & @CRLF & _ 'test.blogspot.com.tr' $Form1 = GUICreate("Form1", 830, 668) $Edit1 = GUICtrlCreateEdit("", 32, 48, 353, 545) GUICtrlSetData($Edit1, $aListUrl) GUICtrlSetLimit($Edit1, 90000000) $Edit2 = GUICtrlCreateEdit("" & @CRLF, 400, 48, 401, 553, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") GUICtrlSetLimit($Edit2, 90000000) $ExtractSubDomain = GUICtrlCreateButton("Extract", 32, 616, 75, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) ControlFocus('', '', $ExtractSubDomain) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ; this works and follows the technique you were using ;~ Case $ExtractSubDomain ;~ $TestString = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF, 2) ;~ ;_ArrayDisplay($TestString) ;~ For $i = 0 To UBound($TestString) - 1 ;~ $sSubdomain = StringRegExp($TestString[$i], '(?:https?:\/\/)?(.*?)\.', 3) ;~ If Not @error Then GUICtrlSetData($Edit2, $sSubdomain[0] & @CRLF, 1) ;~ Next ; This is a cleaner, more efficient way Case $ExtractSubDomain $aSubdomain = StringRegExp($aListUrl, '(?im)^(?:https?:\/\/)?(.*?)\.', 3) For $i = 0 To UBound($aSubdomain) - 1 GUICtrlSetData($Edit2, $aSubdomain[$i] & @CRLF, 1) Next EndSwitch WEnd I corrected several mistakes in your code, most notably, trying to reference an array as a simple variable (no index) $aSubdomain = StringRegExp($TestString, 'https?:\/\/[\w+\.]+[blogspot.com][blogspot.com.tr]', 3) Did you read the comments I wrote in your previous threads regarding variable naming conventions? You will find more willing help if you try to use them. kylomas youtuber 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
youtuber Posted October 16, 2017 Author Posted October 16, 2017 http https including www What I need is https://test.blogspot.com.tr https://test.blogspot.com http://test.blogspot.com.tr http://test.blogspot.com test.blogspot.com.tr test.blogspot.com or www.asdf.blogspot.com www.asdf.blogspot.com.tr https://www.test.blogspot.com.tr https://www.test.blogspot.com
ripdad Posted October 16, 2017 Posted October 16, 2017 (edited) youtuber, It's not making any sense. You will have to be more specific. Edited October 16, 2017 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward
youtuber Posted October 16, 2017 Author Posted October 16, 2017 (edited) @ripdadI indicated with the arrow mark what I needed Spoiler Edited October 16, 2017 by youtuber
kylomas Posted October 16, 2017 Posted October 16, 2017 youtuber, You want all url's with "BlogSpot"? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
ripdad Posted October 16, 2017 Posted October 16, 2017 youtuber, And where is the entries for autoitscript.com? "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward
Danp2 Posted October 16, 2017 Posted October 16, 2017 @ripdad I'm guessing that those were excluded because they didn't contain a subdomain. Is that correct @youtuber? youtuber 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
youtuber Posted October 16, 2017 Author Posted October 16, 2017 (edited) 6 minutes ago, kylomas said: youtuber, You want all url's with "BlogSpot"? kylomas Yes I want all blogspot URLs Spoiler Edited October 16, 2017 by youtuber
kylomas Posted October 16, 2017 Posted October 16, 2017 youtuber, Just change the SRE... expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> Global $aListUrl = "https://www.autoitscript.com/forum/" & @CRLF & _ 'https://www.autoitscript.com' & @CRLF & _ 'https://test.blogspot.com.tr' & @CRLF & _ 'https://test.blogspot.com' & @CRLF & _ 'http://test.blogspot.com.tr' & @CRLF & _ 'http://test.blogspot.com' & @CRLF & _ 'test.blogspot.com.tr' $Form1 = GUICreate("Form1", 830, 668) $Edit1 = GUICtrlCreateEdit("", 32, 48, 353, 545) GUICtrlSetData($Edit1, $aListUrl) GUICtrlSetLimit($Edit1, 90000000) $Edit2 = GUICtrlCreateEdit("" & @CRLF, 400, 48, 401, 553, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") GUICtrlSetLimit($Edit2, 90000000) $ExtractSubDomain = GUICtrlCreateButton("Extract", 32, 616, 75, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) ControlFocus('', '', $ExtractSubDomain) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ; this works and follows the technique you were using ;~ Case $ExtractSubDomain ;~ $TestString = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF, 2) ;~ ;_ArrayDisplay($TestString) ;~ For $i = 0 To UBound($TestString) - 1 ;~ $sSubdomain = StringRegExp($TestString[$i], '(?:https?:\/\/)?(.*?)\.', 3) ;~ If Not @error Then GUICtrlSetData($Edit2, $sSubdomain[0] & @CRLF, 1) ;~ Next ; This is a cleaner, more efficient way Case $ExtractSubDomain ;$aSubdomain = StringRegExp($aListUrl, '(?im)^(?:https?:\/\/)?(.*?)\.', 3) $aSubdomain = StringRegExp($aListUrl, '.*?blogspot.*', 3) For $i = 0 To UBound($aSubdomain) - 1 GUICtrlSetData($Edit2, $aSubdomain[$i] & @CRLF, 1) Next EndSwitch WEnd kylomas youtuber 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
youtuber Posted October 16, 2017 Author Posted October 16, 2017 @kylomas Thank you Is my arrangement correct? expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> Global $aListUrl = "https://www.autoitscript.com/forum/" & @CRLF & _ 'https://www.autoitscript.com' & @CRLF & _ 'https://test.blogspot.com.tr' & @CRLF & _ 'https://test.blogspot.com' & @CRLF & _ 'http://test.blogspot.com.tr/asdfasdf' & @CRLF & _ 'http://test.blogspot.com' & @CRLF & _ 'test.blogspot.com.tr' $Form1 = GUICreate("Form1", 830, 668) $Edit1 = GUICtrlCreateEdit("", 32, 48, 353, 545) GUICtrlSetData($Edit1, $aListUrl) $Edit2 = GUICtrlCreateEdit("" & @CRLF, 400, 48, 401, 553, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") $ExtractSubDomain = GUICtrlCreateButton("Extract", 32, 616, 75, 25, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) ControlFocus('', '', $ExtractSubDomain) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ExtractSubDomain $TestString = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF, 2) ;_ArrayDisplay($TestString) For $i = 0 To UBound($TestString) - 1 $sSubdomain = StringRegExp($TestString[$i], '.*?blogspot.*', 3) If Not @error Then GUICtrlSetData($Edit2, $sSubdomain[0] & @CRLF, 1) Next EndSwitch WEnd
kylomas Posted October 16, 2017 Posted October 16, 2017 youtuber, Yes, for that source. kylomas youtuber 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
ripdad Posted October 16, 2017 Posted October 16, 2017 Danp2, Ok. kylomas, Thanks youtuber, Glad you got it worked out. youtuber 1 "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward
kylomas Posted October 16, 2017 Posted October 16, 2017 youtuber, Are you reading what I post and the comments in the code? kylomas youtuber 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
youtuber Posted October 16, 2017 Author Posted October 16, 2017 Yes, I respect your notes, I respect you, thank you I read it again and again my english is not very good but i'm trying to learn
kylomas Posted October 16, 2017 Posted October 16, 2017 youtuber, No problem, I suspected a language issue. Let me encourage you to read the wiki articles regarding arrays. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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