cane Posted June 19, 2009 Share Posted June 19, 2009 Hi well i was wondering if there was anyway to read line 210 then save it as a variable, and then do the same with line 213 but read it as text.The lines are Attack </a> </td> <td class="alL">2,959</td> <td class="alL">99</td> <td class="alL">30,034,511</td>Attack is line 210 and the last line is 215. I was thinking you would use _IEBodyReadText but was not sure then how to copy that direct line number. Also if you can, can you lock or delete http://www.autoitscript.com/forum/index.php?showtopic=97069 as its not needed Link to comment Share on other sites More sharing options...
Valuater Posted June 19, 2009 Share Posted June 19, 2009 (edited) Straight from help....Function ReadLine ( filehandle or "filename" [, line] ) Parameters filehandle The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter. line [optional] The line number to read. The first line of a text file is line 1 (not zero), last line is -1.8)EDIT:$Line = FileReadLine() Edited June 19, 2009 by Valuater Link to comment Share on other sites More sharing options...
martin Posted June 19, 2009 Share Posted June 19, 2009 Hi well i was wondering if there was anyway to read line 210 then save it as a variable, and then do the same with line 213 but read it as text. The lines are Attack </a> </td> <td class="alL">2,959</td> <td class="alL">99</td> <td class="alL">30,034,511</td> Attack is line 210 and the last line is 215. I was thinking you would use _IEBodyReadText but was not sure then how to copy that direct line number. Also if you can, can you lock or delete http://www.autoitscript.com/forum/index.php?showtopic=97069 as its not neededIf you can read the text then you could split it into lines like this $AllText = _IEBodyReadText(...... $aLines = StringSPlit($AllText,@CR) msgbox(262144,"Line 2 is",$aLines[2]) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
cane Posted June 20, 2009 Author Share Posted June 20, 2009 Thanks here is what i have now expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Runescape Highscore Lookup", 321, 531, 568, 259) GUISetBkColor(0xA6CAF0) $Username = GUICtrlCreateInput("", 72, 6, 121, 21) GUICtrlSetColor(-1, 0x0000FF) $userlabel = GUICtrlCreateLabel("Username", 16, 8, 52, 17) $lookup = GUICtrlCreateButton("Lookup", 200, 6, 75, 21, $WS_GROUP) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetCursor (-1, 0) $Group1 = GUICtrlCreateGroup(" Results ", 8, 32, 297, 473) $Group2 = GUICtrlCreateGroup(" Skill ", 16, 56, 121, 441) $Overall = GUICtrlCreateLabel("Overall", 40, 80, 37, 17) $Defence = GUICtrlCreateLabel("Defence", 40, 112, 45, 17) $Strength = GUICtrlCreateLabel("Strength", 40, 128, 44, 17) $Hitpoints = GUICtrlCreateLabel("Hitpoints", 40, 144, 45, 17) $Range = GUICtrlCreateLabel("Range", 40, 160, 36, 17) $Prayer = GUICtrlCreateLabel("Prayer", 40, 176, 34, 17) $Woodcutting = GUICtrlCreateLabel("Woodcutting", 40, 224, 65, 17) $Fletching = GUICtrlCreateLabel("Fletching", 40, 240, 47, 17) $Firemaking = GUICtrlCreateLabel("Firemaking", 40, 256, 55, 17) $Attack = GUICtrlCreateLabel("Attack", 40, 96, 35, 17) $Magic = GUICtrlCreateLabel("Magic", 40, 192, 33, 17) $Cooking = GUICtrlCreateLabel("Cooking", 40, 208, 43, 17) $Herblore = GUICtrlCreateLabel("Herblore", 40, 320, 44, 17) $Smithing = GUICtrlCreateLabel("Smithing", 40, 288, 44, 17) $Slayer = GUICtrlCreateLabel("Slayer", 40, 368, 33, 17) $Farming = GUICtrlCreateLabel("Farming", 40, 384, 41, 17) $Hunter = GUICtrlCreateLabel("Hunter", 40, 416, 36, 17) $Agility = GUICtrlCreateLabel("Agility", 40, 336, 31, 17) $Mining = GUICtrlCreateLabel("Mining", 40, 304, 35, 17) $Runecraft = GUICtrlCreateLabel("Runecraft", 40, 400, 51, 17) $Crafting = GUICtrlCreateLabel("Crafting", 40, 272, 40, 17) $Construction = GUICtrlCreateLabel("Construction", 40, 432, 63, 17) $Thieving = GUICtrlCreateLabel("Thieving", 40, 352, 45, 17) $Summoning = GUICtrlCreateLabel("Summoning", 40, 448, 59, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Level", 155, 56, 49, 441) $overalllevel = GUICtrlCreateLabel("", 160, 80, 36, 17) $attacklevel = GUICtrlCreateLabel("", 160, 96, 36, 17) $defencelevel = GUICtrlCreateLabel("", 160, 112, 36, 17) $strengthlevel = GUICtrlCreateLabel("", 160, 128, 36, 17) $rangelevel = GUICtrlCreateLabel("", 160, 160, 42, 17) $prayerlevel = GUICtrlCreateLabel("", 160, 176, 42, 17) $magiclevel = GUICtrlCreateLabel("", 160, 192, 42, 17) $cookinglevel = GUICtrlCreateLabel("", 160, 208, 42, 17) $fletchinglevel = GUICtrlCreateLabel("", 160, 240, 42, 17) $woodcuttinglevel = GUICtrlCreateLabel("", 160, 224, 42, 17) $hitpointslevel = GUICtrlCreateLabel("", 160, 144, 42, 17) $firemakinglevel = GUICtrlCreateLabel("", 160, 256, 42, 17) $craftinglevel = GUICtrlCreateLabel("", 160, 272, 42, 17) $smithinglevel = GUICtrlCreateLabel("", 160, 288, 42, 17) $mininglevel = GUICtrlCreateLabel("", 160, 304, 42, 17) $herblorelevel = GUICtrlCreateLabel("", 160, 320, 42, 17) $agilitylevel = GUICtrlCreateLabel("", 160, 336, 42, 17) $slayerlevel = GUICtrlCreateLabel("", 160, 368, 42, 17) $farminglevel = GUICtrlCreateLabel("", 160, 384, 42, 17) $thievinglevel = GUICtrlCreateLabel("", 160, 352, 42, 17) $runecraftinglevel = GUICtrlCreateLabel("", 160, 400, 42, 17) $hunterlevel = GUICtrlCreateLabel("", 160, 416, 42, 17) $constructionlevel = GUICtrlCreateLabel("", 160, 432, 42, 17) $summoninglevel = GUICtrlCreateLabel("", 160, 448, 42, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group4 = GUICtrlCreateGroup(" Rank ", 213, 56, 81, 441) $defenceexp = GUICtrlCreateLabel("", 232, 112, 36, 17) $strengthexp = GUICtrlCreateLabel("", 232, 128, 36, 17) $overallexp = GUICtrlCreateLabel("", 232, 80, 36, 17) $attackexp = GUICtrlCreateLabel("", 232, 96, 36, 17) $hitpointsexp = GUICtrlCreateLabel("", 232, 144, 36, 17) $prayerexp = GUICtrlCreateLabel("", 232, 176, 42, 17) $cookingexp = GUICtrlCreateLabel("", 232, 208, 42, 17) $rangeexp = GUICtrlCreateLabel("", 232, 160, 42, 17) $magicexp = GUICtrlCreateLabel("", 232, 192, 42, 17) $woodcuttingexp = GUICtrlCreateLabel("", 232, 224, 42, 17) $fletchingexp = GUICtrlCreateLabel("", 232, 240, 42, 17) $firemakingexp = GUICtrlCreateLabel("", 232, 256, 42, 17) $craftingexp = GUICtrlCreateLabel("", 232, 272, 42, 17) $smithinglevel = GUICtrlCreateLabel("", 232, 288, 42, 17) $agilityexp = GUICtrlCreateLabel("", 232, 336, 42, 17) $miningexp = GUICtrlCreateLabel("", 232, 304, 42, 17) $slayerexp = GUICtrlCreateLabel("", 232, 368, 42, 17) $farmingexp = GUICtrlCreateLabel("", 232, 384, 42, 17) $herbloreexp = GUICtrlCreateLabel("", 232, 320, 42, 17) $thievingexp = GUICtrlCreateLabel("", 232, 352, 42, 17) $hunterexp = GUICtrlCreateLabel("", 232, 416, 42, 17) $runecraftingexp = GUICtrlCreateLabel("", 232, 400, 42, 17) $constructionexp = GUICtrlCreateLabel("", 232, 432, 42, 17) $summoningexp = GUICtrlCreateLabel("", 232, 448, 42, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("", -99, -99, 1, 1) $Created = GUICtrlCreateLabel("Created by cane", 112, 512, 82, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE case $lookup $url = "http://hiscore.runescape.com/hiscorepersonal.ws?user1="& GUICtrlRead($Username) $AllText = _IEBodyReadText($url) $aLines = StringSPlit($AllText,@CR) msgbox(262144,"Line 2 is",$aLines[2]) Exit EndSwitch WEnd I think the problem is with my $url but im not that sure could anyone show me what im doing wrong. And in the msgbox '262144' is the name of the box right? Link to comment Share on other sites More sharing options...
oMBRa Posted June 20, 2009 Share Posted June 20, 2009 And in the msgbox '262144' is the name of the box right?No, it's a flag that indicates the type of MsgBox and the button combinations, see in the help file Link to comment Share on other sites More sharing options...
cane Posted June 20, 2009 Author Share Posted June 20, 2009 (edited) No, it's a flag that indicates the type of MsgBox and the button combinations, see in the help fileThanks did not know that and i have this now expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <IE.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Runescape Highscore Lookup", 321, 531, 568, 259) GUISetBkColor(0xA6CAF0) $Username = GUICtrlCreateInput("zezima", 72, 6, 121, 21) GUICtrlSetColor(-1, 0x0000FF) $userlabel = GUICtrlCreateLabel("Username", 16, 8, 52, 17) $lookup = GUICtrlCreateButton("Lookup", 200, 6, 75, 21, $WS_GROUP) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetCursor (-1, 0) $Group1 = GUICtrlCreateGroup(" Results ", 8, 32, 297, 473) $Group2 = GUICtrlCreateGroup(" Skill ", 16, 56, 121, 441) $Overall = GUICtrlCreateLabel("Overall", 40, 80, 37, 17) $Defence = GUICtrlCreateLabel("Defence", 40, 112, 45, 17) $Strength = GUICtrlCreateLabel("Strength", 40, 128, 44, 17) $Hitpoints = GUICtrlCreateLabel("Hitpoints", 40, 144, 45, 17) $Range = GUICtrlCreateLabel("Range", 40, 160, 36, 17) $Prayer = GUICtrlCreateLabel("Prayer", 40, 176, 34, 17) $Woodcutting = GUICtrlCreateLabel("Woodcutting", 40, 224, 65, 17) $Fletching = GUICtrlCreateLabel("Fletching", 40, 240, 47, 17) $Firemaking = GUICtrlCreateLabel("Firemaking", 40, 256, 55, 17) $Attack = GUICtrlCreateLabel("Attack", 40, 96, 35, 17) $Magic = GUICtrlCreateLabel("Magic", 40, 192, 33, 17) $Cooking = GUICtrlCreateLabel("Cooking", 40, 208, 43, 17) $Herblore = GUICtrlCreateLabel("Herblore", 40, 320, 44, 17) $Smithing = GUICtrlCreateLabel("Smithing", 40, 288, 44, 17) $Slayer = GUICtrlCreateLabel("Slayer", 40, 368, 33, 17) $Farming = GUICtrlCreateLabel("Farming", 40, 384, 41, 17) $Hunter = GUICtrlCreateLabel("Hunter", 40, 416, 36, 17) $Agility = GUICtrlCreateLabel("Agility", 40, 336, 31, 17) $Mining = GUICtrlCreateLabel("Mining", 40, 304, 35, 17) $Runecraft = GUICtrlCreateLabel("Runecraft", 40, 400, 51, 17) $Crafting = GUICtrlCreateLabel("Crafting", 40, 272, 40, 17) $Construction = GUICtrlCreateLabel("Construction", 40, 432, 63, 17) $Thieving = GUICtrlCreateLabel("Thieving", 40, 352, 45, 17) $Summoning = GUICtrlCreateLabel("Summoning", 40, 448, 59, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Level", 155, 56, 49, 441) $overalllevel = GUICtrlCreateLabel("", 160, 80, 36, 17) $attacklevel = GUICtrlCreateLabel("", 160, 96, 36, 17) $defencelevel = GUICtrlCreateLabel("", 160, 112, 36, 17) $strengthlevel = GUICtrlCreateLabel("", 160, 128, 36, 17) $rangelevel = GUICtrlCreateLabel("", 160, 160, 42, 17) $prayerlevel = GUICtrlCreateLabel("", 160, 176, 42, 17) $magiclevel = GUICtrlCreateLabel("", 160, 192, 42, 17) $cookinglevel = GUICtrlCreateLabel("", 160, 208, 42, 17) $fletchinglevel = GUICtrlCreateLabel("", 160, 240, 42, 17) $woodcuttinglevel = GUICtrlCreateLabel("", 160, 224, 42, 17) $hitpointslevel = GUICtrlCreateLabel("", 160, 144, 42, 17) $firemakinglevel = GUICtrlCreateLabel("", 160, 256, 42, 17) $craftinglevel = GUICtrlCreateLabel("", 160, 272, 42, 17) $smithinglevel = GUICtrlCreateLabel("", 160, 288, 42, 17) $mininglevel = GUICtrlCreateLabel("", 160, 304, 42, 17) $herblorelevel = GUICtrlCreateLabel("", 160, 320, 42, 17) $agilitylevel = GUICtrlCreateLabel("", 160, 336, 42, 17) $slayerlevel = GUICtrlCreateLabel("", 160, 368, 42, 17) $farminglevel = GUICtrlCreateLabel("", 160, 384, 42, 17) $thievinglevel = GUICtrlCreateLabel("", 160, 352, 42, 17) $runecraftinglevel = GUICtrlCreateLabel("", 160, 400, 42, 17) $hunterlevel = GUICtrlCreateLabel("", 160, 416, 42, 17) $constructionlevel = GUICtrlCreateLabel("", 160, 432, 42, 17) $summoninglevel = GUICtrlCreateLabel("", 160, 448, 42, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group4 = GUICtrlCreateGroup(" Rank ", 213, 56, 81, 441) $defenceexp = GUICtrlCreateLabel("", 232, 112, 36, 17) $strengthexp = GUICtrlCreateLabel("", 232, 128, 36, 17) $overallexp = GUICtrlCreateLabel("", 232, 80, 36, 17) $attackexp = GUICtrlCreateLabel("", 232, 96, 36, 17) $hitpointsexp = GUICtrlCreateLabel("", 232, 144, 36, 17) $prayerexp = GUICtrlCreateLabel("", 232, 176, 42, 17) $cookingexp = GUICtrlCreateLabel("", 232, 208, 42, 17) $rangeexp = GUICtrlCreateLabel("", 232, 160, 42, 17) $magicexp = GUICtrlCreateLabel("", 232, 192, 42, 17) $woodcuttingexp = GUICtrlCreateLabel("", 232, 224, 42, 17) $fletchingexp = GUICtrlCreateLabel("", 232, 240, 42, 17) $firemakingexp = GUICtrlCreateLabel("", 232, 256, 42, 17) $craftingexp = GUICtrlCreateLabel("", 232, 272, 42, 17) $smithinglevel = GUICtrlCreateLabel("", 232, 288, 42, 17) $agilityexp = GUICtrlCreateLabel("", 232, 336, 42, 17) $miningexp = GUICtrlCreateLabel("", 232, 304, 42, 17) $slayerexp = GUICtrlCreateLabel("", 232, 368, 42, 17) $farmingexp = GUICtrlCreateLabel("", 232, 384, 42, 17) $herbloreexp = GUICtrlCreateLabel("", 232, 320, 42, 17) $thievingexp = GUICtrlCreateLabel("", 232, 352, 42, 17) $hunterexp = GUICtrlCreateLabel("", 232, 416, 42, 17) $runecraftingexp = GUICtrlCreateLabel("", 232, 400, 42, 17) $constructionexp = GUICtrlCreateLabel("", 232, 432, 42, 17) $summoningexp = GUICtrlCreateLabel("", 232, 448, 42, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("", -99, -99, 1, 1) $Created = GUICtrlCreateLabel("Created by cane", 112, 512, 82, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE case $lookup $url = ("http://hiscore.runescape.com/hiscorepersonal.ws?user1="& GUICtrlRead($Username)) $AllText = _IEBodyReadText($url) $aLines = StringSplit($AllText,@CR) msgbox(262144,"Line 2 is", $aLines[2]) Exit EndSwitch WEnd When i click lookup it quits and gives me a error. I searched the error on the forums and i think it is something to do with the [2] could someone show me why im getting this error. Thanks Edited June 20, 2009 by cane Link to comment Share on other sites More sharing options...
oMBRa Posted June 20, 2009 Share Posted June 20, 2009 I searched the error on the forums and i think it is something to do with the [2] could someone show me why im getting this error. Thankscheck if $aLines is an array with IsArray Link to comment Share on other sites More sharing options...
cane Posted June 20, 2009 Author Share Posted June 20, 2009 check if $aLines is an array with IsArrayThanks i looked up IsArray in the help file now i have If IsArray($aLines) Then msgbox(0,"Line 2 is", $aLines[1]) EndIfBut it just gives me 0 when it is displayed. I have tried searching but found nothing. I think is is something like the error i had when i did not use GUICtrlRead 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