required more details - ID ver, platform, scripting?
But If the "[Predefined]" preset is selected from the dropdown I get mypreset=null and obviously tempting to read/write any property fails. The same happens in a different pc.
You've problem with getting the printer preset objects, from the selection dropdown box. use the itemByName() method for preset objects.
After some tests I think the "[Predefined]" printer preset can not be referenced by name ! Neither with item("name") or itemByName("name").
Try this script:
Samsung ML-3050 Series
Predefinito di stampa 1
This is ok but now try this:
Anyone can confirm this?
Can you please try the below JS code, I feel you expect this.
This js code first get the all the printprests name after create the simple window and showin the drop down list in all the print preset name, whatever you select click ok it will shown the selected preset name.
var myPrint = app.printerPresets.everyItem().name; var w = new Window ("dialog"); w.orientation = 'row'; var myDropDown = w.add ("statictext", undefined, "Print Preset Style Name"); var myDropDown = w.add ("dropdownlist", undefined, myPrint); myDropDown.selection = 0; var myButtonGroup = w.add ("group"); myButtonGroup.add ("button", undefined, "OK"); w.center(); w.show(); alert(myDropDown.selection.text);
thank you csm_phil for your time.
The problem is not having the dropdown and selecting the preset names, I could accomplish that in a way similar to what you did.
The problem is you can NOT reference by name the Default printer preset ( "[Predefinito]" in the italian localized ID, I suppose something like "[Default]" in the english version).
I found eventually a way to get around this but I would like to get someone to acknowledge this sort of bug.
Try this where the first lines are the same you showed:
var myPrint = app.printerPresets.everyItem().name;
var w = new Window ("dialog");
w.orientation = 'row';
var myDropDown = w.add ("statictext", undefined, "Print Preset Style Name");
var myDropDown = w.add ("dropdownlist", undefined, myPrint);
myDropDown.selection = 0;
var myButtonGroup = w.add ("group");
myButtonGroup.add ("button", undefined, "OK");
//this is my addition
When you choose the Default preset you have an error (mypreset is an invalid object, in fact it is null) but if you choose a user defined preset everything is ok.
1 person found this helpful
It doesn't seem to work in English, where it is [Default]. I guess the workaround is to reference by index number...
Thank you John, so we can state this is a bug I suppose. And yes even my workaround was to reference to the Default printer preset by index.
Actually I used successfully app.printerPresets. but I do not know if the zero index always points to the Deafult preset, can anyone confirm this? thank you
Where every you using  it connecting to the first index of the array. Can you please change the code like this app.printerPresets. this to 'app.printerPresets'.
1- app.printerPresets is not an array.
2- my syntax is perfectly legal, see the docs
3- if you tried to suggest something I did not grasp it, sorry
Err, you guys do have me confused. I suppose it doesn't matter much, but:
1) app.printerPresets is not an Array, but it is a plural object, which is almost the same thing
2) app.printerPresets. doesn't work for me, and it's pretty non-standard too. app.printerPresets does. Did you mean to say app.printerPresets.item(0)?
Not sure what documentation you were referring to...
what i am identifying your script, see the below error in your script. John, understand my corrections of the script thanks john.
instead of this
mmmh very strange. This script is perfectly working in win CS4 and every statement looks equivalent :
Regarding the docs I was referring to, I get this from ESTK Object Model Viewer (notice the dot before square brackets ):
PrinterPresets. (index: number ): PrinterPreset
Adobe InDesign CS4 (6.0) Object Model Object Model
Returns the PrinterPreset with the specified index.
index: Data Type: number
I see in CS5.5 that the .[index] notation does not work anymore but I confirm in CS4 it does.
Message was edited by: sotospeak (carlo bazzo)