Romm Posted January 11, 2008 Share Posted January 11, 2008 Here is xml... <?xml version="1.0" encoding="utf-8" ?> - <hunt> - <bots> <bot id="3162125" name="A" level="3" pic="tks_snegnik_2_small.gif" sk="2015" agrlevel="0" x="1001" y="459" fight_id="0" /> <bot id="7994" name="B" level="2" pic="jakal_small.jpg" sk="2000" agrlevel="20" x="856" y="520" fight_id="0" /> <bot id="2812381" name="C" level="1" pic="jakal_small.jpg" sk="2000" agrlevel="0" x="920" y="520" fight_id="0" /> <bot id="1061863" name="D" level="2" pic="ris_small.jpg" sk="2005" agrlevel="20" x="915" y="1228" fight_id="0" /> I want to make script that will search by name. 1) Search A 2.1) If fight_id value = 0 Then $level = " get level value of A" $id = " get bot id value of A" ($level = 3, $id = 3162125) 2.2) If fight_id value <>0 Then .... Can somebody help me? I dont think that it is posible...but maybe... This script will search into web browser.... Link to comment Share on other sites More sharing options...
Zedna Posted January 11, 2008 Share Posted January 11, 2008 (edited) Look here and hereNext time use forum Search engine first :-) Edited January 11, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Romm Posted January 11, 2008 Author Share Posted January 11, 2008 (edited) i still cant understand how i cant get "level" value from this.<bot id="3554662" name="AAA" level="1" pic="jakal_small.jpg" sk="2000" agrlevel="0" x="1411" y="1149" fight_id="0" /> if something like <a>5</a> all is ok..._GetFirstValue Edited January 11, 2008 by Romm Link to comment Share on other sites More sharing options...
weaponx Posted January 11, 2008 Share Posted January 11, 2008 (edited) Merry X-Mas... #include <_XMLDomWrapper.au3> #include <Array.au3> $sXMLFile = "test3.xml" $result = _XMLFileOpen($sXMLFile) if $result = 0 then Exit $sXPath = '//bots/bot[@name = "A"]' $fight_id = _XMLGetAttrib ($sXPath, "fight_id") If @Error Then MsgBox(0,"","Name not found") If $fight_id = 0 Then ;Do stuff Else ;Do other stuff EndIf test3.xml: <?xml version="1.0" encoding="utf-8"?> <hunt> <bots> <bot id="3162125" name="A" level="3" pic="tks_snegnik_2_small.gif" sk="2015" agrlevel="0" x="1001" y="459" fight_id="0" /> <bot id="7994" name="B" level="2" pic="jakal_small.jpg" sk="2000" agrlevel="20" x="856" y="520" fight_id="0" /> <bot id="2812381" name="C" level="1" pic="jakal_small.jpg" sk="2000" agrlevel="0" x="920" y="520" fight_id="0" /> <bot id="1061863" name="D" level="2" pic="ris_small.jpg" sk="2005" agrlevel="20" x="915" y="1228" fight_id="0" /> </bots> </hunt> Edited January 11, 2008 by weaponx Link to comment Share on other sites More sharing options...
Romm Posted January 11, 2008 Author Share Posted January 11, 2008 Name not found Link to comment Share on other sites More sharing options...
weaponx Posted January 11, 2008 Share Posted January 11, 2008 Name not found I tested it like 9 times. It works fine. Did you use your own xml or mine? Link to comment Share on other sites More sharing options...
Romm Posted January 11, 2008 Author Share Posted January 11, 2008 (edited) all is ok now Edited January 11, 2008 by Romm Link to comment Share on other sites More sharing options...
Romm Posted January 12, 2008 Author Share Posted January 12, 2008 now another problem XML file is written "inside" .php. hunt_conf.php... But when you open it, you see XML... How to load this XML? I tried _IEBodyReadText, InetGet, but it is imposible to make xml... Link to comment Share on other sites More sharing options...
Romm Posted January 12, 2008 Author Share Posted January 12, 2008 Ok only idea i have $IE_Conf = _IECreate("http://3k.mail.ru/hunt_conf.php", 1, 0) $c = _IEBodyReadText ($IE_Conf) FileWrite ("test2.txt", $c) $d = FileReadLine("test2.txt", 5) But how to insert this line to xml??? Link to comment Share on other sites More sharing options...
weaponx Posted January 12, 2008 Share Posted January 12, 2008 If the PHP script is generating straight XML, you can use this: #include <INet.au3> $XML = _INetGetSource ( $s_URL ) Link to comment Share on other sites More sharing options...
Romm Posted January 12, 2008 Author Share Posted January 12, 2008 (edited) OK if i use: $IE_Conf = _IECreate("http://3k.mail.ru/hunt_conf.php", 1, 0) $A = _IEBodyReadText ($IE_Conf) MsgBox(1, "", $A) I got XML...but like a text and i cant use it... If i use $XML = _INetGetSource ("http://3k.mail.ru/hunt_conf.php") MsgBox(1, "", $XML) I got: <scipt>top.location.href="index.php";</script> Edited January 12, 2008 by Romm Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted January 12, 2008 Share Posted January 12, 2008 OK if i use: $IE_Conf = _IECreate("http://3k.mail.ru/hunt_conf.php", 1, 0) $A = _IEBodyReadText ($IE_Conf) MsgBox(1, "", $A) I got XML...but like a text and i cant use it... If i use $XML = _INetGetSource ("http://3k.mail.ru/hunt_conf.php") MsgBox(1, "", $XML) I got: <scipt>top.location.href="index.php";</script> Then use the first one... I don't see the problem. Just combine the first one with the code posted above. Then either save the source to a temporary file, and just label it .xml even though it won't matter whether it be txt or xml or whatever else. Then use the code above, change the location of the XMLFileOpen and you should be good to go. Link to comment Share on other sites More sharing options...
Romm Posted January 12, 2008 Author Share Posted January 12, 2008 (edited) Uhh another problem...if for example @name = "word in NON English language" (russian) i always get an error Is is posible to delete all @name from file? Ah... ok done... _ReplaceStringInFile ("test2.txt", "ss", "dd", 1, 1) Edited January 12, 2008 by Romm 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