Copy link to clipboard
Copied
Hi all,
I am trying to make this very basic script work in Illustrator CS5 but I keep getting the following error:
Error 509: Invalid image data
Line: 4
-> w.add("iconbutton", undefined, f); //a
The code is:
var w = new Window ("dialog");
w.orientation = "row";
var f = File ("ai.jpg")
w.add ("iconbutton", undefined, f ); // a
w.show ();
I have tried it with .ico, .png, .jpg all with the same error. Have been looking around for examples and tuts and I can't find anything wrong with my code.
I apologize if this is a stupid question 😃
your filepath is unvalid, isn't it?
try put you icon image on desktop folder and replace it with
var w = new Window ("dialog");
w.orientation = "row";
var f = File ("~/Desktop/ai.jpg")
w.add ("iconbutton", undefined, f );
w.show ();
Copy link to clipboard
Copied
Not sure if possibly CS5 has some issues with iconbutton class?
Of note, the following works fine (using image instead of iconbutton); but would be a lot easier if I could use iconbutton
// . . .
// Number of vertical slices
// ---
var V_SPRITES = 3;
// Create the UI
// ---
var w = new Window('dialog',"ScriptUI Sprites"),
myImage = w.add('image', undefined, myPNG),
iSize = myImage.image.size,
spriteHeight = iSize[1] / V_SPRITES;
myImage.size = [iSize[0], spriteHeight];
// . . .
Copy link to clipboard
Copied
your filepath is unvalid, isn't it?
try put you icon image on desktop folder and replace it with
var w = new Window ("dialog");
w.orientation = "row";
var f = File ("~/Desktop/ai.jpg")
w.add ("iconbutton", undefined, f );
w.show ();
Copy link to clipboard
Copied
I would have sworn that I was getting a different error message for an incorrect path, but I just tested above and it worked flawlessly. I then tested with a bad path and got the 509 error. So 100% correct answer.
I was assuming the script would call a relative path to its own.
Thank you so much for catching this for me.