
Kap
Members-
Posts
6 -
Joined
-
Last visited
Everything posted by Kap
-
Huzzah! I'm getting data and it isn't 0 Global $Dcontent = FileRead("C:\Data\Auto ITs\check\Test.htm") Global $content = BinaryToString($Dcontent, 4) BinaryToString did the trick, thanks SmOke_N, draien and everybody else for the help, tips and pointers!! I've earned a lot.
-
@SmOke_N Bingo, the example works. I get an array display pop up and no errors, and if I try your example script on my local test.htm I get 0 So I'm gonna check the string vs binary route! thanks!!
-
@ SmOke_N Jup I've tried the consolewrite, it gives me the full HTML code of the page (even tried it in my full script. So with the real website, not the test HTML I posted above) Also put consolewrites here Local $start_Status = '<td class="labelLeft" colspan="3"><b><span class="validStyle">' consolewrite($start_Status & @crlf) Local $end_Status = '</span></b></td>' consolewrite( _StringBetween($content,$start_Status,$end_Status) & @crlf) Local $Status = _StringBetween($content,$start_Status,$end_Status) consolewrite($Status & @crlf) which gave these resultes: <td class="labelLeft" colspan="3"><b><span class="validStyle"> 0 0 "C:\Data\Auto ITs\BTW check\test.au3" (60) : ==> Subscript used on non-accessible variable.: Local $aio= $Status[0]&";"&$Lidstaat&";"&$nr&";"&$Tijd&";"&$Naam&";"&$Adres&";"&$Cnummer Local $aio= $Status^ ERROR So the _StringBetween doesn't find anything (0) (@draien also triedit with the test script and html same results and jup I did change the @ScriptDir ) But now I think of it I got the error also earlier when I started looking $aio= $Status[0]&";"&$Lidstaat&";"&$nr&";"&$Tijd&";"&$Naam&";"&$Adres&";"&$Cnummer $aio= $Status^ ERROR The first thing I did then was checking my AutoIT version (was V3.3.08 orsomething) and I updated it. Didn't help apperently (at least not with the error) I think I better start again and see if I make that work, to get the hang of it and to make sure that I'm not overlooking some simple thing (I kinda got the feeling it's something real small that I'm overlooking. Because I tried so much options that it turned a bit chaotic) (atm I made a quick and real dirty sollution to get the data I need with coordinated and winwaits etc. So I'm getting the data I need.) But I now know it should also be possible via this way Thanks all for all your help, tips and input!
-
Thanks draien! (and TheSaint too) I'll go trough your script to see what it does exactly One thing though, it doesn't work with me :/ I get an error I already seen a lot during my thinkering with this...(might by that that's part of my problem) "C:\Data\Auto ITs\BTW check\test2.au3" (34) : ==> Subscript used on non-accessible variable.: $aio= $Status[0]&";"&$Lidstaat&";"&$nr&";"&$Tijd&";"&$Naam&";"&$Adres&";"&$Cnummer $aio= $Status^ ERROR For some reason I get this error when I use [0] after my variables.. Since the code works with you, could it be I got a wrong liberary or missing something? I use v3.3.12.0
-
Hello All, My appologies for the (sort of) double post, but I just realised it probably wasn't the best idea to ask my question in an answered topic ('?do=embed' frameborder='0' data-embedContent>>) The above mentioned topic helped me a great deal, ... but it doesn't do exactly what it suppose to do (or at least what I want it to do). And being new to array's I'm not quite sure where I go wrong.. It does create a .csv, every time I run the script it puts in another line, but it doesn't seem to find the info in the HTML/website (all it gives are 0's) So I suspect that the script doesn't read the site or don't seem to find info that I want. Been breaking my head over it all weekend, but can't seem to find where I gone wrong. My script: HotKeySet("{ESC}", "Terminate") Opt("WinTextMatchMode", 2) ;1=complete, 2=quick Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase AutoItSetOption("MouseCoordMode", 0) opt("SendKeyDelay",90) opt("WinWaitDelay",35) opt("TrayIconDebug",1) #include <IE.au3> #include <Inet.au3> #include <Array.au3> #include <String.au3> #include <MsgBoxConstants.au3> If FileExists("C:\Data\Auto ITs\check\check.csv") =false Then FileWrite("C:\Data\Auto ITs\check\check.csv","Actief;Lidstaat;nummer;Tijdstip waarop de aanvraag werd ontvangen;Naam;Adres;Cnummer"& @CRLF) EndIf $content = _INetGetSource("C:\Data\Auto ITs\check\Test.htm") $Status = _StringBetween($content, '<span class="validStyle">', "</span></b></td>") $Lidstaat = _StringBetween($content, '<td class="labelStyle">Lidstaat</td> <td>' , '</td>') $nr = _StringBetween($content, '<td class="labelStyle">nummer</td> <td>' , '</td>') $Tijd = _StringBetween($content, '<td class="labelStyle">Tijdstip waarop de aanvraag werd ontvangen</td> <td>' , '</td>') $Naam = _StringBetween($content, '<td class="labelStyle">Naam</td> <td>' , '</td>') $Adres= _StringBetween($content, '<td class="labelStyle">Adres</td> <td>' , '</td>') $Cnummer = _StringBetween($content, '<td class="labelStyle">Cnummer</td> <td>' , '</td>') $aio= $Status&";"&$Lidstaat&";"&$nr&";"&$Tijd&";"&$Naam&";"&$Adres&";"&$Cnummer $sString1 = StringReplace($aio, " ", "") ;removing spaces -to format it later to csv $sString2 = StringReplace($sString1, "<p>", "") ;removing <p> -useless $sString3 = StringReplace($sString2, "<span>Mobil:</span>", "") ;removing <span>Mobil:</span> -useless $sString4 = StringReplace($sString3, "</p>", "") ;removing </p> - useless $sString5 = StringReplace($sString4, "Â", "") ;removing  from m² $sString6 = StringReplace($sString5, '<spanclass="is24-operator">=</span>', "") ;removing <spanclass="is24-operator">=</span> -useless $sString7 = StringReplace($sString6, "EUR", "") ;removing EUR -useless cuz we will format it later in excel $sString8 = StringReplace($sString7, "<span>Telefon:</span>","") ;removing <span>Telefon:</span> -useless $sStringfinal = StringReplace($sString8, @CRLF, "") ;finally removing @CRLF to get a csv format FileWrite ( "check.csv", $sStringfinal & @CRLF ) Func Terminate() Exit 0 And the test HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test</title> </head> <body> <a id="top-page" name="top-page"></a> <div id="layout" class="layout"> <div id="header"> <h2>Info</h2> <fieldset> <table id="vatResponseFormTable"> <tr> <td class="labelLeft" colspan="3"><b><span class="validStyle">Ja, correct</span></b></td> </tr> <tr> <td><br /></td> </tr> <tr> <td class="labelStyle">Lidstaat</td> <td>NL</td> <td class="errorFormStyle"></td> </tr> <tr> <td class="labelStyle">nummer</td> <td>820471616gdwsg01</td> </tr> <tr> <td class="labelStyle">Tijdstip waarop de aanvraag werd ontvangen</td> <td>2015/01/12 12:28:03</td> </tr> <tr> <td class="labelStyle">Naam</td> <td>T. Est </td> </tr> <tr> <td class="labelStyle">Adres</td> <td><br />Straat 00189<br />1234AA Stad<br /> </td> </tr> <tr> <td class="labelStyle">Cnummer</td> <td></td> </tr> </table> <br /> <p><a href="backtest.html">Back</a></p> </fieldset> </div> </div> </div> </div> </div> </div> </body> </html> If somebody could point out where I gone wrong or send me in the right direction it would be greatly appreciated Thanks in advanced! -Kap
-
Hi All, I've been stuggeling with something simulair the last couple of days (Been browsing the fora for a possible sullotion, array's and such are still kinda new to me..) And the one sullotion above seemed also great one for me... but it doesn't do exactly what it suppose to to. It does create a .csv, every time I run the script it puts in another line, but it doesn't seem to find the info in the HTML/website (all it gives are 0's) So I suspect that the script doesn't read the site or don't seem to find info that I want. Been breaking my head over it all weekend, but can't seem to find where I gone wrong. Here is the script I use to test it and the HTML where I test it with HotKeySet("{ESC}", "Terminate") Opt("WinTextMatchMode", 2) ;1=complete, 2=quick Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase AutoItSetOption("MouseCoordMode", 0) opt("SendKeyDelay",90) opt("WinWaitDelay",35) opt("TrayIconDebug",1) #include <IE.au3> #include <Inet.au3> #include <Array.au3> #include <String.au3> #include <MsgBoxConstants.au3> If FileExists("C:\Data\Auto ITs\check\check.csv") =false Then FileWrite("C:\Data\Auto ITs\check\check.csv","Actief;Lidstaat;nummer;Tijdstip waarop de aanvraag werd ontvangen;Naam;Adres;Cnummer"& @CRLF) EndIf $content = _INetGetSource("C:\Data\Auto ITs\check\Test.htm") $Status = _StringBetween($content, '<span class="validStyle">', "</span></b></td>") $Lidstaat = _StringBetween($content, '<td class="labelStyle">Lidstaat</td> <td>' , '</td>') $nr = _StringBetween($content, '<td class="labelStyle">nummer</td> <td>' , '</td>') $Tijd = _StringBetween($content, '<td class="labelStyle">Tijdstip waarop de aanvraag werd ontvangen</td> <td>' , '</td>') $Naam = _StringBetween($content, '<td class="labelStyle">Naam</td> <td>' , '</td>') $Adres= _StringBetween($content, '<td class="labelStyle">Adres</td> <td>' , '</td>') $Cnummer = _StringBetween($content, '<td class="labelStyle">Cnummer</td> <td>' , '</td>') $aio= $Status&";"&$Lidstaat&";"&$nr&";"&$Tijd&";"&$Naam&";"&$Adres&";"&$Cnummer $sString1 = StringReplace($aio, " ", "") ;removing spaces -to format it later to csv $sString2 = StringReplace($sString1, "<p>", "") ;removing <p> -useless $sString3 = StringReplace($sString2, "<span>Mobil:</span>", "") ;removing <span>Mobil:</span> -useless $sString4 = StringReplace($sString3, "</p>", "") ;removing </p> - useless $sString5 = StringReplace($sString4, "Â", "") ;removing  from m² $sString6 = StringReplace($sString5, '<spanclass="is24-operator">=</span>', "") ;removing <spanclass="is24-operator">=</span> -useless $sString7 = StringReplace($sString6, "EUR", "") ;removing EUR -useless cuz we will format it later in excel $sString8 = StringReplace($sString7, "<span>Telefon:</span>","") ;removing <span>Telefon:</span> -useless $sStringfinal = StringReplace($sString8, @CRLF, "") ;finally removing @CRLF to get a csv format FileWrite ( "check.csv", $sStringfinal & @CRLF ) Func Terminate() Exit 0 EndFunc The HTML test page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test</title> </head> <body> <a id="top-page" name="top-page"></a> <div id="layout" class="layout"> <div id="header"> <h2>Info</h2> <fieldset> <table id="vatResponseFormTable"> <tr> <td class="labelLeft" colspan="3"><b><span class="validStyle">Ja, correct</span></b></td> </tr> <tr> <td><br /></td> </tr> <tr> <td class="labelStyle">Lidstaat</td> <td>NL</td> <td class="errorFormStyle"></td> </tr> <tr> <td class="labelStyle">nummer</td> <td>820471616gdwsg01</td> </tr> <tr> <td class="labelStyle">Tijdstip waarop de aanvraag werd ontvangen</td> <td>2015/01/12 12:28:03</td> </tr> <tr> <td class="labelStyle">Naam</td> <td>T. Est </td> </tr> <tr> <td class="labelStyle">Adres</td> <td><br />Straat 00189<br />1234AA Stad<br /> </td> </tr> <tr> <td class="labelStyle">Cnummer</td> <td></td> </tr> </table> <br /> <p><a href="backtest.html">Back</a></p> </fieldset> </div> </div> </div> </div> </div> </div> </body> </html> If somebody could point out where I gone wrong or send me in the right direction it would be greatly appreciated Thanks in advanced! -Kap