Closed schroef closed 3 years ago
Doing a google with the first couple characters and it was indeed a BinaryString. Now i wonder what you used to create this. I vaguely remember using this before but cant remember what i used back then :(
I dug around, here's the function I used to turn an image into string: `#target illustrator
function test(){ var chosenFile = File.openDialog("Choose file"); if(chosenFile == null){ return; } var infile = File(chosenFile.fsName.replace('file://', '')); infile.open ("r"); infile.encoding = "binary"; var temp = infile.read(); infile.close();
var encodedImageData = temp.toSource().replace('(new String("', "").replace('"))', ""); var encodedImageDataURI = encodeURI(temp);
var w = new Window("dialog", "Image Data"); w.margins = [4,4,4,4]; w.spacing = 4; var g0 = w.add("tabbedpanel"); g0.spacing = 2;
var t1 = g0.add("tab", undefined, "Encoded"); var disp_imageData = t1.add("edittext", undefined, encodedImageData, {multiline : true}); disp_imageData.size = [400, 400];
var t2 = g0.add("tab", undefined, "URI Encoded"); var disp_imageDataURI = t2.add("edittext", undefined, encodedImageDataURI, {multiline : true}); disp_imageDataURI.size = [400, 400];
var t3 = g0.add("tab", undefined, "How well the image shows up"); try { var uiImg = ScriptUI.newImage(decodeURI(encodedImageDataURI)); t3.add("image", undefined, uiImg); } catch(e){ t3.add("statictext", undefined, "Sorry, this image data could not be made into ScriptUI newImage() for some reason.", {multiline : true}); }
var g_btn = w.add("group"); var btn_ok = g_btn.add("button", undefined, "Oookay"); // w.defaultElement = btn_ok; // caused crash - had to switch to Window.close event. btn_ok.size = [400, 26];
btn_ok.onClick = function(){ w.close(); }
w.show(); } test();`
Hi Silly,
Your scripts are so cool to look at. Really way above my capabilities, but i look to scroll through them and see if i can learn from it. I noticed in a couple scripts you have different methods of embedding images. I was looking for something like this. I knew i saw used a couple times and only could remember 2 of you scipts or panels having.
What is the coding or desiphering for this, not sure how its called. I thought something like Binary or Hex. I noticed some parts still have readable text and was quite funny seeing them made with old app ImageReady
this is the code i mean