Blue Eye Logo

Blue Eye Macro

Automation is freedom
It is currently Tue Apr 25, 2017 2:53 am

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Sun May 06, 2012 2:56 pm 
Contributor
Contributor
User avatar



Joined: Mon Apr 30, 2012 11:58 am
Posts: 58
Location: The Netherlands
Been thanked: 48 time(s)
Has thanked: 1 time(s)
Contribution Points: 829
XML Reader Plugin

    Read from your XML files. Open up countless of possibilities.
  • Read your macro settings easily from XML files.
  • Create a mob database containing every data needed.
  • And much more...


    Functions:
    - XML read element with name (first) (string path, string elementName, string output)
    - XML read element with name (index) (string path, string elementName, int index, string output)
    - XML read element where attribute value is (first) (string path, string attributeName, string attributeValue, string elementName, string output)
    - XML read element where attribute value is (index) (string path, string attributeName, string attributeValue, string elementName, int index, string output)

    - XML read attribute with name (first) (string path, string attributeName, string output)
    - XML read attribute with name (index) (string path, string attributeName, int index, string output)
    - XML read attribute from element with name (first) (string path, string elementName, string attributeName, string output)
    - XML read attribute from element with name (index) (string path, string elementName, string attributeName, int index, string output)

    - XML count elements with name (string path, string elementName, string output)
    - XML count elements with value (string path, string elementValue, int index, string output)
    - XML count attributes with name (string path, string attributeName, string output)
    - XML count attributes with value (string path, string attributeValue, string output)

Please report any bugs to me!

Test script using the provided mobs.xml at the bottom: (Don't forget to set the path)
Code:
  begin
     Variable.Set("XMLPath", "mobs.xml") // Set the XML path
     //Uncomment the Function.Execute below to test other functions.
     Function.Execute("readElementName")
     //Function.Execute("readElementNameWithAttribute")
     //Function.Execute("readAttributeWithName")
     //Function.Execute("readAttributeFromElementWithName")
     //Function.Execute("countElements")
     //Function.Execute("countAttributes")
 end

function("readElementName")
     begin
          Plugins.XML read element with name (first)("{XMLPath}", "R", "firstR")
          Plugins.XML read element with name (index)("{XMLPath}", "R", "1", "secondR")
          Plugins.XML read element with name (index)("{XMLPath}", "R", "2", "thirdR")
          Variable.Evaluate (Text)("{firstR} and {secondR} should be the same and {thirdR} should be diffrent.", "output")
          Window.Display message box("{output}", "yes")
     end
function

function("readElementNameWithAttribute")
     begin
          Plugins.XML read element with attribute value (first)("{XMLPath}", "type", "Normal", "G", "firstG")
          Plugins.XML read element with attribute value (index)("{XMLPath}", "type", "Normal", "G", "1", "secondG")
          Plugins.XML read element with attribute value (index)("{XMLPath}", "type", "Normal", "G", "2", "thirdG")
          Variable.Evaluate (Text)("{firstG} and {secondG} should be the same and {thirdG} should be diffrent.", "output")
          Window.Display message box("{output}", "yes")
     end
function

function("readAttributeWithName")
     begin
          Plugins.XML read attribute with name (first)("{XMLPath}", "name", "firstName")
          Plugins.XML read attribute with name (index)("{XMLPath}", "type", "1", "firstType")
          Plugins.XML read attribute with name (index)("{XMLPath}", "name", "2", "secondName")
          Variable.Evaluate (Text)("{firstName}'s type is {firstType} which in this case is the same type as {secondName}'s type", "output")
          Window.Display message box("{output}", "yes")
     end
function

function("readAttributeFromElementWithName")
     begin
          Plugins.XML read attribute from element with name (first)("{XMLPath}", "MOB", "name", "firstName")
          Plugins.XML read attribute from element with name (index)("{XMLPath}", "MOB", "name", "2", "secondName")
          Plugins.XML read attribute from element with name (index)("{XMLPath}", "MOB", "type", "2", "secondType")
          Variable.Evaluate (Text)("{firstName} and {secondName} are both a {secondType} type", "output")
          Window.Display message box("{output}", "yes")
     end
function

function("countElements")
     begin
          Plugins.XML count elements with name("{XMLPath}", "MOB", "mobCount")
          Plugins.XML count elements with value("{XMLPath}", "Yes", "attackableCount")
          if  Variable.Is equal to("attackableCount", "1")
               begin
                    Variable.Set("IsAre", "is")
               end
          if  Macro.Previous criteria was not met()
               begin
                    Variable.Set("IsAre", "are")
               end
          Variable.Evaluate (Text)("Found {mobCount} mobs of which {attackableCount} {IsAre} attackable.", "output")
          Window.Display message box("{output}", "yes")
     end
function

function("countAttributes")
     begin
          Plugins.XML count attributes with name("{XMLPath}", "name", "nameCount")
          Plugins.XML count attributes with value("{XMLPath}", "Normal", "normalCount")
          if  Variable.Is equal to("normalCount", "1")
               begin
                    Variable.Set("IsAre", "is")
               end
          if  Macro.Previous criteria was not met()
               begin
                    Variable.Set("IsAre", "are")
               end
          Variable.Evaluate (Text)("Found {nameCount} names of which {normalCount} {IsAre} normal types.", "output")
          Window.Display message box("{output}", "yes")
     end
function
 


Attachments:
XMLPlugin.dll [12 KiB]
Downloaded 643 times
mobs.xml [464 Bytes]
Downloaded 618 times

_________________
Plugins
[Plugin] XML Reader
[Plugin] Human mouse movement
Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Mon May 07, 2012 6:40 am 
Silver Contributor
Silver Contributor
User avatar



Joined: Sun Feb 07, 2010 9:11 pm
Posts: 207
Been thanked: 5 time(s)
Has thanked: 19 time(s)
Contribution Points: 5596
Thanks a lot for posting :)

It looks interesting and I'm sure it will be useful!

_________________
Code:
Martin

Full-time Macroholic


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Mon May 07, 2012 8:44 am 
Lifetime VIP Contributor
Lifetime VIP Contributor
User avatar



Joined: Mon Sep 26, 2011 9:38 am
Posts: 1700
Location: Space Australia
Been thanked: 78 time(s)
Has thanked: 6 time(s)
Contribution Points: 9985
Will have to check this out

I think i already have something i could use this for!!!

_________________
ImageImageImageImage
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Mon May 07, 2012 11:35 am 
Contributor
Contributor
User avatar



Joined: Mon Apr 30, 2012 11:58 am
Posts: 58
Location: The Netherlands
Been thanked: 48 time(s)
Has thanked: 1 time(s)
Contribution Points: 829
Thanks for your replies. I will soon start working on write functions too. And maybe other functions. If anyone have suggestions. Feel free to tell me.

_________________
Plugins
[Plugin] XML Reader
[Plugin] Human mouse movement


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Mon May 07, 2012 5:51 pm 
Contributor
Contributor
User avatar



Joined: Mon Apr 16, 2012 11:44 am
Posts: 87
Been thanked: 5 time(s)
Has thanked: 2 time(s)
Contribution Points: 204
Great post. Definitely checking this out and looking forward to that write to XML file function.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Mon May 07, 2012 11:34 pm 
Lifetime VIP Contributor
Lifetime VIP Contributor
User avatar



Joined: Mon Sep 26, 2011 9:38 am
Posts: 1700
Location: Space Australia
Been thanked: 78 time(s)
Has thanked: 6 time(s)
Contribution Points: 9985
DaMaGeX wrote:
Thanks for your replies. I will soon start working on write functions too. And maybe other functions. If anyone have suggestions. Feel free to tell me.


Hmmm well i was going to suggest a wright function till you said thay

What about
Plugin.Xml compare [insert variation here]

and it would tell you what changes have been made between the two (your obviously well versed with coding so i expect your better then i am with regex ("okay so this pattern should return 1 if i type X=1... No match the fuck okay then what if i put this in X= 1... Capture group 1 = 1 finally pretty random that" thats a problem i got with this pattern /(?:X:|X=|X)(.[0-9]+)/i i dont see anything in there that needs a space))

_________________
ImageImageImageImage
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Mon May 07, 2012 11:51 pm 
Contributor
Contributor
User avatar



Joined: Mon Apr 30, 2012 11:58 am
Posts: 58
Location: The Netherlands
Been thanked: 48 time(s)
Has thanked: 1 time(s)
Contribution Points: 829
Currently I'm trying to figure out how to change values from specific elements or attributes.
I can only write new lines on the document at the moment. I will look into the compare functions too. Nice suggestion. It may also be useful to read files that are being edit by other programs.

And about regex that's not really my thing, you can try asking at stackoverflow.com.

_________________
Plugins
[Plugin] XML Reader
[Plugin] Human mouse movement


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Tue May 08, 2012 4:02 pm 
Partner / Developer
Partner / Developer
User avatar



Joined: Mon Jan 18, 2010 11:51 am
Posts: 4520
Been thanked: 1136 time(s)
Has thanked: 131 time(s)
Contribution Points: 32706
Very nice job.

Thank you for sharing!

Suggestion:
A function for selecting using XPath selectors to specify the node your interested in within the document.

_________________
Blue Eye - Developer / Moderator
Code:
Gigus


Please read the rules about contribution points - click here

Do you know everything about BE, the forum, licenses and contribution points?
Please take a minute to read this introduction & guidelines.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Tue May 08, 2012 4:05 pm 
Contributor
Contributor
User avatar



Joined: Mon Apr 30, 2012 11:58 am
Posts: 58
Location: The Netherlands
Been thanked: 48 time(s)
Has thanked: 1 time(s)
Contribution Points: 829
Gigus wrote:
Suggestion:
A function for selecting using XPath selectors to specify the node your interested in within the document.


I've been looking into that, the problem was that the reference System.Xml.XPath wasn't serializable.
I might be able to bypass that writing my own XPath function though. Thanks for the suggestion.

_________________
Plugins
[Plugin] XML Reader
[Plugin] Human mouse movement


Top
 Profile  
Reply with quote  
 Post subject: Re: [Plugin] XML Reader
Thanked: 0 time(s)  Unread post Posted: Wed Jul 30, 2014 12:18 am 
Silver Contributor
Silver Contributor
User avatar



Joined: Tue Jul 29, 2014 7:37 am
Posts: 104
Location: Leviamon
Been thanked: 8 time(s)
Has thanked: 12 time(s)
Contribution Points: 146
I guess you are a programmer
you post help me alot cause im newbie, thanks <3




HIT THANKS IF I HELP YOU <3

_________________
Bad english sorry
Do not forget to hit thanks button
Image

Bot for kill argo,grankuwa,pielvulca and auto-booster(you can write) http://www.blueeye-macro.com/viewtopic.php?f=304&t=19895


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group