Overlord Posted March 2, 2009 Share Posted March 2, 2009 Hey guys, I'm trying to find some text in a webpage... my main problem is that the text almost every time has more or less characters in front and/or behind them. anyway to solve the problem?? this is my best solution... $oIE = _IECreate ("http://apps.facebook.com/inthemafia/") $sText = _IEBodyReadText ($oIE) $output = StringSplit($sText, "Stamina", 1) $output[2] = StringLeft ( $output[2] ,4) MsgBox(0,"bla", $output[2]) only problem I still have is the number is higher the 99... Link to comment Share on other sites More sharing options...
qazwsx Posted March 2, 2009 Share Posted March 2, 2009 Stringinstr? Link to comment Share on other sites More sharing options...
Overlord Posted March 2, 2009 Author Share Posted March 2, 2009 doesn't that give me the location where the value is located instead of the value itself? the way I can understand it from the helpfile it will say at which position the item I need is, not the value. unless you can provide me with a example I wouldn't see a solution. But then again... I'm not a decent coder... Link to comment Share on other sites More sharing options...
qazwsx Posted March 2, 2009 Share Posted March 2, 2009 (edited) Wait, what value are you looking for? I thought the value was "Stamina" and you wanted the location. Edited March 2, 2009 by qazwsx Link to comment Share on other sites More sharing options...
NBJ Posted March 2, 2009 Share Posted March 2, 2009 (edited) Hi Overlord, I am not exactly sure what the problem is here, the script works (when 'Stamina' is in the page) The first 4 digits can be returned as you have done, this should allow you to receive the Stamina Value. I would look at the HTML see if there are other characters following the number in the HTML. there may be spaces or <> or other HTML code which is giving you an incorrect response. if you increase the 4 in $output[2] = StringLeft ( $output[2] ,4) to say 10, what is your result then? With Regards wakido edit: you guys replied quicker than I did! Edited March 2, 2009 by NBJ Link to comment Share on other sites More sharing options...
qazwsx Posted March 2, 2009 Share Posted March 2, 2009 If there is not a specific character that always follow the number, you could use Stringisdigit in a loop until it is false. This assumes another number does no follow the number your were looking for. Link to comment Share on other sites More sharing options...
Overlord Posted March 2, 2009 Author Share Posted March 2, 2009 (edited) Cash ( Go to Bank ) $0 More in 18:16 Health 169/169 Energy 16/106 More in 2:42 Stamina 2/15 More in 1:31 this is basically the maximum of text I need... NBJ, as you can see, if I would increase the value from 4 to 10 in $output[2] then I get more text which isn't really needed. All the info I need is how much stamina and energy I currently have. which corresponding to this post is 16 of 106 energy and 2 of 15 stamina EDIT: thx for fast responses :-) Edited March 2, 2009 by Overlord Link to comment Share on other sites More sharing options...
Overlord Posted March 2, 2009 Author Share Posted March 2, 2009 (edited) If there is not a specific character that always follow the number, you could use Stringisdigit in a loop until it is false. This assumes another number does no follow the number your were looking for.actually there is... if you look at my previous post you will see its always value needed / max valueso the / could worknvm... that doesn't give me the value, just a 1 or 0... Edited March 2, 2009 by Overlord Link to comment Share on other sites More sharing options...
qazwsx Posted March 2, 2009 Share Posted March 2, 2009 Well u know that after stamina there is a space followed by a number and then "/". Just read the string until you get to the /. Link to comment Share on other sites More sharing options...
NBJ Posted March 2, 2009 Share Posted March 2, 2009 @Overlord, can you post the HTML (ie source) from the stamina section of the webpage?? Link to comment Share on other sites More sharing options...
Overlord Posted March 2, 2009 Author Share Posted March 2, 2009 (edited) ToepassingenToepassingenSleep om te herschikkenBewerken|Zoek meerFoto'sVideoGroepenEvenementenNotitiesMafia WarsChat invoegen in paginaApart chatvensterChatChatPop-up chat|Instellingen|Hulp Je bent online. Offline Je bent offline. Online Wat doe je? Bart gaat "The Black Knight" kijken op DVD. 7 uur geleden - wissen|BewerkBart 1MeldingenMeldingenAlles tonenGeen nieuwe meldingen. Tua Naga was saved with your help. Click here to claim your reward. 15 minuten geledenLee Bowman earned the title of Master Associate before you. Go master some jobs to catch up. Click here to play Mafia Wars. ongeveer een uur geledenRachel Haaland earned the title of Skilled Enforcer before you. Go master some jobs to catch up. Click here to play Mafia Wars. ongeveer een uur geledenJacob Yee earned the title of Skilled Soldier before you. Go master some jobs to catch up. Click here to play Mafia Wars. ongeveer een uur geledenTrond Løvås Breines earned the title of Master Associate before you. Go master some jobs to catch up. Click here to play Mafia Wars. 4 uur geledenVrienden online (32)Online vrienden 0000Onlangs toegevoegd Al mijn vrienden Vrienden uitnodigen Vind vriendenPostvak IN bekijken Nieuw bericht schrijven Accountinstellingen Privacy-instellingen Toepassingsinstellingen Instellingen van Mafia Wars StartpaginaProfielVriendenPostvak IN0 AfmeldenInstellingenBart Cuenen Try Refreshing? How to Play Support ToS Top Families Cash ( Go to Bank ) $0 More in 4:50 Health 169/169 Energy 19/106 More in 4:19 Stamina 5/15 More in 3:08 Experience 14366/14400 Level 47 HomeJobsFightPropertiesInventoryGodfather (9) Profile My Mafia (1028) Feature Update! February 26th, 2009 Job Mastery now has three levels of completion that rewards you with new bonuses and items. Learn More... Limited Edition Loot Buy Send Invites Colt Pistol +1 $2,000 3 Attack 3 Defense Requires 983 mafia members. Tools of Persuasion ? Attack ? Defense 20 points for 1 tool 55 points for 3 tools Visit the Godfather now Player Updates (clear all updates) 3 minutes ago:You were knocked out by MaNiAc who claimed the $8,000 bounty on you set by Delicate Flower3 minutes ago:You were snuffed in the fight, losing 6 experience points.3 minutes ago:You were attacked by MaNiAc You won the fight, taking 17 damage and dealing 19 damage to your enemy. You gained 1 experience points and $0.3 minutes ago:You were attacked by Tony "da bomb" Bomboni You won the fight, taking 3 damage and dealing 6 damage to your enemy. You gained 3 experience points and $65,000.3 minutes ago:You were attacked by Tony "da bomb" Bomboni You won the fight, taking 10 damage and dealing 22 damage to your enemy. You gained 1 experience points and $65,000.3 minutes ago:You were attacked by Tony "da bomb" Bomboni You won the fight, taking 1 damage and dealing 11 damage to your enemy. You gained 2 experience points and $65,000.3 minutes ago:You were attacked by MaNiAc You won the fight, taking 18 damage and dealing 22 damage to your enemy. You gained 2 experience points and $0.3 minutes ago:You were attacked by Tony "da bomb" Bomboni You won the fight, taking 18 damage and dealing 21 damage to your enemy. You gained 3 experience points and $65,000.3 minutes ago:You were attacked by Oaiki Narubu You won the fight, taking 8 damage and dealing 19 damage to your enemy. You gained 1 experience points and $6,104.3 minutes ago:You were attacked by Don Ryan You won the fight, taking 11 damage and dealing 27 damage to your enemy. You gained 3 experience points and $0.3 minutes ago:You were attacked by Don Cumming You won the fight, taking 13 damage and dealing 15 damage to your enemy. You gained 2 experience points and $0.3 minutes ago:You were attacked by Dainty Donny Dimples You won the fight, taking 12 damage and dealing 12 damage to your enemy. You gained 3 experience points and $32,500.3 minutes ago:You were attacked by The Ruthless Dictator You won the fight, taking 6 damage and dealing 20 damage to your enemy. You gained 1 experience points and $2,887.4 minutes ago:You were attacked by Don Keong You won the fight, taking 16 damage and dealing 24 damage to your enemy. You gained 3 experience points and $332.4 minutes ago:You were attacked by MaNiAc You won the fight, taking 9 damage and dealing 24 damage to your enemy. You gained 1 experience points and $0.4 minutes ago:You were attacked by Brian the Hitman You won the fight, taking 8 damage and dealing 15 damage to your enemy. You gained 2 experience points and $421.4 minutes ago:You were attacked by Don Cumming You won the fight, taking 15 damage and dealing 19 damage to your enemy. You gained 3 experience points and $0.4 minutes ago:You were attacked by Don Johnson You won the fight, taking 3 damage and dealing 8 damage to your enemy. You gained 1 experience points and $0.4 minutes ago:You were attacked by gord You won the fight, taking 8 damage and dealing 12 damage to your enemy. You gained 3 experience points and $0.12 minutes ago:You fought as Don Shanatello Woods's Capo. Together you defeated T-Bone and you received $32,500 for doing so.16 minutes ago:You fought as [Elite] Agostini [Au]'s Capo. Together you defeated Squeeker and you received $0 for doing so.17 minutes ago:You fought as Don Naga's Capo. Together you defeated Francesco Porrello and you received $0 for doing so.42 minutes ago:You fought as Don Krneta's Capo. Together you defeated Tommy The Finger and you received $32,500 for doing so.49 minutes ago:You fought as Tony's Capo. Together you defeated BiggRed and you received $3,418 for doing so.1 hour, 11 minutes ago:You fought as stingy Sue's Capo. Together you defeated Polish Dres and you received $32,500 for doing so.1 hour, 14 minutes ago:You fought as SAMMY "FINGERS" LEONARDI's Capo. Together you defeated Felicia~May and you received $0 for doing so.1 hour, 28 minutes ago:You fought as Don Luca's Capo. Together you defeated Pit and you received $32,500 for doing so.1 hour, 47 minutes ago:You fought as don coqen's Capo. Together you defeated Supa and you received $0 for doing so.2 hours, 5 minutes ago:You fought as Max Corleone Mafia's Capo. Together you defeated BadDNA and you received $0 for doing so.2 hours, 6 minutes ago:You fought as CrazyClownPosse's Capo. Together you defeated Don Hiekkataipale and you received $32,500 for doing so.2 hours, 15 minutes ago:You fought as Don Dent's Capo. Together you defeated Don Pennington and you received $0 for doing so.2 hours, 21 minutes ago:You fought as don coqen's Capo. Together you defeated Don yellow duck and you received $23 for doing so.2 hours, 43 minutes ago:You fought as Don Stafa's Capo. Together you defeated Don Conyard and you received $0 for doing so.3 hours, 20 minutes ago:You fought as Hrsiotunfimnlk's Capo. Together you defeated Don Andersini and you received $4,892 for doing so.3 hours, 28 minutes ago:You fought as Spaget's Capo. Together you defeated Christian and you received $32,500 for doing so.3 hours, 29 minutes ago:You fought as CrazyClownPosse's Capo. Together you defeated BIG J and you received $4,853 for doing so.3 hours, 47 minutes ago:You fought as Kickman's Capo. Together you defeated Knee crush Ned and you received $18 for doing so.3 hours, 49 minutes ago:You fought as Francesco Porrello's Capo. Together you defeated [LCN]cociii and you received $0 for doing so.4 hours, 1 minute ago:You fought as CARMAN's Capo. Together you defeated aLi and you received $32,500 for doing so.4 hours, 20 minutes ago:You fought as kiddo's Capo. Together you defeated sicillian and you received $32,500 for doing so.4 hours, 59 minutes ago:You fought as Killer Lady T's Capo. Together you defeated El Buzo and you received $32,500 for doing so.5 hours, 34 minutes ago:You fought as Don Shanatello Woods's Capo. Together you defeated Scar face Sarvi and you received $0 for doing so.5 hours, 39 minutes ago:You fought as Ikillu's Capo. Together you defeated Mafia Matilda and you received $32,500 for doing so.5 hours, 40 minutes ago:You fought as JC's Capo. Together you defeated The Snake and you received $0 for doing so.5 hours, 54 minutes ago:You fought as Uncle Paully's Capo. Together you defeated Sergio and you received $32,500 for doing so.5 hours, 55 minutes ago:You fought as Don Ali's Capo. Together you defeated werty and you received $32,500 for doing so.5 hours, 56 minutes ago:You fought as Hell Stud's Capo. Together you defeated roks and you received $32,500 for doing so.6 hours, 3 minutes ago:You fought as "The Introducer"'s Capo. Together you defeated CHOPPER and you received $0 for doing so.6 hours, 13 minutes ago:You fought as O' the Gun's Capo. Together you defeated Killer K and you received $0 for doing so.6 hours, 55 minutes ago:You fought as Willel "Big Willie" Gigante's Capo. Together you defeated Maria and you received $32,500 for doing so.7 hours ago:You fought as Vito Valanelli's Capo. Together you defeated Stammering Bambi Barrow and you received $32,500 for doing so.7 hours, 1 minute ago:You fought as Manuel's Capo. Together you defeated babyface and you received $32,500 for doing so. Don Cuenen Attack: 21 Defense: 91 Health: 169 Energy: 106 Stamina: 15 Top Mafia (Edit) Players can receive one Energy Pak every 24 hours. Send Energy Paks to Everyone Tonino Bruno Energy David Lekens Chuck Supan Shawn Olson Sara Bosmans Andrew Kitchen Tom Young Barb Griffith Mafia Wars News February 27, 2009 Job Masters Wanted! read more... February 20, 2009 Make Em Squeak read more... February 13, 2009 Runnin Solo on Jobs read more... Daily bonus: Hospital heals cost 50% less. Check back tomorrow for a new reward. Adverteren Uw Beetle en kever garage Zowel de kever liefhebbers als de new beetle fan's komen bij ons aan hun trekken ! smart laptop cover Sweetcover, de perfecte bescherming voor je laptop. Stijlvol concept met uitschuifbare handvaten en ventilatie. Levering in 48 uur! Start People Zin in een flexibele job en vlotte contacten? Tot binnenkort op de Start People Week van de Contact Centers van 2 tot 6 maart 2009! Meer advertentiesPagina gemaakt door Mafia WarsContact Rapporteren Over FacebookAdverterenOntwikkelaarsVacaturesGebruiksvoorwaardenVind vriendenPrivacyAccountHelp THAT is everything I get from the webpage without filtering anything out. Edited March 2, 2009 by Overlord Link to comment Share on other sites More sharing options...
NBJ Posted March 2, 2009 Share Posted March 2, 2009 (edited) @overlord. Ok try this: #include<ie.au3> $oIE = _IECreate ("http://apps.facebook.com/inthemafia/") $sText = _IEBodyReadText ($oIE) $output = StringSplit($sText, "Stamina", 1) $stamina = StringLeft ( $output[2] ,StringInStr($output[2],'/')) MsgBox(0,"bla", $stamina) Edited March 2, 2009 by NBJ Link to comment Share on other sites More sharing options...
Overlord Posted March 2, 2009 Author Share Posted March 2, 2009 current on site: Cash ( Go to Bank ) $0 More in 38:24 Health 171/171 Energy 7/110 More in 3:51 Stamina 2/15 More in 2:18 result I got from script: 2/ Link to comment Share on other sites More sharing options...
NBJ Posted March 2, 2009 Share Posted March 2, 2009 (edited) @Overlord. Sorry - subtract 1 from the StringLeft() as below #include<ie.au3> $oIE = _IECreate ("http://apps.facebook.com/inthemafia/") $sText = _IEBodyReadText ($oIE) $output = StringSplit($sText, "Stamina", 1) $stamina = StringLeft ( $output[2] ,StringInStr($output[2],'/')-1) MsgBox(0,"bla", $stamina) Does this now give you the result you require? Edited March 2, 2009 by NBJ Link to comment Share on other sites More sharing options...
Overlord Posted March 2, 2009 Author Share Posted March 2, 2009 result from site: Cash ( Go to Bank ) $31,323 More in 29:29 Health 171/171 Energy 1/110 More in 4:55 Stamina 4/15 More in .... result from script: 4 but will this work always? even when I have more then 100 for instance? It will not display the / anymore? Link to comment Share on other sites More sharing options...
NBJ Posted March 2, 2009 Share Posted March 2, 2009 (edited) @ overlord: Yes this should work always. For a brief explanation $stamina = StringLeft ( $output[2] ,StringInStr($output[2],'/')-1) could have been written: $positionOfSlash = StringInStr($output[2],'/') $positionOfCharacterBeforeSlash = StringInStr($output[2],'/')-1;or $positionOfSlash -1 $stamina = StringLeft($output[2],$positionOfCharacterBeforeSlash ) Edited March 2, 2009 by NBJ Link to comment Share on other sites More sharing options...
Overlord Posted March 2, 2009 Author Share Posted March 2, 2009 Bedankt!! شكرا благодарности 谢谢 hvala tak kiitos merci Danke ευχαριστώ धन्यवाद grazie ありがとう takk dzięki 감사합니다 díky obrigado mulţumesc спасибо gracias tack thanks !!!!!!! :-):-):-):-):-):-):-):-):-):-) Link to comment Share on other sites More sharing options...
NBJ Posted March 2, 2009 Share Posted March 2, 2009 @Overlord, No Problem - glad to help when I can. 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