Jump to content

Parsing Koda .kxf file?


Recommended Posts

Hm... I got an Idea to make script which parses Koda *.kxf file and creates the form defined in it.

Something like Glade. I mean, instead of

$Form1 = GUICreate("Form1", 320, 240, -1, -1)
;etc. ....
GUISetState(@SW_SHOW)
oÝ÷ Ù:!j÷¬¢g­)à)jëh×6
GUICreateFromKXF("form1.kxf")

The XML parsing is not a big problem.

The problem is that I don't know is it possible to create variable variables in autoit, so when the XML parser finds

<object type="TAForm" name="AForm1">

to create variable named $AForm1... Any Ideas?

Link to comment
Share on other sites

Hm... I got an Idea to make script which parses Koda *.kxf file and creates the form defined in it.

...

The XML parsing is not a big problem.

The problem is that I don't know is it possible to create variable variables in autoit, so when the XML parser finds

<object type="TAForm" name="AForm1">

to create variable named $AForm1... Any Ideas?

I think this can be easily done with UDF. Autoit can create variables with Assign function.

But what the advantage of this method over regular? You anyway need to handle your GUI in some way.

Link to comment
Share on other sites

  • Moderators

#include <array.au3>
$sString = FileRead('AForm1.kxf')
$aArray = StringRegExp($sString, '(?s)(?i)\<object type=".*?" name="(.*?)">', 3)
$sHoldArray = ''
For $iCC = 0 To UBound($aArray) - 1
    $sHoldArray &= '$' & $aArray[$iCC] & @LF
Next
$aNewArray = StringSplit(StringTrimRight($sHoldArray, 1), @LF)
_ArrayDisplay($aNewArray)

Edit:

After reading this again, I may have the wrong idea of what you are wanting ...

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

But Zenda, Import is not equal to editing the actual gui code. For me it's not practical to have the gui stored in 2 different files with two different formats - the .kxf file and the real au3 code.

This is my personal opinion. Anyway, I will continue wokring on the kxf parser script and when (if) I finsh it I will post i in the forum - maybe someone will make use of it.

Link to comment
Share on other sites

But Zenda, Import is not equal to editing the actual gui code. For me it's not practical to have the gui stored in 2 different files with two different formats - the .kxf file and the real au3 code.

This is my personal opinion. Anyway, I will continue wokring on the kxf parser script and when (if) I finsh it I will post i in the forum - maybe someone will make use of it.

Technically it's not impossible to save/load actual code, but in this case generated code should have strong structure, for example without literal styles that allow easier code reading by human, but harder parsing.

Second way, that some time ago I had a thought: xml - is just a text, so it's possible to keep form in the script inside comment tag. This is very easy to implement, except the only problem - when big picture loaded, size of form grows a lot, so it's need to change in way, that pictures will not keep inside form (this behaviour btw I'm dislike a long time).

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...