horne Posted August 6, 2012 Author Posted August 6, 2012 No, see what i post i need only the content in <span class="title"> !CONTENT I NEED! </span> nothing more.
Moderators Melba23 Posted August 6, 2012 Moderators Posted August 6, 2012 horne, Then amend the line to read: $aExtract = StringRegExp($sHTML, '(?U)<span class="title">(.*)</span>', 3) No, see what i postAnd with that attitude that is the end of my assistance. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
horne Posted August 6, 2012 Author Posted August 6, 2012 It still output the whole HTML code, not the content i want between the title span. When i find way out i will post.
horne Posted August 6, 2012 Author Posted August 6, 2012 I`ve got it, it must be used _StringBetween, the problem now is that its return me nothing, unless it used with _ArrayDisplay hmmmm.....I will have to work on it.some testing code#include <IE.au3> #include <String.au3> #include <Array.au3> Local $vboxcode = InputBox("Vbox7 downloader", "Enter vbox7 code.", "", " ") Local $oIE = _IECreate ($vboxcode, 0, 0, 1, 0) Local $sHTML = _IEBodyReadHTML($oIE) ;###Local $sExtract2 = StringRegExpReplace($sHTML, '(?U)<span class="title">(.*)</span>', "$1") Local $sExtract3 = _StringBetween($sHTML,'<span class="title">','</span>') Local $extractarray = _ArrayDisplay($sExtract3, 'Default Search') _IEQuit($oIE) ;###MsgBox(0, "Test", $sExtract2, 1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sExtract2 = ' & $sExtract3 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $extractarray = ' & $extractarray & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
DicatoroftheUSA Posted August 6, 2012 Posted August 6, 2012 (edited) I`ve got it, it must be used _StringBetween, the problem now is that its return me nothing, unless it used with _ArrayDisplay hmmmm.....I will have to work on it.some testing code...Stringregex works fine. I posted a tool so you rapidly test expressions to see how it works. You gave no indication of trying it. It really is not too hard as long as it is the right tool for the job, in this case it is. Anything can be hard when you decide not to understand it.The help file is your friend. The way you are going about things, soon may be your only friend. Edited August 6, 2012 by DicatoroftheUSA Statism is violence, Taxation is theft. Autoit Wiki
horne Posted August 6, 2012 Author Posted August 6, 2012 Lol, strange i can`t see how i offended you guys, seems i have in some kind of a way, i appreciate the help and the support you give DicatoroftheUSA i am already using the tooland i am using a lot the help ! Actually this is the way i am learning this language ... The the point i am trying to reach is that Stringregex and Stringregexpreplace are for cutting something from the array or at least that is what i am understanding and seeing from the tests. But i need ONLY the code between the <span class="title"> which in our case is the name of the video from the webpage ...so i am trying to get like $var = "Name of the video"When i use _StringBetween it gives me exatly what i need, but i dont know how to output it in variable.Apologise again if somehow i ofended someone i am total rookie here
horne Posted August 6, 2012 Author Posted August 6, 2012 Here it is the fully working code: #include <IE.au3> #include <String.au3> #include <Array.au3> Local $vboxcode = InputBox("Vbox7 downloader", "Enter vbox7 code.", "", " ") Local $oIE = _IECreate ($vboxcode, 0, 0, 1, 0) Local $sHTML = _IEBodyReadHTML($oIE) Local $sExtract3 = _StringBetween($sHTML,'<span class="title">','</span>') Local $extractarray2 = _ArrayToString($sExtract3) _IEQuit($oIE) MsgBox(4096, "Videoname", $extractarray2, 10)
Moderators Melba23 Posted August 6, 2012 Moderators Posted August 6, 2012 horne,Apology accepted. I have looked at the HTML returned and this more specific pattern works for me on the only <span class="title"> I can find in there:$aRet = StringRegExp($sHTML, '<div class="titleBar_Title"><span class="title">(.*)</span></div>', 3) If IsArray($aRet) Then ConsoleWrite($aRet[0] & @CRLF) Else ConsoleWrite("Nowt" & @CRLF) EndIfDoes that give you the string you are looking for? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Moderators Melba23 Posted August 6, 2012 Moderators Posted August 6, 2012 horne, Glad we got there in the end. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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