Skip to content
Browse files

Misc development code.

  • Loading branch information...
1 parent 9c10d59 commit cd5e0c91755684aac3f460284c786b7183a65d9a @bomberstudios committed Feb 10, 2010
View
20 Commands/Development/Clear Custom Data.jsf
@@ -0,0 +1,20 @@
+try {
+ fw.runScript(fw.appJsCommandsDir + "/bs.js");
+} catch(e){
+ alert("This command requires the bs.js library\rGet it at http://github.com/bomberstudios/fireworks/");
+};
+
+var doc = fw.getDocumentDOM();
+for (var l=0; l < doc.layers.length; l++) {
+ doc.selectAllOnLayer(l,true,false);
+}
+
+Selection.each(function(e){
+ var data = e.customData;
+ if(data.toSource() == "{ }" ) {
+ // we never manipulated it
+ } else {
+ // erase customData
+ e.customData = null;
+ }
+});
View
16 Commands/Development/Inspect.jsf
@@ -0,0 +1,16 @@
+try {
+ fw.runScript(fw.appJsCommandsDir + "/bs.js");
+} catch(e){
+ alert("This command requires the bs.js library\rGet it at http://bomberstudios.com/fireworks/");
+};
+
+function inspect(o){
+ var debug = '';
+ for (var item in o){
+ debug += item + ": " + o[item] + "\n";
+ }
+ alert(debug);
+ File.create(debug);
+}
+// var what = prompt("What do you want to inspect today?");
+inspect(fw.selection[0]);
View
18 Commands/Development/Rescue.jsf
@@ -0,0 +1,18 @@
+function fix_date(num){
+ num = num.toString();
+ if (num.length < 2) {
+ num = "0" + num;
+ };
+ return num;
+}
+
+var d = new Date();
+var year = d.getFullYear();
+var month = fix_date((d.getMonth() + 1));
+var day = fix_date(d.getDate());
+var hour = fix_date(d.getHours());
+var minute = fix_date(d.getMinutes());
+var seconds = fix_date(d.getSeconds());
+var file_name = year + month + day + hour + minute + seconds;
+
+fw.saveDocumentCopyAs(null, fw.userSymbolLibrariesDir + '/../../../../../Desktop/rescued_document_' + file_name + '.png', false);
View
10 Commands/Development/Reset Resolution.jsf
@@ -0,0 +1,10 @@
+/**DOC**
+Rationale:
+Fireworks has a rounding bug where if you change the resolution units on your document it will fail to remem
+This command resets all open documents' resolution to 72 pixels per inch, as god intended.
+**DOC**/
+
+for (var i=0; i < fw.documents.length; i++) {
+ fw.documents[i].resolution = 72;
+ fw.documents[i].resolutionUnits = 'inch';
+};
View
14 Commands/Development/Safe Prompt.jsf
@@ -0,0 +1,14 @@
+// Rationale: Fireworks gets crazy every now and then, and locks you out of clicking on any window (the infamous "floating panel of hell")
+// This script will try to add a timeout to any script that opens a prompt, and exit the script if it hasn't received text input in a reasonable amount of time.
+
+// UI = {
+// prompt: function(txt,default_value){
+// //setTimeout('quit()',10000);
+// return prompt(txt,default_value);
+// }
+// };
+
+// var foo = UI.prompt("foo?","bar");
+// alert(foo);
+
+alert(document);
View
BIN Common Library/Design Docs/Color Swatch.graphic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1 Common Library/Design Docs/Color Swatch.jsf
@@ -0,0 +1 @@
+/* 2 swatch,fillColor,Color,%230099cc; txt,textChars,Label,%230099CC; */ function setDefaultValues() { var values = new Array(); values.push({ name:"Color", type:"color", value:"#0099cc" }); //values.push({ name:"Label", type:"text", value:"#0099CC" }); Widget.elem.customData["currentValues"] = values; } function applyCurrentValues() { var values = Widget.elem.customData["currentValues"]; Widget.GetObjectByName("swatch").pathAttributes.fillColor = values[0].value; Widget.GetObjectByName("txt").textChars = values[0].value.toUpperCase(); } switch (Widget.opCode) { case 1: setDefaultValues(); break; case 2: applyCurrentValues(); break; }

0 comments on commit cd5e0c9

Please sign in to comment.
Something went wrong with that request. Please try again.