Changing a bunch of input splitters (say 100+) automatically by editing .qtz file in TextWrangler or similar.

usefuldesign.au's picture

I know I got this tip from George or someone on these boards but I used this a few times to say a whole-lot-a-time. Did so again today.

You can hack anything in the .qtz file to your hearts content but one easy win is changing splitter settings without having to do it one patch at a time and then re-patch the input and outputs (boring or meditative depending on your POV and deadline!).

So for this example I had a file with a bunch of splitters patched to 100s of arguments on a String Printer patch that generated an XML file.

It looked a bit like

<?xml version="1.0" encoding="utf-8"?>
<hotdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <call_type>Live</call_type>
  <very-hot-data-1>
    <aaa>45454</aaa>
    <aab>SOMETHING</aab>
    <aac>cool</aac>
    <aad>more</aad>
    <aae>%@</aae>
    <aaf>%@</aaf>
    <aag>%@</aag>
    <aah>%@</aah>
    <aai>%@</aai>
    <aaj>%@</aaj>
    <aak>%@</aak>
    <aal>%@</aal>
    <aam>%@</aam>
    <aan>%@</aan>
    <aao>%@</aao>
  </very-hot-data-1>
  <very-hot-data-2>
    <aaa>123</aaa>
    <aab>ELse</aab>
    <aac>mild</aac>
    <aad>less</aad>
    <aae>%@</aae>
    <aaf>%@</aaf>
    <aag>%@</aag>
    <aah>%@</aah>
    <aai>%@</aai>
    <aaj>%@</aaj>
    <aak>%@</aak>
    <aal>%@</aal>
    <aam>%@</aam>
    <aan>%@</aan>
    <aao>%@</aao>
  </very-hot-data-2>
</hotdata>

I had a random generator (triggered at intervals) attached to each input via a labelled splitter (manually changed each patch name from "Input Splitter") so I knew what each Argument No n was related to.

My problem was when I made the 200 splitters with kineme-core the input's were strings and I forgot to look. Later I needed the floating numbers filtered as integers.

INSTRUCTIONS

Open a copy of the .qtz file in a text editor (I used TextWranggler since it has coloured code highlighting (and great grep support).

Search for "QCSplitter" to find your first splitter (helpful if file isn't full ones you don't want to change so maybe save a new comp with just the macro you're working in as little as possible without having to repatch heaps!).

Here's what my first one looks like:

            <dict>
               <key>class</key>
               <string>QCSplitter</string>
               <key>key</key>
               <string>Splitter_1</string>
               <key>state</key>
               <dict>
                  <key>portClass</key>
                  <string>QCStringPort</string>
                  <key>userInfo</key>
                  <data>
                  BAt0eXBlZHN0cmVhbYED6IQBQISE
                  hBNOU011dGFibGVEaWN0aW9uYXJ5
                  AISEDE5TRGljdGlvbmFyeQCEhAhO
                  U09iamVjdACFhAFpApKEhIQITlNT
                  dHJpbmcBlYQBKwRuYW1lhpKEl5gF
                  c2NvcmWGkoSXmAhwb3NpdGlvboaS
                  hISEB05TVmFsdWUAlYQBKoSEDXtf
                  TlNQb2ludD1mZn2bgQE2oYaG
                  </data>
                  <key>version</key>
                  <integer>1</integer>
               </dict>
            </dict>

The actual patch names I gave the splitters, like "Overall Total" must be serialised into the \<data> item because they are nowhere to be seen in the xml file. No matter, it's the <string>QCStringPort</string> elements that need to be changed to <string>QCIndexPort</string>. You can do Replace+Find or do them all in one hit, if you get the same number of replacements as splitters you wanted to change you probably got the right ones.

You could use GREP to make your search more accurate by including more of the surrounding XML code for QCSplitters (remember the name string will change for each patch).

I still wish QC or Kineme Core had a power-user mode for changing settings on multiple patches at one time (and not breaking noodles too) but in the time I save with this hack I could write this post :-)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

usefuldesign.au's picture
Re: Changing a bunch of input splitters (say 100+) ...

A bunch of my splitters are out-by-8 and I need to move the noodles up 8 inputs each. It looks like noodles are stored in the <connection> nodes but it's a bit of a bread crumb search to work out which ones are which and how to change them. Anybody bothered with that before?