AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Parsing/Changing an XML comment.

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Elesar



Joined: 28 Jun 2007
Posts: 95

PostPosted: Wed May 28, 2008 10:17 pm    Post subject: Parsing/Changing an XML comment. Reply with quote

I am working on a script that will allow me to update the UI Mod files for the MMO Age of Conan.

I have created a custom mod for this game, but there is a slight anoyance.

Whenever the game is patched (Which is quite frequent, since the game is only a week old), the UI file version numbers change.

My code so far will parse out what the current and new version numbers are, and list the files to be updated.

What I Have:
Code:

#SingleInstance Force
#NoEnv

Gui, Add, Text, x6 y6 w125 h20, Age of Conan Directory:
Gui, Add, Edit, x131 y6 w290 h20 vInstDir, Select Install Directory
Gui, Add, Button, x426 y6 w50 h20 gInstPath, ...
Gui, Add, Text, x6 y26 w125 h20, Mod project Directory:
Gui, Add, Edit, x131 y26 w290 h20 vModDir, Select Project Directory
Gui, Add, Button, x426 y26 w50 h20 gPath, ...
Gui, Add, Text, x6 y46 w125 h20, Current UI file version:
Gui, Add, Text, x131 y46 w50 h20 vCurVer,
Gui, Add, Text, x216 y46 w100 h20, New UI file version:
Gui, Add, Text, x326 y46 w50 h20 vNewVer,
Gui, Add, ListView, x6 y66 w476 h100, File|Location
Gui, Add, Button, x6 y166 w476 h20 gUpdate, Update Now
Gui, Show, xCenter yCenter w482 h192, GUI Mod Updater
Return

InstPath:
  FileSelectFolder, InstDir, *C:\Program Files\Funcom\Age of Conan, 0
  Sleep, 10
  GuiControl,, InstDir, %InstDir%
  FileReadLine, NewVer, %InstDir%\cd_image\Gui\Default\Modules.xml, 2
  StringSplit, NewVerArray, NewVer, $:, %A_Space%
  GuiControl,, NewVer, %NewVerArray3%
  Return

Path:
  FileSelectFolder, ModDir, *C:\, 0
  Sleep, 10
  GuiControl,, ModDir, %ModDir%
  Loop, %ModDir%\*.xml, 0, 1
    {
      If A_Index = 1
        {
            FileReadLine, CurVer, %A_LoopFileFullPath%, 2
            StringSplit, CurVerArray, CurVer, $:, %A_Space%
            GuiControl,, CurVer, %CurVerArray3%
        }
      LV_Add("",A_LoopFileName, A_LoopFileDir)
    }
  LV_ModifyCol(1)
  Return

Update:
  Gui, Submit, NoHide
  Loop, %ModDir%\*.xml, 0, 1
    {
      FileReadLine, VerLine, %A_LoopFileFullPath%, 2                         ;This is all just debug crap that I used to determine if I was actually accessing the files.
      StringSplit, Array, VerLine, $:, %A_Space%
      MsgBox, The file version for %A_LoopFileName%`nis %Array3%
    }
  Return

Esc::
  GuiClose:
  ExitApp


Sample UI File:
Code:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- $Change: 48416 $ (must be within the first 200 characters of the file) -->
<View xmlns:template="template.dtd"
      xmlns:nocreate="nocreate.dtd"
      view_layout="horizontal"
      v_alignment="BOTTOM"
      _view_flags="WID_HANDLE_MOUSE">
  <!-- <template:ShortcutView layout_borders="Rect(0,0,0,0)"
                         out_of_range_bitmap="icons/outofrange_icon.tga"
                         icon_spacing="2"
                         slot_template="SlotTemplate">
    <template:ItemSlotView template:name="SlotTemplate"
                           layout_borders="Rect(2,0,2,0)"
                           slot_size="Point(32,32)"
                           icon_borders="Point(0,0)"
                           max_zoom="1.0"
                           gfx_background="" />
  </template:ShortcutView> -->
  <View view_layout="vertical">
    <View view_layout="horizontal"
          v_alignment="BOTTOM"
          layout_borders="Rect(-5,0,-5,-16)">
      <View view_layout="stacked"
            layout_borders="Rect(0,0,75,15)">
        <SoulFragmentBar />
        <PetCommandBar />
      </View>
      <View name="LPortraitViewDock"
            view_layout="stacked"
            h_alignment="LEFT"
            _min_size_limit="Point(-1,COORD_MAX)"
            _max_size_extend="Point(COORD_MAX,-1)"
            layout_borders="Rect(-115,0,0,0)" />
    </View>
  </View>

  <View view_layout="vertical"
        v_alignment="BOTTOM"
        layout_borders="Rect(0,0,0,0)">
    <View view_layout="vertical"
          layout_borders="Rect(-150,0,-150,0)">
   <View name="CombatRoseDock"
            view_flags="WID_IGNORE_WHEN_HIDDEN"
            view_layout="stacked"
            layout_borders="Rect(0,0,0,4)" />
      <!-- <ShortcutView name="CombatBar1"
                    layout_borders="Rect(0,0,0,4)"
                    slot_bg_gfx="bottombars/ASB/asb_slot.tga"
                    first_slot="100"
                    slot_count="3"
                    hotkeyrange_start="Shortcutbar_1"
                    hotkeyrange_lenght="3" />
      <ShortcutView name="CombatBar2"
                    layout_borders="Rect(0,0,0,4)"
                    slot_bg_gfx="bottombars/ASB/asb_slot.tga"
                    first_slot="110"
                    slot_count="3"
                    hotkeyrange_start="Shortcutbar_11"
                    hotkeyrange_lenght="3" />
    </View>

    <ShortcutView name="ShortcutBar1"
                  layout_borders="Rect(0,0,0,4)"
                  slot_bg_gfx="bottombars/ASB/asb_slot.tga"
                  first_slot="103"
                  slot_count="7"
                  hotkeyrange_start="Shortcutbar_4"
                  hotkeyrange_length="7" />
    <ShortcutView name="ShortcutBar2"
                  layout_borders="Rect(0,0,0,4)"
                  slot_bg_gfx="bottombars/ASB/asb_slot.tga"
                  first_slot="300"
                  slot_count="12"
                  hotkeyrange_start="Shortcutbar2_Alt1"
                  hotkeyrange_length="12" />
    <ShortcutView name="ShortcutBar3"
                  layout_borders="Rect(0,0,0,4)"
                  slot_bg_gfx="bottombars/ASB/asb_slot.tga"
                  first_slot="0"
                  slot_count="12"
                  hotkeyrange_start="Shortcutbar3_1"
                  hotkeyrange_length="12" />
  </View> -->
  <View view_layout="vertical">
    <View view_layout="horizontal"
          v_alignment="BOTTOM"
          layout_borders="Rect(-5,0,-5,-16)">
      <View name="RPortraitViewDock"
            view_layout="stacked"
            h_alignment="LEFT"
            _min_size_limit="Point(-1,COORD_MAX)"
            _max_size_extend="Point(COORD_MAX,-1)"
            layout_borders="Rect(-6,0,0,0)" />
    </View>
  </View>
</View>


The second line of this file, which is a comment, is the one the game checks for the version (or change) number.

I looked at xPath, but could not determine how you would go about altering a comment, since comments are normally not something that you would need to change.

Maybe I just overlooked something.

Any help greatly appreciated.
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1187
Location: Enterprise, Alabama

PostPosted: Wed May 28, 2008 11:10 pm    Post subject: Reply with quote

Search the forums for XPath.
_________________
ScriptPad/~dieom/dieom/izwian2k7/Ian/God

Back to top
View user's profile Send private message
Elesar



Joined: 28 Jun 2007
Posts: 95

PostPosted: Wed May 28, 2008 11:38 pm    Post subject: Re: Parsing/Changing an XML comment. Reply with quote

Elesar wrote:
I looked at xPath, but could not determine how you would go about altering a comment, since comments are normally not something that you would need to change.

Maybe I just overlooked something.


Still not seeing it. Have been reading that documentation and thread for oh, about two hours now.
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1187
Location: Enterprise, Alabama

PostPosted: Wed May 28, 2008 11:39 pm    Post subject: Reply with quote

Oh, my bad Laughing

Get on the IRC and talk to Titan about it.
_________________
ScriptPad/~dieom/dieom/izwian2k7/Ian/God

Back to top
View user's profile Send private message
Elesar



Joined: 28 Jun 2007
Posts: 95

PostPosted: Wed May 28, 2008 11:40 pm    Post subject: Reply with quote

Hmm, Kinda at work, and I can't get to IRC from here. May be able to once I get home tonight, if anybody is on at midnight EST Confused
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1187
Location: Enterprise, Alabama

PostPosted: Wed May 28, 2008 11:41 pm    Post subject: Reply with quote

mibbit.com
_________________
ScriptPad/~dieom/dieom/izwian2k7/Ian/God

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group