Copy link to clipboard
Copied
I have no idea it this is possible, but I have written this code at the start of a script to select a function within the script:
myDialog = app.dialogs.add({name:"Catalogue Selector"});
with(myDialog)
{
with(dialogColumns.add())
{
with(dialogRows.add())
{
staticTexts.add({staticLabel:"Select the required catalogue:"});
myOptionButtons = radiobuttonGroups.add();
with(myOptionButtons)
{
radiobuttonControls.add({staticLabel:"VW"});
radiobuttonControls.add({staticLabel:"Peugeot"});
radiobuttonControls.add({staticLabel:"MG Rover"});
radiobuttonControls.add({staticLabel:"BMW Special"});
radiobuttonControls.add({staticLabel:"Nissan HTML"});
radiobuttonControls.add({staticLabel:"Nissan XLS"});
radiobuttonControls.add({staticLabel:"BMW (GB)"});
radiobuttonControls.add({staticLabel:"SEAT"});
radiobuttonControls.add({staticLabel:"Citroen"});
radiobuttonControls.add({staticLabel:"Vauxhall"});
radiobuttonControls.add({staticLabel:"SAAB 1st Column"});
radiobuttonControls.add({staticLabel:"SAAB 2nd Column"});
radiobuttonControls.add({staticLabel:"Audi"});
radiobuttonControls.add({staticLabel:"Fiat"});
radiobuttonControls.add({staticLabel:"Ford"});
radiobuttonControls.add({staticLabel:"Ford LCV"});
radiobuttonControls.add({staticLabel:"Honda"});
radiobuttonControls.add({staticLabel:"Vauxhall FUNNY SIZE"});
radiobuttonControls.add({staticLabel:"Hyundai"});
}
}
}
}
myResult = myDialog.show();
and what I want to be able to do is add an image to each option.
Is this possible?
I am looking to work with CS3 only at the moment.
Cheers
Roy
Dear Roy Marshall
Please use the below code:
var myDialog= new Window(''dialog','Sample');
//Adding Buttons
myButton1 = myPanel.add('button', [380,13,75,25], 'Choose',{name:'button1'});
myButton2 = myPanel.add('button', [380,53,75,25], 'Choose',{name:'button2'});
myButton3 = myPanel.add('button', [380,93,75,25], 'Choose',{name:'button3'});
myCancel = myDialog.add('button', [500,120,100,25], 'Cancel',{name:'cancel'});
myImage = myDialog.add('image',[487,16,588,100],'/Macintosh HD/Applications/Adobe InD
...Copy link to clipboard
Copied
sorry, please ignore the "&n bsp;"
Not sure how that happened.
Roy
Copy link to clipboard
Copied
You can do this using ScriptUI (not InDesign's dialog). ListItem has image property:
An image object for an icon to display in the item.
When specified, the image appropriate to the selections state is drawn to the left of the text label.
Kasyan
Copy link to clipboard
Copied
Thanks for the reply Kasyan
I am building the dialog, (I am not sure I am using ScriptUI) as below:
var myDialog = new Window('dialog', 'Roys Box');
myDialog.frameLocation = [100,100];
myDialog.size = [500, 120];
myPanel= myDialog.add('panel', [10,10,480,100], 'Roys Panel');
myTopText = myPanel.add('statictext', [17,15,100,55],'Top Text');
myBottom = myPanel.add('statictext', [17,50,100,85],'Bottom Text');
myLine= myDialog.add('panel', [18,55,370,0], 'Roys Panel');
myOKButton = myPanel.add('button', [390,10,75,10], 'Done',{name:'ok'});
myCancelButton = myPanel.add('button', [390,40,75,25], 'Cancel',{name:'cancel'});
myImage = myDialog.add('image',undefined,"image.png");
myResult = myDialog.show();
but the myImage line errors saying 'File or Folder does not exist'. The guide does not state how to use this method including the file path.
Any ideas on how to make this work?
Cheers
Roy
Copy link to clipboard
Copied
After playing with all ways of code, I got it!!!:
myImage = myDialog.add('image',[490,30,588,95],'~/image.png');
Phwew!
Roy
Copy link to clipboard
Copied
Dear Roy Marshall
Stored in your "image.png" file in Local or Server Folder then please insert the Folder name in the line...
for Example :
myImage = myDialog.add('image',undefined,"c:\\Images\\image.png");
Thanks & Regards
T.R.Harihara SudhaN
Copy link to clipboard
Copied
Thanks for that. I got there in the end.
One last thing (for now anyway) I have this bit of code:
//Adding Buttons
myButton1 = myPanel.add('button', [380,13,75,25], 'Choose',{name:'button1'});
myButton2 = myPanel.add('button', [380,53,75,25], 'Choose',{name:'button2'});
myButton3 = myPanel.add('button', [380,93,75,25], 'Choose',{name:'button3'});
myCancel = myDialog.add('button', [500,120,100,25], 'Cancel',{name:'cancel'});
myImage = myDialog.add('image',[487,16,588,100],'/Macintosh HD/Applications/Adobe InDesign CS3/Scripts/Scripts Panel/Images/xxx.png');
myCopyright = myDialog.add('statictext',[15,153,400,172],'©xxxxxxx Ltd 2009');
myResult = myDialog.show();
if (myResult == 'myButton1')
{
alert ("myButton1 was pressed");
}
if (myResult ==2)
{
alert ("Cancel was pressed");
}
if (myResult == 'myButton1')
Copy link to clipboard
Copied
Dear Roy Marshall
Please use the below code:
var myDialog= new Window(''dialog','Sample');
//Adding Buttons
myButton1 = myPanel.add('button', [380,13,75,25], 'Choose',{name:'button1'});
myButton2 = myPanel.add('button', [380,53,75,25], 'Choose',{name:'button2'});
myButton3 = myPanel.add('button', [380,93,75,25], 'Choose',{name:'button3'});
myCancel = myDialog.add('button', [500,120,100,25], 'Cancel',{name:'cancel'});
myImage = myDialog.add('image',[487,16,588,100],'/Macintosh HD/Applications/Adobe InDesign CS3/Scripts/Scripts Panel/Images/xxx.png');
myCopyright = myDialog.add('statictext',[15,153,400,172],'©xxxxxxx Ltd 2009');
myButton1.onClick= function()
{
alert("this is First");
}
myButton2.onClick= function()
{
alert("this is Second Button");
}
myButton3.onClick= function()
{
alert("this is Third Button");
}
myCancel.onClick= function()
{
alert("Close the Menu");
myDialog.close();
}
myDialog.show();
Use this Code!!
Regards
T.R.Harihara SudhaN
Copy link to clipboard
Copied
Beautiful!!
Thanks alot mate.
Roy
Copy link to clipboard
Copied
var dlg = new Window('dialog', 'Alert Box Builder',[100,100,480,245]);
dlg.btnPnl = dlg.add('panel', [15,50,365,95], 'Test it');
dlg.btnPnl.testBtn = dlg.btnPnl.add('button', [15,15,115,35], 'Test');
dlg.btnPnl.buildBtn = dlg.btnPnl.add('button', [125,15,225,35],'Ok', {name:'ok'});
dlg.btnPnl.cancelBtn = dlg.btnPnl.add('button', [235,15,335,35],'Cancel', {name:'cancel'});
dlg.btnPnl.testBtn.onClick = function() {
// Test something
dlg.close(3);
}
myResult = dlg.show();
if (myResult == 1) {
alert ("Ok was pressed");
}
else if (myResult == 2) {
alert ("Cancel was pressed");
}
else if (myResult == 3) {
alert ("Test was pressed");
}
By default, OK button returns 1, Cancel -- 2, if you use additional buttons, set return parameter of close method to a number to be returned from the show() method that invoked this window as a modal dialog.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more