Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

CS4 script to CC2015

$
0
0

I'm hoping to get an authors old CS4 script, compatible with CC2015, I'm getting an error on line 2 when running the script ?

 

try {
var paintersWheel = new Object;


paintersWheel.setForeground = function(color) {
  app.foregroundColor = paintersWheel.translateColor(color);  }


paintersWheel.getForeground = function() {
  xml = "<object>";  xml += paintersWheel.convertToXML(app.foregroundColor.rgb.hexValue.toString(), "foreground");  xml += "</object>";  return xml;  }


paintersWheel.setBackground = function(color) {
  app.backgroundColor = paintersWheel.translateColor(color);  }




paintersWheel.setTool_brush = function() {
  xml = "<object>";  xml += paintersWheel.convertToXML(app.foregroundColor.rgb.hexValue.toString(), "foreground");  xml += "</object>";  return xml;  }




paintersWheel.getBackground = function() {
  xml = "<object>";  xml += paintersWheel.convertToXML(app.backgroundColor.rgb.hexValue.toString(), "background");  xml += "</object>";  return xml;  }


paintersWheel.translateColor = function(c) {
  var color = new SolidColor;  color.rgb.red = (c >> 16) & 0xFF;  color.rgb.green = (c >> 8) & 0xFF;  color.rgb.blue = c & 0xFF;  return color;  }


paintersWheel.convertToXML = function(property, identifier) {
   var type = typeof property;   var xml = '<property id = "' + identifier + '" >';     switch(type){      case "number":         xml += "<number>";         xml += property.toString();         xml += "</number>";         break;      case "boolean":         xml += "<" + property.toString() + "/>";         break;      case "string":         xml += "<string>";         xml += property.toString();         xml += "</string>";         break;      case "object":         // Object case is currently not supported         alert("Object case is currently not supported");         //xml += "<object>";         //for(var i in property)         //   xml += convertToXML(property[i],         //xml += "</object>";         break;      case "undefined":         xml += "<string>undefined</string>";         break;      default:         alert("Type " + type + " is unknown.");         return "";   }   xml += '</property>';   return xml;
}


paintersWheel.getVersion = function () {
  xml = "<object>";  xml += paintersWheel.convertToXML(app.version, "version");  xml += "</object>"  return xml;
}




}
catch(e) {
  alert("PaintersWheel error: " + e + " : " + e.line);
}

Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>