Page 1 of 1

Save and Load DATA on GUI to XML

Posted: Wed Aug 10, 2016 4:57 am
by gilar
Hi ... every body ...
I'm trying to save data on GUI to a XML file.
then I want to load later the XML file into GUI.
Here is the GUI ....
Image
I want to save text field, Image Box, and URL to a XML file.
Then when I open GUI again in another time, I just load the XML file to fill the data.
Is it possible?

Comment and help really Apriciate.


Best Regards


Gilar Kadarsah

Re: Save and Load DATA on GUI to XML

Posted: Wed Aug 10, 2016 6:31 am
by gilar
I have succsess load XML file with this script

Code: Select all

on mouseUp
   answer file "Select File"
   if the result is not "cancel" then
      loadFile
   else
   end if
   loadDracoSave
end mouseUp

command loadDracoSave
local tTree
put readDracoSaveToXMLTree() into tTree
if tTree is empty then
exit loadDracoSave
end if
processDracoSaveTree tTree
revDeleteXMLTree tTree
end loadDracoSave

command loadFile
   put it into rawurl
   put rawurl into tDracoSaveFile
end loadFile

// PART 2
private function readDracoSaveToXMLTree
   set the itemDelimiter to slash
   local tDracoSaveFile
   put item 1 to -2 of the effective filename of this stack & "/DracoSave.xml" into tDracoSaveFile
   set the itemDelimiter to comma
   local tDracoSaveData, tResult
   put url ("file:" & tDracoSaveFile) into tDracoSaveData
   //put tDracoSaveFile into tDracoSaveData
   put the result into tResult
   if tResult is not empty then
      answer error "Failed to read Draco's Data file at location: " & tDracoSaveFile
      return empty
   end if
   
   local tTree
   put revCreateXMLTree(tDracoSaveData, false, true, false) into tTree
   if tTree is not an integer then
      answer error "Failed to process preferences file with error: " & tTree
      return empty
   end if
   return tTree
end readDracoSaveToXMLTree

//PART 3 -------- PUT IN TO GUI 
private command processDracoSaveTree pTree
//PLAYER
local tPlayer1
put revXMLNodeContents(pTree, "DracoFootballXpression/DataFootball/DataPlayer/Player1") into tPlayer1
local tPlayer2
put revXMLNodeContents(pTree, "DracoFootballXpression/DataFootball/DataPlayer/Player2") into tPlayer2
local tPlayer3
put revXMLNodeContents(pTree, "DracoFootballXpression/DataFootball/DataPlayer/Player3") into tPlayer3
local tOutput1
put tPlayer1 & return after tPlayer
put tPlayer2 & return after tPlayer
put tPlayer3 & return after tPlayer
set the text of field "player_fld" to tPlayer

//URL LOGO TIM A
local tLogoTimA
put revXMLNodeContents(pTree, "DracoFootballXpression/DataFootball/DataPertandingan/LogoTimA") into tLogoTimA
local tOutput2
put tLogoTimA & return after tOutput2
set the text of field "timA_fld" to tOutput2
end processDracoSaveTree
Now I try to "save as" to XML file

Re: Save and Load DATA on GUI to XML

Posted: Tue May 09, 2017 10:12 am
by kill_iris
Hi Gilar,

I'm pretty much new to .xml or GUI stuff.
Currently I'm Learning the basic stuff of Programming.
Is it possible to Me to have that soccer GUI and xml files?

Thanks