Nevermind -- I figured it out:
var myValue = dlg.msgPnl.titleEt.selection.text;
Simple! Sorry for wasting a post.
Actually, since you already have an array, you could have used it again to retrieve the nth value:
myValue = mySizes[dlg.msgPnl.titleEt.selection];
(On the other hand, there is a different sort of drop down list with only suggestions, where you can select an item or type in anything you want. Kind of like InDesign's own point size list. In that case, you should always retrieve 'what the user entered', because it just may be something that's not in your list. I'm racking my brain right now -- does ScriptUI support this or not?)
Sorry for wasting a post.
Your 25th post? Don't worry, you have enough ones left.
From the OMV
Data Type: ListItem
The currently selected list item.
Setting this value causes the selected item to be highlighted and to be scrolled into view if necessary. If no items are selected, the value is null. Set to null to deselect all items.You can set the value using the index of an item, rather than an object reference. If set to an index value that is out of range, the operation is ignored. When set with an index value, the property still returns an object reference.
Since a ListItem is returned, the way to get the text would be with the ListItem's text property.
However since index can be used in place of object, it returns an index by default...
Thanks ... one wrinkle I have come across:
In my previous post, I was using script ui to set the value of a point size. Both your method or selection.text seems to work fine for that.
But I can't seem to do the same for fillTint.
Hardcoding it in my script works: myText.fillTint = 50. But using the value from the dropdown list does not: myText.fillTint = dlg.msgPnl.titleEt2.selection.text or myValue = myTint[dlg.msgPnl.titleEt2.selection] (myTint being my array for the dropdownlist).
What's odd is that using these methods does return the correct value -- I tested it with an alert box.
Is the problem that by using selection.text, it is giving me the number as a text string and fillTint wants only a number? I do know that if you try myText.fillTint = 50 it works, but myText.fillTint = '50' wil not. But either will work with pointSize.
I tried my array two ways but got the same non-results:
var myTint = ['40', '45', '50', '55']; and var myTint = [40, 45, 50, 55];
I have looked at the script UI classes in the OMV, but can't seem to find a solution.
Perhaps fillTint only expects 'real' numbers, and isn't smart enough to recognize a number-in-string format. It's likely because of this: pointSize can accept a number, which usually is measured in points, but you can also set it to any 'measurement' string, such as "5 mm".
Try with forcing your selection.text forced into a number, like this:
myText.fillTint = Number(dlg.msgPnl.titleEt2.selection.text);
Nope ... didn't work. Is there anyway to specify its a number in the dropdownlist array or the
I also tried 'edittext' instead of 'dropdownlist' but as you might guess, that did not work either.
The override didn't work? That cannot be right. Did it do nothing, or didya get an error?
Try this, to find out if at least the dialog part works:
theSetFillTint = Number(dlg.msgPnl.titleEt2.selection.text); alert (theSetFillTint+" is of type "+theSetFillTint.constructor.name);
-- it should report this
"50 is of type Number"
and it's the type I'm interested in. If it is "Number" then assigning this to fillTint fails for some reason.
Yes, it returned that.
sorry, forgot to add -- I did not get an error.
My apologies -- I must have left something out my first try -- I got it to work.
Thanks for your help with this.