
{"id":28,"date":"2006-05-20T14:34:29","date_gmt":"2006-05-20T13:34:29","guid":{"rendered":"http:\/\/www.matthijskamstra.nl\/blog\/?p=28"},"modified":"2007-11-05T01:51:50","modified_gmt":"2007-11-05T00:51:50","slug":"dir2xml","status":"publish","type":"post","link":"https:\/\/www.matthijskamstra.nl\/blog\/2006\/05\/20\/dir2xml\/","title":{"rendered":"Dir2xml"},"content":{"rendered":"<p>This is a little tool I build with the help of <a href=\"http:\/\/screenweaver.org\/\" target=\"_blank\">Screenweaver<\/a>.<br \/>\nA dir(ectory) 2 XML tool.<\/p>\n<p>I was looking for a program that could create an XML file from a directory. I found some programs that could help me with this (<a href=\"http:\/\/support.microsoft.com\/?scid=kb%3Ben-us%3B196158&amp;x=11&amp;y=15#\" target=\"_blank\">commandline<\/a>, <a href=\"http:\/\/no-nonsense-software.com\/freeware\/\" target=\"_blank\">Printfolder<\/a>, <a href=\"http:\/\/home.pacbell.net\/nitzsche\/dirhtml\/dirhtml.html\" target=\"_blank\">Dirhtml<\/a>) but none of them creates an XML at once. So one evening I sat down, and made this in a couple of hours.<\/p>\n<p>Because this is a custom solution to a specific problem, not everybody will be able to use this. I&#39;m open to suggestions though, so drop me a line.<\/p>\n<h2 class='swf-title'>Dir2xml v1.0<\/h2>\n<p><img decoding=\"async\" id=\"image29\" src=\"http:\/\/www.matthijskamstra.nl\/blog\/wp-content\/uploads\/ScreenShot003.jpg\" alt=\"dir2xml\" \/><\/p>\n<h2 class='swf-title'>PC and Apple<\/h2>\n<p>Sadly enough Screenweaver can&#39;t export to Apple (<a href=\"http:\/\/screenweaver.org\/index.php?option=com_content&amp;task=view&amp;id=14&amp;Itemid=55\" target=\"_blank\">yet<\/a>).<br \/>\nSo Dir2xml will (for now) only work on a pc.<\/p>\n<h2 class='swf-title'>Download<\/h2>\n<p>You can download the EXE, SWF and FLA in a ZIP<\/p>\n<div id=\"highlight\"><strike>Get your stuff here: <a href=\"#\">dir2xml_060520.zip<\/a><\/strike><\/div>\n<p><b>update: <a href=\"http:\/\/www.matthijskamstra.nl\/blog\/?p=35\">new version<\/a><\/b><\/p>\n<h2 class='swf-title'>Licensing<\/h2>\n<div><!--Creative Commons License--> <a href=\"http:\/\/creativecommons.org\/licenses\/by-nc-sa\/2.5\/\" rel=\"license\"><img decoding=\"async\" src=\"http:\/\/creativecommons.org\/images\/public\/somerights20.png\" alt=\"Creative Commons License\" \/><\/a> This work is licensed under a <a href=\"http:\/\/creativecommons.org\/licenses\/by-nc-sa\/2.5\/\" rel=\"license\">Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License<\/a>.<\/div>\n<p><!--more--><\/p>\n<h2 class='swf-title'>Code<\/h2>\n<p>The code is embedded in the fla so I&#39;ll show the code here.<\/p>\n<pre>\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\r\n\/\/ choose a folder to create xml from<br \/>\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\r\nthis.folder_txt.text = &quot;&quot;;<br \/>\r\nthis.button_btn.btn_txt.text = &quot;Choose folder&quot;;<br \/>\r\nthis.button_btn.onRelease = function() {<br \/>\r\ntrace(&quot;- choose folder -&quot;);<br \/>\r\nswSystem.Dialogs.BrowseForFolder(&quot;Please choose a folder...&quot;, _root.onBrowseFolder, this);<br \/>\r\n};<br \/>\r\n\/\/ check if a folder is chosen<br \/>\r\nfunction onBrowseFolder(success, folder) {<br \/>\r\nif (success) {<br \/>\r\n_root.chosenFolder = folder;<br \/>\r\n_root.folder_txt.text = _root.chosenFolder;<br \/>\r\n_root.save_txt.text = _root.chosenFolder + &quot;dir2xml.xml&quot;;<br \/>\r\n_root.file = _root.chosenFolder + &quot;dir2xml.xml&quot;;<br \/>\r\nswDebug.trace(&quot;_root.chosenFolder: &quot; + _root.chosenFolder);<br \/>\r\nswFile.listFolder(_root.chosenFolder, &quot;file&quot;, &quot;&quot;, 0, listFolder_callback, this);<br \/>\r\n} else {<br \/>\r\nswDebug.trace(&quot;- cancel browsing for folder -&quot;);<br \/>\r\n}<br \/>\r\n}<br \/>\r\n\/\/ list folder for files<br \/>\r\n\/\/ escape 250 if necessary<br \/>\r\nfunction listFolder_callback(success, index, data) {<br \/>\r\nif (data.length &lt; 250) {<br \/>\r\nfor (i in data) {<br \/>\r\nswDebug.trace(data[i]);<br \/>\r\n}<br \/>\r\n_root.createXml(data);<br \/>\r\nswDebug.trace(&quot; - finished loading data from folder - &quot;);<br \/>\r\n} else {<br \/>\r\nswFile.listFolder(_root.chosenFolder, &quot;file&quot;, &quot;&quot;, index, listFolder_callback, this);<br \/>\r\n}<br \/>\r\n}<br \/>\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\r\n\/\/ create xml<br \/>\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\r\nfunction createXml(data:Array):Void {<br \/>\r\nswDebug.trace(&quot;createXml - &quot; + data.length);<br \/>\r\nvar writeXml:String = &quot;&quot;;<br \/>\r\nwriteXml += &quot;n&quot;;<br \/>\r\nwriteXml += &quot;n&quot;;<br \/>\r\nfor (var i = 0; i &lt; data.length; i++) {<br \/>\r\nwriteXml += &quot;t&quot; + data[i] + &quot;n&quot;;<br \/>\r\n}<br \/>\r\nwriteXml += &quot;n&quot;;<br \/>\r\n_root.writeXml = writeXml;<br \/>\r\n}<br \/>\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\r\n\/\/ save xml file in<br \/>\r\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<br \/>\r\nthis.save_txt.text = &quot;&quot;;<br \/>\r\nthis.save_btn.btn_txt.text = &quot;Save as&quot;;<br \/>\r\nthis.save_btn.onRelease = function() {<br \/>\r\ntrace(&quot;- Save as -&quot;);<br \/>\r\n_root.SaveFileIn();<br \/>\r\n};<br \/>\r\n\/\/ where<br \/>\r\nfunction SaveFileIn() {<br \/>\r\nswSystem.Dialogs.BrowseForFile_Save(&quot;dir2xml.xml&quot;, [&quot;XML Files&quot;, &quot;*.xml&quot;, &quot;All Files&quot;, &quot;*.*&quot;], _root.saveFileIn, &quot;Save File&quot;, &quot;.xml&quot;, _root.onSaveFileIn);<br \/>\r\n}<br \/>\r\n<br \/>\r\n\/\/ real save<br \/>\r\nfunction onSaveFileIn(success, file) {<br \/>\r\nif (success) {<br \/>\r\nswDebug.trace(&quot;User selected: &quot; + file);<br \/>\r\n_root.file = file;<br \/>\r\n_root.save_txt.text = _root.file;<br \/>\r\n} else {<br \/>\r\nswDebug.trace(&quot;- User did not save to file! -&quot;);<br \/>\r\n}<br \/>\r\n}<br \/>\r\n\/\/ export<br \/>\r\nthis.export_btn.btn_txt.text = &quot;Export XML&quot;;<br \/>\r\nthis.export_btn.onRelease = function() {<br \/>\r\ntrace(&quot;- Export XML -&quot;);<br \/>\r\nstartSaving();<br \/>\r\n};<br \/>\r\nfunction startSaving() {<br \/>\r\nswFile.saveString(_root.file, _root.writeXml, false, _root.onSaveDocument);<br \/>\r\n}<br \/>\r\n\/\/ check<br \/>\r\nfunction onSaveDocument(succes) {<br \/>\r\nif (succes) {<br \/>\r\nswDebug.trace(&quot;- User saved -&quot;);<br \/>\r\ntrace(_root.checkBox_mc.checked);<br \/>\r\nswDebug.trace(&quot;&gt;&gt; &quot; + _root.checkBox_mc.checked);<br \/>\r\nif (_root.checkBox_mc.checked) {<br \/>\r\nswSystem.shellOpenDocument(_root.file);<br \/>\r\n}<br \/>\r\n} else {<br \/>\r\nswDebug.trace(&quot;- something went wrong -&quot;);<br \/>\r\n}<br \/>\r\n}<br \/>\r\n\/\/<br \/>\r\nthis.checkBox_mc.checkbox_txt.text = &quot;Open file&quot;;<\/pre>\n<h2 class='swf-title'>Wish list and To-do<\/h2>\n<p>Features:<\/p>\n<ul>\n<li>Recursive through all folders<\/li>\n<li>Recursive through xx number of folders<\/li>\n<li>Filters for JPG, GIF, Flash 7 images, Flash 8 images<\/li>\n<li>Hidden data in XML (kB, createDate, width, height, URL)<\/li>\n<li>&#8230;..<\/li>\n<\/ul>\n<p>Do you know some features that would make this program better, let me know and drop a line.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a little tool I build with the help of Screenweaver. A dir(ectory) 2 XML tool. I was looking for a program that could create an XML file from a directory. I found some programs that could help me with this (commandline, Printfolder, Dirhtml) but none of them creates an XML at once. So [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,8],"tags":[52,51,398,404,42,399,36],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-flash","category-screenweaver","tag-dir2xml","tag-download","tag-flash","tag-flash-experiments","tag-open-source","tag-screenweaver","tag-xml"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":0,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/posts\/28\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/media?parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/categories?post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.matthijskamstra.nl\/blog\/wp-json\/wp\/v2\/tags?post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}