Copy link to clipboard
Copied
Hi
I would like to store color-data in a txt-file.
To do this I need data from type string (I guess).
The data comes from a RGBColor-Object.
var newRGBColor = new RGBColor();
To convert to string I tried this
(the idea was to concatenate red, green and blue to a comma speparated string):
var newRGBColorAsStringRed = newRGBColor.red.toString();
But it does not work.
This does not work as well:
var newRGBColorAsString = JSON.stringify(newRGBColor);
Does anybody know how to store the color-data in the txt-file?
var newRGBColor = new RGBColor();
// to get string of names and values of properties of object
var string1 = "";
for (var k in newRGBColor) {
string1 += k + ": " + newRGBColor[k] + "\r";
}
// to save to txt file on desktop
var file1 = new File("~/Desktop/New Text Document.txt");
file1.open("e");
file1.write(string1);
file1.close;
Copy link to clipboard
Copied
var newRGBColor = new RGBColor();
// to get string of names and values of properties of object
var string1 = "";
for (var k in newRGBColor) {
string1 += k + ": " + newRGBColor[k] + "\r";
}
// to save to txt file on desktop
var file1 = new File("~/Desktop/New Text Document.txt");
file1.open("e");
file1.write(string1);
file1.close;