opening xml files in Flowstone

For general discussion related FlowStone
Post Reply
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

opening xml files in Flowstone

Post by KG_is_back »

I'm attempting to open an XML file in flowstone. I've realized that when opened in notepad, the XML file is fairly easy to extract data from (using ruby). However flowstone "open text file" prim does not open XMLs as TXTs - I first have to manually temporarely rename the XML file to .txt and open it then.

I've attempted to rename the file using shell execute prim by calling cmd.exe
the argument is

Code: Select all

ren C:\studio\Synthmaker\Flowstone\Projects\xml\table.xml table.txt


It works well, when I open cmd.exe and type it in manually, but it does nothing when used from flowstone via shell execute prim. This is my first attempt to use shell execute prim, so don't really know what I'm doing. Can someone help me? What am I doing wrong?
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: opening xml files in Flowstone

Post by RJHollins »

Hi KG,

I load XML files for a bunch of my MIDI controller programs.

What I do ... and I'm not sure it is the BESTest way ... but it does work.

From the LOAD prim I send to a TEXT prim. That's the basics.

From there I parse through the text array [using a GETAT Loop] that feeds a RUBY module that is a series of CASE statements. I'm needed to parse out a series of patch names and patch numbers that are headers in the XML file.

Like I say ... nothing cool or fancy [at least not yet]. I've no doubt a full RUBY design might be better to handle anything more complex. I've a better Ruby understanding since putting this part together ... just to find time.

You might want something more 'cool', but if I can help a bit ... just ask.

NOTE: I remember back on the SM forum that our beloved TROG had started to outline an XML routine. Don't know what happen [and definitely miss Him from the forum]. Please stop by and tell us your OK TROG !!! :)
Exo
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK
Contact:

Re: opening xml files in Flowstone

Post by Exo »

As far as I'm aware it should load as a text file, the extension shouldn't matter.

Regarding the shell try this...

Code: Select all

ren "C:\studio\Synthmaker\Flowstone\Projects\xml\table.xml" table.txt


I have found wrapping in quotes usually works.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: opening xml files in Flowstone

Post by tulamide »

I want to confirm that the Text Load Prim loads as text whatever path it is given. Use it with File Dialog for fast access. Works for me.

Alternatively the Ruby version (with trigger input "doit" and string input "path"):

Code: Select all

def init
   @content = ""
end

def event i, v
   if i == 'doit'
      @content = IO.read(@path)
      watch "content", @content
   end
end
"There lies the dog buried" (German saying translated literally)
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: opening xml files in Flowstone

Post by KG_is_back »

Strangely it wasn't working yesterday but it works now... perhaps I did something wrong or stupid, that made it not work. Nevertheless, I wasn't able to make the execute shell to work. Perhaps I will have a look at it once the DSPcode2 project is finished. I stumbled upon few problems in my design there, that made me rework the code generator part from ground up. The development is so sluggish because Flowstone RubyEdit debug screen is bitterly unhelpful.

And thanks Tulamide. Pure ruby version is also very helpful.
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: opening xml files in Flowstone

Post by RJHollins »

Alternatively the Ruby version


Nice Tulamide .... THANKS !! 8-)
Post Reply