Skip to content

Instantly share code, notes, and snippets.

@milesegan
Created August 20, 2011 06:22
Show Gist options
  • Save milesegan/1158755 to your computer and use it in GitHub Desktop.
Save milesegan/1158755 to your computer and use it in GitHub Desktop.
fireworks scripts for VST development
// -*- javascript -*-
// Install this in your FireWorks extensions directory.
// It exports all elements with a targetText attribute. It also expects that the elements to
// export are instances of a symbol type.
//
// For instance, create a symbol of type "knob", and place several instances of it on your
// UI with targetText attributes pointing to the string name of the parameter that knob controls.
//
var outURL = "/Users/miles/tmp/layout.txt";
Files.deleteFileIfExisting(outURL);
Files.createFile(outURL, ".txt", "TEXT");
var out = Files.open(outURL, true);
var doc = fw.documents[0];
var layer = doc.layers[doc.currentLayerNum];
var s = "doc " + doc.width + " " + doc.height + "\n";
for (var e = 0; e < layer.elems.length; e++) {
var elem = layer.elems[e];
if (elem.targetText) {
s += [elem.left, elem.top, elem.width, elem.height].join(" ");
s += " ";
s += elem.targetText;
s += " ";
s += elem.symbolName;
s += "\n";
}
}
out.write(s);
out.close();
#!/usr/bin/env python
#
# Stiches together a bunch of individual frames into an image strip suitable for use in VSTGUI.
#
# run it like make_image_strip.py image_0*
from PIL import Image
import sys
def main():
images = sorted(sys.argv[1:])
img = Image.open(images[0])
strip = Image.new('RGBA', (img.size[0], len(images) * img.size[1]))
for i in range(len(images)):
img = Image.open(images[i])
box = (0, img.size[1] * i, img.size[0], img.size[1] * (i + 1))
strip.paste(img, box)
strip.save("strip.png")
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment