Home » Stars! 2.6/7 » The Bar » Possible new utility for creating testbeds
Re: Possible new utility for creating testbeds |
Mon, 23 February 2009 17:19 |
|
PaulCr | | Chief Warrant Officer 3 Stars! V.I.P
| Messages: 187
Registered: February 2007 Location: An Island that kinda look... | |
|
Here's a .vbs for pulling the battle plans from the resulting xml file, it could do with some tidying up but it should give a reasonable idea of how you can process the xml file if your language doesn't support it natively.
Edit:Looks like aoutohost is adding extra spaces to it but it should still be understandable, I'll post the script along with a sample xml file on my website tomorrow.
dim fso,file,Result
result="RaceID,BattlePlanID,PrimaryTarget,SecondaryTarg et,AttackWho,Name" &chr(13) & chr(10)
set fso=Createobject("Scripting.filesystemobject")
set file=fso.opentextfile("glr2.m1.xml")
txt=file.readall
file.close
a=1
while a>0
Element=GetElement(txt,"Structure30",a,Attributes)
b=1
RaceID=GetElement(Element,"RaceID",b,RaceIDAttribu tes)
BattlePlanID=GetElement(Element,"BattlePlanID",1,B attlePlanIDAttributes)
PrimaryTarget=GetElement(Element,"PrimaryTarget",1 ,PrimaryTargetAttributes)
SecondaryTarget=GetElement(Element,"SecondaryTarget& ;quo t;,1,SecondaryTargetAttributes)
AttackWho=GetElement(Element,"AttackWho",1,AttackW hoAttributes)
Name=GetElement(Element,"Name",1,NameAttributes)
result=result & GetAttribute(RaceIDAttributes,"value") & ","
result=result & GetAttribute(BattlePlanIDAttributes,"value") & ","
result=result & GetAttribute(PrimaryTargetAttributes,"value") & ","
result=result & GetAttribute(secondaryTargetAttributes,"value") & ","
result=result & GetAttribute(AttackWhoAttributes,"value") & ","
result=result & GetAttribute(NameAttributes,"value") & chr(13) & chr(10)
wend
set file=fso.createtextfile("output.csv")
file.write(result)
file.close
msgbox result
function GetAttribute(Attributes,Attribute)
dim a,b
a=instr(1,attributes,Attribute & "=""")
if a>0 then
b=instr(a+len(Attribute)+2,attributes,"""& ;quo t;)
GetAttribute=mid(Attributes,a+len(Attribute)+2,b-a-len(attri bute)-2)
else
GetAttribute=""
end if
end function
function GetElement(txt,ElementName,byref Start,Attributes)
dim a,b,c
a=instr(start,txt,"<" & ElementName & ">") '<ElementName>...</Elementname>
if a>0 then
b=instr(a+1,txt,"</" & ElementName & ">")
GetElement=mid(txt,a+2+len(ElementName),b-a-2-len(ElementNam e)) & chr(13) & chr(10)
Start=b
else
a=instr(start,txt,"<" & ElementName & " ")
if a>0 then '<ElementName attr></ElementName> or <ElementName attr/>
c=instr(a+1,txt,"/>")
d=instr(a+1,txt,">")
if c>d and d<>0 then '<ElementName attr></ElementName>
b=instr(d+1,txt,"</" & ElementName & ">")
GetElement=mid(txt,d+1,5)
'attributes=mid(txt,a+len(ElementName)+1,d-a-len(ElementName )-1)
start=d
else '<ElementName/>
GetElement=""
attributes=mid(txt,a+len(ElementName)+1,c-a-len(ElementName) -1)
start=c
end if
else
a=instr(start,txt,"<" & ElementName & "/>")
if a>0 then
GetElement=a & "," & b & c
Start=-1
else
GetElement=a & "," & b & c
Start=-1
end if
end if
end if
end function
[Updated on: Mon, 23 February 2009 17:21] Report message to a moderator
|
|
|
|
|
Possible new utility for creating testbeds
By: PaulCr on Sat, 10 January 2009 08:33
|
|
|
Re: Possible new utility for creating testbeds
By: DenHam on Sat, 10 January 2009 19:38
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sat, 10 January 2009 21:24
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sun, 11 January 2009 08:14
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Mon, 12 January 2009 19:23
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Tue, 13 January 2009 05:43
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sun, 01 February 2009 15:56
|
|
|
Re: Possible new utility for creating testbeds
By: Micha on Tue, 13 January 2009 04:38
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Tue, 10 February 2009 11:29
|
|
|
Re: Possible new utility for creating testbeds
By: mlaub on Tue, 10 February 2009 17:05
|
|
|
Re: Possible new utility for creating testbeds
By: Micha on Tue, 10 February 2009 17:10
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Tue, 10 February 2009 17:10
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Tue, 10 February 2009 17:44
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Tue, 10 February 2009 20:56
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 11 February 2009 03:58
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Thu, 12 February 2009 09:13
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Thu, 12 February 2009 17:02
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Thu, 12 February 2009 21:04
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Fri, 13 February 2009 14:26
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Fri, 13 February 2009 16:16
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sat, 14 February 2009 11:48
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sat, 14 February 2009 13:46
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Sat, 14 February 2009 17:17
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sat, 14 February 2009 19:02
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Sun, 15 February 2009 01:02
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sun, 15 February 2009 06:26
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sun, 15 February 2009 14:57
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Sat, 21 February 2009 07:57
|
|
|
Re: Possible new utility for creating testbeds
By: mlaub on Sat, 21 February 2009 12:29
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Mon, 23 February 2009 12:56
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Mon, 23 February 2009 16:01
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Mon, 23 February 2009 17:19
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
trying to use it...
By: Altruist on Tue, 24 February 2009 13:14
|
|
|
Re: trying to use it...
By: PaulCr on Tue, 24 February 2009 13:34
|
|
|
Re: trying to use it...
By: Altruist on Tue, 24 February 2009 14:15
|
|
|
Re: trying to use it...
By: PaulCr on Tue, 24 February 2009 14:35
|
|
|
Re: trying to use it...
|
|
|
Re: trying to use it...
By: PaulCr on Tue, 24 February 2009 17:42
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Tue, 24 February 2009 17:39
|
|
|
Re: Possible new utility for creating testbeds
By: Altruist on Tue, 24 February 2009 19:11
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Tue, 24 February 2009 19:55
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 06:17
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 10:38
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 16:02
|
|
|
Re: Possible new utility for creating testbeds
By: craebild on Wed, 25 February 2009 16:26
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Wed, 25 February 2009 16:41
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 17:01
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 19:37
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Thu, 26 February 2009 12:35
|
|
|
Re: Possible new utility for creating testbeds
By: craebild on Thu, 26 February 2009 14:53
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Thu, 26 February 2009 15:25
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Thu, 26 February 2009 17:49
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Fri, 27 February 2009 06:02
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: mlaub on Fri, 27 February 2009 19:23
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Fri, 27 February 2009 19:45
|
|
|
Re: Possible new utility for creating testbeds
By: mlaub on Fri, 27 February 2009 20:27
|
|
|
Re: Possible new utility for creating testbeds
By: wizard on Fri, 17 April 2009 05:59
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 16:46
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Wed, 25 February 2009 16:50
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 15:34
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: XyliGUN on Tue, 06 July 2010 12:00
|
|
|
Re: Possible new utility for creating testbeds
By: XyliGUN on Tue, 06 July 2010 19:03
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Wed, 25 February 2009 16:23
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: PaulCr on Fri, 17 April 2009 12:30
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: Micha on Wed, 07 July 2010 18:53
|
|
|
Re: Possible new utility for creating testbeds
By: XyliGUN on Thu, 08 July 2010 07:40
|
|
|
Re: Possible new utility for creating testbeds
By: Micha on Thu, 08 July 2010 07:55
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Thu, 08 July 2010 16:51
|
|
|
Re: Possible new utility for creating testbeds
By: Micha on Thu, 08 July 2010 18:55
|
|
|
Re: Possible new utility for creating testbeds
By: XyliGUN on Fri, 09 July 2010 10:06
|
|
|
Re: Possible new utility for creating testbeds
By: Micha on Fri, 09 July 2010 11:17
|
|
|
Re: Possible new utility for creating testbeds
By: XyliGUN on Fri, 09 July 2010 12:45
|
|
|
Re: Possible new utility for creating testbeds
By: Micha on Fri, 09 July 2010 16:39
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Sat, 10 July 2010 01:04
|
|
|
Re: Possible new utility for creating testbeds
|
|
|
Re: Possible new utility for creating testbeds
By: gible on Sun, 11 July 2010 17:37
|
|
|
Re: Possible new utility for creating testbeds
By: nmid on Mon, 26 May 2014 17:11
|
Goto Forum:
Current Time: Tue May 14 02:19:40 EDT 2024
|