I'm trying to add icons to my toolbar on startup, even if no document is opened.
However, this is only possible using the importIcon function, but that requires an opened document.
I'm using the .js file on the JavaScript Roaming folder, and everything works fine, but I cannot start a new document with it, which would allow to import the icon, neither importIcon without a opened document.
Here's a code sample, that fails to create a new document:
Code: Select all
var myDoc = app.newDoc();
myDoc.importIcon("myIcon", "/C/Icons/lockico.png", 0);
oIcon = util.iconStreamFromIcon(myDoc.getIcon("myIcon"));
app.addToolButton({
cName: "Unlock stamp",
cLabel: "Unlock stamp",
cExec: "unlockstamp()",
cTooltext: "Unock stamp",
cEnable: true,
nPos: 1,
oIcon: oIcon
});
Kind regards,