koszmail2 Posted August 13, 2012 Share Posted August 13, 2012 (edited) Hi , i want copy from site like: pytajnia.pl or google.pl name of website. In html code is inside <title></title>.... How copy it? this under not working Func Spis() $oie=_IECreate("http://www.pytajnia.pl/dzial/pytania/pokaz/"&$x&"/antyban.pl",0,0,0,0) _IELoadWait($oie) x = 1337 $html=_IEBodyReadHTML($oie) $betwen=_StringBetween($html,'<head>','</head>') For $y=0 to UBound($betwen)-1 $trim=StringTrimLeft($betwen[$y],5) $replace=StringReplace($trim,"-"," ") FileWriteline("pytania_spisane2.txt", $replace&@CRLF) $sSource = $html $sExtract = StringRegExpReplace($sSource, ".*<head>(.*)</head>.*", "$1") ConsoleWrite($sExtract & @CRLF) Next _IEQuit($oie) $file=FileRead("pytania_spisane2.txt") sleep(3000) Spis() EndFunc And someone can tell me when function working 20 seconds inside alt+ctrl+del window i se 100x iexprolers? Edited August 13, 2012 by koszmail2 Link to comment Share on other sites More sharing options...
Beege Posted August 13, 2012 Share Posted August 13, 2012 Hi , i want copy from site like: pytajnia.pl or google.pl name of website. In html code is inside <title></title>.... How copy it? this under not working Func Spis() $oie=_IECreate("http://www.pytajnia.pl/dzial/pytania/pokaz/"&$x&"/antyban.pl",0,0,0,0) _IELoadWait($oie) x = 1337 $html=_IEBodyReadHTML($oie) $betwen=_StringBetween($html,'<head>','</head>') For $y=0 to UBound($betwen)-1 $trim=StringTrimLeft($betwen[$y],5) $replace=StringReplace($trim,"-"," ") FileWriteline("pytania_spisane2.txt", $replace&@CRLF) $sSource = $html $sExtract = StringRegExpReplace($sSource, ".*<head>(.*)</head>.*", "$1") ConsoleWrite($sExtract & @CRLF) Next _IEQuit($oie) $file=FileRead("pytania_spisane2.txt") sleep(3000) Spis() EndFunc And someone can tell me when function working 20 seconds inside alt+ctrl+del window i se 100x iexprolers? Hello! Why are you calling this recursivly? Im pretty sure this would just go forever? $file=FileRead("pytania_spisane2.txt") sleep(3000) Spis() <------------------- ??? EndFunc And do you mean between <head>? not <Title>? Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
koszmail2 Posted August 13, 2012 Author Share Posted August 13, 2012 Hello! Why are you calling this recursivly? Im pretty sure this would just go forever? $file=FileRead("pytania_spisane2.txt") sleep(3000) Spis() <------------------- ??? EndFunc And do you mean between <head>? not <Title>? Yes, like you see. You have same problem or you just trolling and offtoping? Link to comment Share on other sites More sharing options...
BrewManNH Posted August 13, 2012 Share Posted August 13, 2012 Your problem is that your function is needlessly calling itself over and over again, it's going to crash the script eventually. Plus, what isn't working as you're expecting it to? Because you're not explaining well what isn't working, and what you want to do with the information from the page. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Beege Posted August 13, 2012 Share Posted August 13, 2012 Trolling? Right.. Anyway. You shouldnt be calling the function from within the function. That will create a endless loop. No where in the code are you searching for string between <title></title> so thats why I ask. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
koszmail2 Posted August 13, 2012 Author Share Posted August 13, 2012 Trolling? Right.. Anyway. You shouldnt be calling the function from within the function. That will create a endless loop. No where in the code are you searching for string between <title></title> so thats why I ask.Right, but even i tryed to put <title> where are <head> now. You should know it. I have last post.http://pl.twitch.tv/czarnybarasI need put inside pause script anyway.Ok. Script should generate link > check link > and copy title/head/meta For what? Just trying some tricks. And anyway, i try a lot things with this dramma function "Stringsbetwen" and not working anyway. Just givme a lesson Sir. Link to comment Share on other sites More sharing options...
Beege Posted August 13, 2012 Share Posted August 13, 2012 (edited) Well the example is incomplete. For an example just post a direct link. Break it down to the exact spot that your script stops working. Also it you have direct links and the web site does not require a log in, I alway use _inetgetsource. Makes it alot simpler. So here we go. This assumes the link is http://www.pytajnia.pl/dzial/pytania/pokaz/1337/antyban.pl#include <Inet.au3> #include <String.au3> $x = 1337 $link = 'http://www.pytajnia.pl/dzial/pytania/pokaz/' & $x & '/antyban.pl' $source = _INetGetSource($link) $aTitle = _StringBetween($source, '<title>', '</title>') ConsoleWrite($aTitle[0] & @LF)Output: Pytajnia.pl - Pytanie do chłopaków. Edited August 13, 2012 by Beege Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
koszmail2 Posted August 15, 2012 Author Share Posted August 15, 2012 (edited) How this should work with this code html:<a href="/pyt/23204/XXJJE/jak-sciagnac-fotoszopa">Jak ściągnąć fotoszopa??</a>The 23204 and XXJJE are random. Things what i need from this code with underline.XXJJE + Jak ściągnąć fotoszopa?? Edited August 15, 2012 by koszmail2 Link to comment Share on other sites More sharing options...
Shane0000 Posted August 15, 2012 Share Posted August 15, 2012 This should pull them out $sHTML = '<a href="/pyt/23204/XXJJE/jak-sciagnac-fotoszopa">Jak sciagnac fotoszopa??</a>' $sData1 = StringMid($sHTML,StringInStr($sHTML,'/','',3)+1,StringInStr($sHTML,'/','',4)-StringInStr($sHTML,'/','',3)-1) $sData2 = StringMid($sHTML,StringInStr($sHTML,'>','')+1,StringInStr($sHTML,'<','',2)-StringInStr($sHTML,'>','')-1) Msgbox(0,'$sData1',$sData1&@CRLF&$sData2) Link to comment Share on other sites More sharing options...
koszmail2 Posted August 15, 2012 Author Share Posted August 15, 2012 (edited) This should pull them out $sHTML = '<a href="/pyt/23204/XXJJE/jak-sciagnac-fotoszopa">Jak sciagnac fotoszopa??</a>' $sData1 = StringMid($sHTML,StringInStr($sHTML,'/','',3)+1,StringInStr($sHTML,'/','',4)-StringInStr($sHTML,'/','',3)-1) $sData2 = StringMid($sHTML,StringInStr($sHTML,'>','')+1,StringInStr($sHTML,'<','',2)-StringInStr($sHTML,'>','')-1) Msgbox(0,'$sData1',$sData1&@CRLF&$sData2) Realy i don't get it. But its working on my text files thanks. One situation, how get source on red from this code in html? <td class="questionTitle"><a href="/Category/028,011/2,212642221,Podobaja_Ci_sie_moje_klubowe_odznaki_.html" class="aquestion" > Podobają Ci się moje klubowe odznaki ?2 </a> </td> Code html from: http://zapytaj.onet.pl/ Im making base were red things help me to 1: Make category, 2: Fill my category with questions Edited August 15, 2012 by koszmail2 Link to comment Share on other sites More sharing options...
Shane0000 Posted August 16, 2012 Share Posted August 16, 2012 (edited) I commented and expanded the code so that it may be easier to follow and you can learn to adjust it for your needs. $sHTML = '<a href="/pyt/23204/XXJJE/jak-sciagnac-fotoszopa">Jak sciagnac fotoszopa??</a>' $iSeperator_A = StringInStr($sHTML,'/','',3) + 1 ; returns location of 3rd '/', +1 to start at the character after '/' $iSeperator_B = StringInStr($sHTML,'/','',4) - 1 ; returns location of 4th '/', , - 1 to end Before the 4th '/' $iStrLength_1 = $iSeperator_B - $iSeperator_A ; returns length of the string to pull $sData1 = StringMid($sHTML,$iSeperator_A,$iStrLength_1) ; returns a portion of the string, starting at $iSeperator_A and lasting for $iStrLength_1 characters $iSeperator_C = StringInStr($sHTML,'>') + 1 ; returns location of 1st '>', +1 to start at the character after '>' $iSeperator_D = StringInStr($sHTML,'<','',2) - 1 ; returns location of 2nd '<', - 1 to end before the 2nd '<' $iStrLength_2 = $iSeperator_D - $iSeperator_C ; returns length of the string to pull, $sData2 = StringMid($sHTML,$iSeperator_C, $iStrLength_2) ; returns a portion of the string, starting at $iSeperator_C and lasting for $iStrLength_2 characters Msgbox(0,'$sData1',$sData1&@CRLF&$sData2) Edited August 16, 2012 by Shane0000 Link to comment Share on other sites More sharing options...
jdelaney Posted August 16, 2012 Share Posted August 16, 2012 (edited) using xml dom is cleaner, to parse out data: $oXML=ObjCreate("Microsoft.XMLDOM") $oXML.LoadXML('<td class="questionTitle"><a href="/Category/028,011/2,212642221,Podobaja_Ci_sie_moje_klubowe_odznaki_.html" class="aquestion" >Podobaja Ci sie moje klubowe odznaki ?</a></td>') ; load text of the DOM object $result1 = $oXML.selectSingleNode('//a') $result2 = $oXML.selectSingleNode([email="'//a/@href'"]'//a/@href'[/email]) ConsoleWrite ( $result1.text & @CRLF) ConsoleWrite ( $result2.text & @CRLF) edit: damn auto corrector, just because there is an @ sign does NOT an email make...replacing the @ with A, so i can write it in: $result2 = $oXML.selectSingleNode('//a/Ahref') Edited August 16, 2012 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...
Shane0000 Posted August 16, 2012 Share Posted August 16, 2012 When I ran that,$result2 = /Category/028,011/2,212642221,Podobaja_Ci_sie_moje_klubowe_odznaki_.htmlhow would you specify the needed part only to be pulled (bold)? Link to comment Share on other sites More sharing options...
jdelaney Posted August 16, 2012 Share Posted August 16, 2012 (edited) how about: $result2 = "/Category/028,011/2,212642221,Podobaja_Ci_sie_moje_klubowe_odznaki_.html" $result2 = StringRegExp ( $result2, "/([d,/]+),w", 3 ) $result2 = $result2[0] MsgBox ( 1,1,$result2) Edited August 16, 2012 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...
Moderators Melba23 Posted August 17, 2012 Moderators Share Posted August 17, 2012 Shane0000 & jdelaney, Full marks for being helpful, but zero marks for being observant! As the OP has been blocked since post #10, there seems little point in leaving this open as he does not deserve to be helped. 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 Link to comment Share on other sites More sharing options...
Recommended Posts