lokster Posted May 31, 2007 Share Posted May 31, 2007 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 More sharing options...
Lazycat Posted May 31, 2007 Share Posted May 31, 2007 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. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
lokster Posted June 1, 2007 Author Share Posted June 1, 2007 But what the advantage of this method over regular? You anyway need to handle your GUI in some way.Yes, of course, but why not? I will try it. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 1, 2007 Moderators Share Posted June 1, 2007 (edited) #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 June 1, 2007 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 More sharing options...
jvanegmond Posted June 1, 2007 Share Posted June 1, 2007 Hmm, interesting idea but it does mean you have to include a GUI file with the code. I'd rather have Koda accept actual script and you can edit that. github.com/jvanegmond Link to comment Share on other sites More sharing options...
lordofthestrings Posted June 1, 2007 Share Posted June 1, 2007 that would indeed be verry strong functionality (@manadar) I was hoping KODA could one day figure out from a script what the gui form should look like. Link to comment Share on other sites More sharing options...
lokster Posted June 1, 2007 Author Share Posted June 1, 2007 No SmOke_N - you get the idea right. Today I sarted to work on form parser with _XMLDomWrapper.au3 Link to comment Share on other sites More sharing options...
Zedna Posted June 1, 2007 Share Posted June 1, 2007 I'd rather have Koda accept actual script and you can edit that.Koda from version 1.6.1.2 can do that.Look at File/Import/Import Autoit GUI Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
lokster Posted June 2, 2007 Author Share Posted June 2, 2007 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 More sharing options...
Richard Robertson Posted June 2, 2007 Share Posted June 2, 2007 I think you've got a good idea going here. You said you were unsure how to create variables, look up Assign() in the help file. It allows you to declare variables if they do not exist when you set them using Assign(). Link to comment Share on other sites More sharing options...
lokster Posted June 2, 2007 Author Share Posted June 2, 2007 10x Mr Icekirby, but in the 2nd post Lazycat told me about this func. I already have partially working parsing of the kxf, but for now it's too buggy and incomplete to post it... Link to comment Share on other sites More sharing options...
Lazycat Posted June 2, 2007 Share Posted June 2, 2007 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). Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 3, 2007 Share Posted June 3, 2007 Oh, I didn't notice that Lazycat said that. Are you parsing the kxf using your own code or a generic XML reader? Link to comment Share on other sites More sharing options...
lokster Posted June 4, 2007 Author Share Posted June 4, 2007 I am using the _XMLDomWrapper.au3 UDF, but later maybe I will try without it - I don't want the final script to be dependent on other scripts. 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