2009-07-24

Get MediaSpan Jazbox Graphic Captions

Another piece of the puzzle

Earlier I posted a function to look at an Adobe InCopy story from a MediaSpan Jazbox site that had multiple Text Elements and create a special object sometimes called an associative array. The graphic captions will be part of that special object. But their 'storyTitle' is only partly predictable because the 'storyTitle's always include the name of the graphic. So while we know they start with 'Graphic' and are followed by a number and a colon, the text after the colon is unknown. But with a Regular Expression we can find those stories whose 'storyTitle' property starts properly.

The function below will give you a reference to all the stories (InCopy's definition of a story, not yours and mine) in the passed document reference which are graphic captions. From there you can use a script to format them or do other things with them.




//
function getJazboxGraphicCaptionStories ( JazboxStoryElements ) {
//-------------------------------------------------------------------------
//-- G E T J A Z B O X G R A P H I C C A P T I O N S
//-------------------------------------------------------------------------
//-- Generic. Almost. Requires an external function.
//-------------------------------------------------------------------------
//-- Purpose: To return an array with a reference to each Jazbox caption.
//-------------------------------------------------------------------------
//-- Arguments: 1
//-- JazboxStoryElements: A custom object with properties continging
//-- each element of a story. The properties are named with the
//-- 'StoryTitle' (the text in the gray bar above each element
//-- in Adobe InCopy). For Jazbox captions, these 'storyTitle's
//-- start with "Graphic", a number, and a colon followed by
//-- a space and the image "Name". The routine to create the
//-- Jazbox elements might have these storyTitles generated
//-- with or without spaces and odd characters in their names
//-- so be careful with that.
//-------------------------------------------------------------------------
//-- Returns: An array of stories that point to the Jazbox captions.
//-------------------------------------------------------------------------
//-- Calls: Nothing.
//-------------------------------------------------------------------------
//-- Sample Use: Perhaps you wanted to get a reference to every caption
//-- 'story' in the active Adobe InCopy document. This might be
//-- useful if you had a function to format all the captions, but
//-- needed a method to find and access them. This function can
//-- return an array which can be looped through to point another
//-- funciton to the each caption to format.
//--
//~ var allCaptions = getJazboxGraphicCaptionStories ( getJazboxStoryElements ( app.documents[0] ) ) ;
//~ for ( var captionIndex = 0 ; captionIndex < allCaptions.length ; captionIndex++ ) {
//~ //-- Do what you want with the catptions
//~ formatCaption ( allCaptions[captionIndex] )
//~ }
//~ function formatCaption ( aCaption ) {
//~ try {
//~ aCaption.appliedParagraphStyle = '03_CAPTION_caption'
//~ }
//~ catch (err) { /* nothing to do */ }
//~ }
//--
//-------------------------------------------------------------------------
//-- Written: 2009.07.03 by Jon S. Winters of electronic publishing support
//-- eps@electronicpublishingsupport.com
//-------------------------------------------------------------------------

//-- Add a way for the site to limit how many captions are looked at.
var maximumNumberOfRelatedItemsAtSite = 50 ;

//-- Construct a string of all the element names to be used as a test
//-- for determining if a particular caption exists.
var storyProperties = JazboxStoryElements.reflect.properties ; // This generates an array
var storyPropertyNamesString = storyProperties.join('\t') ; // This makes the string
var numProperties = storyProperties.length ; // note there will always be some, but there may not be real captions.

//-- Construct the return array
var captions = new Array () ;

//-- Loop through the available captions
for ( var captionIndex = 0 ; captionIndex < maximumNumberOfRelatedItemsAtSite ; captionIndex++ ) {
//-- Construct a Regular Expression pattern for this Jazbox caption number
//-- IMPORTANT: if check the case of the text from the routine to get the elements.
var captionPattern = new RegExp ( 'graphic' + captionIndex + ':' , 'i' ) ;
//-- See if that caption exists before trying to find a particular reference
if ( captionPattern.test ( storyPropertyNamesString ) ) {
//-- The particualr caption exists, now find a reference to it.
for ( propertyIndex = 0 ; propertyIndex < numProperties ; propertyIndex++ ) {
if ( captionPattern.test ( storyProperties[propertyIndex] ) ) {
var fullPropertyName = storyProperties[propertyIndex].name ;
captions.push( JazboxStoryElements[fullPropertyName] ) ;
}
}
}
}
//
return captions ;
}
//

2009-07-23

Get MediaSpan Jazbox Text Elements

Part of Something Bigger

If you are a MediaSpan Jazbox site there are many useful things that you can do with ExtendScript (JavaScript) to interact with your stories and pages in Adobe InCopy and Adobe InDesign documents. But some things are more difficult than others. In the case of an Adobe InCopy story from Jazbox, locating the individual InCopy stories that make up the individual Jazbox Text elements is tricky. Many things affect the ordering of those elements and you simply cannot count of app.documents[0].stories[1] being something like the head element all the time. It won't be. And once a story has hit the Adobe InDesign page the number of stories in the Adobe InCopy file can balloon. You could find that your head is suddenly stories[17].

But there is hope. There is a 'storyTitle' property in every story. But this is another one of those weird cases where a 'Story' to a user isn't the same as a 'story' to ExtendScript. Every Jazbox Text Element used in an InCopy story will have a 'storyTitle' that matches the name of the Text Element in the database. Stories that are not part of the open document won't display their 'storyTitle' property, because they are a different 'Story' placed on the page. Thus there is a method to find all the Text Elements -- find all the stories with a 'storyTitle' property.

The function below is documented to the point of showing exactly how to access any Text Element that exists in a document. You can do anything you want to them, once you know how to find them. It is another case of generating a good reference (like all the postings about generating good document references). Keep in mind that in order to allow both forms of access with the associative array that the Text Element names will be edited to not include any spaces and no other odd characters. All 'storyTitles' are run though this code:

replace (new RegExp ('[\ \'\"!?*+&-\\\/]','g'), '' ).toLowerCase()
That effectively removes spaces, single and double straight primes (quotes), exclamation marks, question marks, ampersands, both forward and back slashes, and hyphens. That was the plan at least. Looking at the regular expression, that doesn't seem quite correct. Hmm.

Perhaps the most interesting facet of the function is the way it uses an 'Associative Array'. This is really an object that you can reference in any number of ways. Try this code:
var o = new Object () ;
o['PropertyName'] = 'Hello World'
$.writeln ( o.PropertyName )

var someName = 'PropertyName'
o.PropertyName = 'Something Else'
$.writeln ( o[someName] )

$.writeln ( 'PropertyName' + ' exists: ' + o.hasOwnProperty ( 'PropertyName' ) )

$.writeln ( o.reflect.properties )
$.writeln ( o.length + ' elements is incorrect. Objects don\'t have lengths.' )

The function was created as part of a function to grab all the text elements in a particular order and recompile into another InCopy file. That had very limited use, but the function below is quite generic.

Also, Graphic Captions will also be exposed to this function, but grabbing them is a different process. I have a separate function for that. Ask and ye shall receive.

//
//-- CAUTION: WATCH OUT FOR LINE BREAKS FROM THE BLOG POSTING
//
function getJazboxStoryElements ( docRef ) {
//-------------------------------------------------------------------------
//-- Get Jazbox Story Elements
//-------------------------------------------------------------------------
//-- Generic, Yes for Jazbox
//-------------------------------------------------------------------------
//-- Purpose: To return the references to the stories in an InCopy story
//-- if the story has been placed on a page or not.
//-------------------------------------------------------------------------
//-- Returns an object containing story References
//-- The returned object will have properties with the name of each
//-- element. For example the returned object .headline, .deck,
//-- .mainmext, .nugget01, .quote
//-------------------------------------------------------------------------
//-- Basic Use:
//~ var activeStoryElements = getJazboxStoryElements(app.documents[0]);
//-------------------------------------------------------------------------
//-- Extended Use:
//-- Assume that we have activeStoryElements from the above Basic Use
//-- Now to determine if an element exists in a story. Lets assume
//-- the element name in Jazbox was 'Web Head'. The function
//-- must remove the space. And the function will also convert
//-- all the names (in the script only) to lowercase. Thus the
//-- 'Web Head' text element in Jazbox will be referred to here
//-- as 'webhead'.
//~ if ( activeStoryElements.hasOwnProperty ('webhead') ) {
//~ //-- Do something with the web head property.
//~ //-- To Grab the text:
//~ var webHeadContents = activeStoryElements['webhead'].contents
//~ //-- To Replace the contents with the 2nd paragraph of the main
//~ //-- text element as a way of populating the web head
//~ activeStoryElements['webhead'].contents =
//~ activeStoryElements.maintext.paragraphs[1].contents
//~ //-- To format the web head with a paragraph style named
//~ //-- 'Head Web Normal'
//~ activeStoryElements.webhead.appliedParagraphStyle = 'Head Web Normal'
//~ }
//-------------------------------------------------------------------------
//-- Written by Jon S. Winters of electronic publishing support
//-- jonwinters@electronicpublishingsupport.com
//-------------------------------------------------------------------------
//-- Edited: 2009.07.21 to allow space and other characters in a Text
//-- Element Name. Spaces would normally break things horrible. This
//-- version also

//-- Create the object to return.
var storyReferences = new Object () ;

//-- For the passed document reference, get a list of all the active
//-- stories and titles.
var allStories = docRef.stories ;
var allStoryTitles = docRef.stories.everyItem().storyTitle ;

//-- Loop through every story
for ( var storyIndex = allStories.length - 1 ; storyIndex >= 0 ; storyIndex-- ) {
//-- Get a variable for the active title. The Text Element will have
//-- all spaces and other undesireable characters removed and
//-- the text will be converted to lowercase. 2009.07.21
var thisTitle =
String ( allStoryTitles[storyIndex] ).replace (new RegExp ('[\ \'\"!?*+&-\\\/]','g'), '' ).toLowerCase()

//-- check to make sure there is a title. Those without titles are
//-- not part of the active Jazbox story.
if ( thisTitle != '' ) {
//-- Check the Story Title to determine which element it is.
//-- this generates a property in the object to return.
storyReferences[thisTitle] = allStories[storyIndex] ;
}
}
//-- Return the created array.
return storyReferences ;
}
//

2009-07-22

Add Note and Text to End Of Story

Part of a Story Aggregator

For a MediaSpan Jazbox site I was working at there was a need to access specific Text Elements and combine them into a specific order (look for a future post for more details). Note: If you are a Jazbox site, MediaSpan's CSS can do this same function without any user interaction. This was for a very special purpose that the site decided to script a different solution.

Back to the script... Part of adding different blobs of text together into a new Adobe InCopy story involved marking them with their original Text Element name. Notes seemed like a good choice. So this function was developed to take a reference to a story and add a note and some more text to the end of the story. It works well. While designed for Adobe InCopy this would also work for Adobe InDesign as well.


//
function addNoteAndTextToEndOfStory ( storyRef , noteString , storyString ) {
//-------------------------------------------------------------------------
//-- A D D N O T E A N D T E X T T O E N D O F S T O R Y
//-------------------------------------------------------------------------
//-- Generic: Yes for Adobe InCopy and Adobe InDesign CS3 and perhaps newer
//-------------------------------------------------------------------------
//-- Purpose: To add a note and then some text following the note at the
//-- current end of the passed Adobe InDesign or Adobe InCopy story.
//-- The original reason to do this was for a client that wanted to
//-- aggregate some paragraphs of text, but record where the text
//-- came from. So, by passing this function a reference to a story
//-- it will add a note and then the text to the end of the story.
//--
//-- Note: this function is currently set to add a blank
//-- paragraph at the end of the story each time this is to help
//-- place each subsequent addition at the beginning of a paragraph.
//-------------------------------------------------------------------------
//-- Calls: Nothing.
//-- Returns: Nothing, but modifies the story for the passed reference.
//-------------------------------------------------------------------------
//-- Sample Use:
//~ var storyRef = app.documents[0].stories[0] ;
//~ var noteContents = 'This is a note Added by A Script' ;
//~ var storyContents = 'The FirstParagraph\rThe Second\rFinal Paragraph'
//~ addNoteAndTextToEndOfStory ( storyRef , noteContents , storyContents )
//-------------------------------------------------------------------------
//-- Written: 2009.07.03 by Jon S. Winters of electronic publishing support
//-- eps@electronicpublishingsupport.com
//-------------------------------------------------------------------------
//-- To add a note to a story, we need to first add the note using the
//-- .add method. That returns a reference to the added note. The
//-- resultant note doesn't have contents, but its 'texts' does.
var noteRef = storyRef.insertionPoints[-1].notes.add() ;
noteRef.texts[0].contents = noteString ;

//-- Now insert the contents at the end of the story and add a return.
storyRef.insertionPoints[-1].contents = storyString + '\r' ;
}
//

2009-07-17

Move an Object Any Direction in Any Measurement System

Works regardless of the document's measurement system

One problem often encountered when manipulating items on Adobe InDesign pages is knowing what the current page's or document's measurement system. If you asked something to move '1', you don't know if you are moving 1 pica, 1 inch, or 1 centimeter. To make matters worse, a horizontal movement might happen in one measurement system and vertical adjustments in another measurement system.

This function solves that by allowing you to specify the distance in any measurement system. Just supply the 'unit' parameter a string such as 'picas', 'inches', 'points', 'cm', etc.

The function is long because it has loads of error checking. But it works, and that is all that matters.

//
function moveObjectBy ( o , down , right , unit ) {
//-------------------------------------------------------------------------
//-- M O V E O B J E C T B Y
//-------------------------------------------------------------------------
//-- Generic: Yes for Adobe InDesign CS3
//-------------------------------------------------------------------------
//-- Purpse: To move the passed object down and to the right by the
//-- specified amount in the passed unit values.
//-- The significant thing here is that you do not need to worry about
//-- the current measurment system in use on the Adobe InDesign page.
//-- Another benifit of this routine is that some special objects
//-- can be constructed via plug-ins which prevent them from having
//-- thier bounds manipulated. Ads on MediaSpan jazbox pages are
//-- one of these types of objects.
//-------------------------------------------------------------------------
//-- Parameters: 4
//-- o: The Adobe InDesign object to move. There are many things
//-- that can be moved. Any page item ( text frame, graphic
//-- frame, unassigned frames, graphic line, group, etc. If
//-- it can be modified using controls in the Object menu in
//-- Adobe InDesign, likely it can me moved by this function.
//-- down: The amount to move the object down. If you want to move
//-- the object up, then use a negative value.
//-- right: The amount to move the object to the right. Again, use
//-- a negative value to move the item to the left.
//-- unit: A string. Can be any of a large number of choices.
//-- For example: 'pica', 'point', 'mm', 'centimeter', 'inches'
//-- or 'pc', 'pt', 'millimeters', 'cm', 'i'
//-------------------------------------------------------------------------
//-- Returns: True if successful. False if something prevented the item
//-- from moving. For example, locked objects cannot be moved.
//-------------------------------------------------------------------------
//-- Sample Use:
//~ var s = app.selection[0]
//~ moveObjectBy ( s , 0 , 2.54 , 'cm' ) // right 1 inch
//~ moveObjectBy ( s , 3 , undefined , 'picas' ) // down a half
//~ moveObjectBy ( s , 0 , -1 , 'in' ) // back to the left 1 inch
//~ moveObjectBy ( s , -36 ) // return to the starting place
//-------------------------------------------------------------------------
//-- Written: 2009.07.17 from scratch during flight US377 from EWR to CLT
//-- Written by: Jon S. Winters of electronic publishing support
//-- eps@electronicpublishingsupport.com
//-------------------------------------------------------------------------
//-- Verify there are good numberic values for down and right or set to 0
if ( isNaN ( down ) ) { down = 0 } ;
if ( isNaN ( right ) ) { right = 0 } ;
//-- Assume points (my favorite for scripts) if the unit isn't passed.
if ( unit == undefined ) { var unit = 'points' ; }
//-- Make sure that we passed a lowercase value.
unit = String ( unit ).toLowerCase() ;
try {
//-- Convert to ExtendScript unit values. This is unique to
//-- ExtendScript and is not part of JavaScript or ECMAScript.
//-- Note, there appears to be a bug in how this works. Picas
//-- converts to 'pc' and move won't take that, so back to
//-- picas the string will be converted.
var downUnitsToMove = String ( new UnitValue ( down , unit ) ).replace ( 'pc', 'picas') ;
var rightUnitsToMove = String ( new UnitValue ( right , unit ) ).replace ( 'pc', 'picas') ;
//-- Most objects support a .move method. Try it then return true.
o.move( undefined , [ rightUnitsToMove , downUnitsToMove ] ) ;
return true ;
}
catch (err) {
//-- if any of the conversions to unit values failed or if
//-- the passed object cannot be moved this way, then
//-- return an error.
return false ;
}
}
//

Display Dialog with Radio Buttons of Array Elements

The Final Installment in Selecting an Array Element

Radio Buttons are the third user interface option when it comes to selecting items from a list. Like a Drop Down Menu, a user is only permitted to select a single choice. When the number of items to select from is limited, it is easiest to select from a set of radio buttons.

All three versions of Array Element selection presented have some unique feature. The checkbox version had a method of controlling how many items would appear in a column. That could be incorporated here. This function has the ability to display an optional script version and discusses that in the scripts comments. This version, as do all the others, could actually accept an Adobe InDesign or Adobe InCopy collection. A collection is a superset of an Array object and collections have properties other than .length. For example if you wanted to get the name of all the Master Pages in a document...
var mps = app.documents[0].masterSpreads.everyItem().name
You could also just refer to the name of one item in the collection using the code within the function below. Just read the embedded documentation.


//
function chooseFromList( lst , prmt , dflt ) {
//-------------------------------------------------------------------------
//-- C H O O S E F R O M L I S T
//-------------------------------------------------------------------------
//-- Generic: Yes for any version of Adobe InDesign or Adobe InCopy
//-- that can display a custom dialog.
//-------------------------------------------------------------------------
//-- Purpose: Displays a dialog with a series of radio buttons with
//-- choices passed into 'lst'.
//-------------------------------------------------------------------------
//-- Returns: index of chosen item or -1 if they clicked cancel
//-------------------------------------------------------------------------
//-- Parameters: 3
//-- lst: An array of things that can be coorersed into strings
//-- prmt: a string that will be used to instruct the user what they
//-- should select. Something like ; 'Select a Paragraph Style:'
//-- dflt: a
//-------------------------------------------------------------------------
//-- Sample Use:
//~ var a = [2, 4, 6, 8, 'who', 'do', 'we', 'appriciate']
//~ var daChoice = chooseFromList ( a , 'Select Something:' )
//~ if ( daChoice != -1 ) alert ( 'You picked: ' + a[daChoice] )
//-------------------------------------------------------------------------
//-- Written by Jon S. Winters on 2008.12.24
//-- Edited: 2009.07.17 to provide better comments.
//-- eps@electronicpublishingsupport.com
//-------------------------------------------------------------------------
//-- Version 1.1: Force Adobe InDesign to display dialogs. Without the
//-- line below the dialog may not appear on some systems.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL ;
//-- Assign a default default choice if one isn't passed;
dflt = dflt || 0 ;
//-- If the default value is less than 0, reset to zero.
//-- This was initially done because this function was created for
//-- a script where the user would get the dialog multiple times
//-- throughout the course of the day and the persistent
//-- target engine would pass as default the last choice
//-- but if a user cancels, then the last choice will be -1.
dflt = (dflt <>
//-- Standard way to make a new dialog with a prompt and a cancel button.
var listDialog = app.dialogs.add({canCancel:true, name:prmt}) ;
//-- Setup the buttons array which will be filled as the dialog is
//-- constructed.
var buttons = new Array () ;
//-- Go through the processes of setting up the areas of the dialog
//-- consult the Adobe Documentaion if you really want to know
//-- what is going on here. Otherwise, just use it.
with (listDialog) {
with (dialogColumns.add()) {
var userChoice = radiobuttonGroups.add()
with ( userChoice ) {
//-- Loop through every item of the list. Note, if the list
//-- is really a collection of Adobe InDesign or Adobe
//-- InCopy objects, they will have .name properties.
//-- Thus, you can add .name in the staticLabel. See
//-- the commented out version.
for ( var loopIndex = 0 ; loopIndex <>
//-- Below for standard Array of Elements that can be
//-- displayed as a string. Note the conversion to
//-- the String object. This will be necessary for
//-- list elements that don't have strings.
buttons[loopIndex] = radiobuttonControls.add( {staticLabel:String(lst[loopIndex]) } );
//-- Below version will allow you to see the name of a item
//-- in a collection.
//~ buttons[loopIndex] = radiobuttonControls.add( {staticLabel:lst[loopIndex].name } );
} //-- end of for loop
//-- Note, the next thing is interesting. We are currently in
//-- a with (radionbuttonGroup) statement. That has a
//-- selectedButton property. And now that all the
//-- buttons have been added, the selected buttton
//-- can be set to the default value.
selectedButton = dflt ;
} ///-- end of with radiobuttonGroups
//
//-- This next thing is also interesting. ExtendScript, like
//-- ECMAScript and Javascript, has a global object. That
//-- object is referenced as
//-- this
//-- some of my scripts set a global 'scriptVersion'
//-- if the scriptVersion exists, then the dialog will get
//-- the text of that scriptVersion
if (this.scriptVersion) {
with (dialogRows.add() ) {
with (dialogRows.add() ) {
staticTexts.add({staticLabel:String(this.scriptVersion)}) ;
}
}
}
//
}
}
//-- Show the dialog, and wait for them to click OK or Cancel.
var listResult = listDialog.show() ;

//-- return the selected list index unless they clicked Cancel.
return ( listResult ? userChoice.selectedButton : -1 ) ;
}
//

2009-07-16

Display Dialog with Dropdown Menu of Array Elements

Another way to display an array
(How's that for alliteration?)
A recent post dealt with displaying a dialog box with a checkbox for every array elements. That works if you want to select more than a single entry in the array. But many times you only need the option to choose a single array element. In that case the GUI should include a dropdown menu or a set of radio buttons. This generic ExtendScript function takes an array of elements and a prompt string and constructs and displays a dialog box allowing the user to select an element of the array.
The function returns not the array element but the index in the array of that element.
Note, if you want the items sorted then use the .sort() method on the array prior to passing it to the function.
If the user doesn't select an array element or clicks cancel the function returns a -1 value. Note, in JavaScript an array can't be referenced with a negative index. But in ExtendScript, if you have a collection, instead of a true array, then -1 is the last item in the ExtendScript collection.
This function was written for a script that allows the user to select text in Adobe InDesign or Adobe InCopy and toggle the Bold or Italic font styles with a keyboard shortcut. The script is quite nice because nothing is hard coded. Instead a site installs the pieces, assigns the keyboard shortcuts, and then uses it. The first time they use it, it displays a dialog asking what Character Style to apply to the selected text. Any future time the same type of text is selected, the script will know what Character Style to apply. It works great. That script requires Character Styles when a normal Bold or Italic font style won't suffice such as when you not only apply a bold, but you actually switch fonts. This script is for sale to any site that needs it, just send a e-mail to eps@electronicpublishingsupport.com
A separate link to toggleStyle() will be setup eventually.

//
function selectArrayElementViaDropdown(lst,prmt) {
//-----------------------------------------------------------
//-- S E L E C T A R R A Y E L E M E N T F R O M D R O P D O W N
//-----------------------------------------------------------
//-- Generic: Yes for current versions of Adobe Products
//-- that support custom dialog boxes
//-----------------------------------------------------------
//-- Purpose: Displays a dialog a single dropdown menu of
//-- choices passed into 'lst'.
//-----------------------------------------------------------
//-- Parameters: 2
//-- lst: An Array of items to display to the user
//-- prmt: A string prompt to ask the users what to do.
//-----------------------------------------------------------
//-- Returns: index of chosen item or -1 if they clicked cancel
//-----------------------------------------------------------
//-- Calls: Nothing.
//-----------------------------------------------------------
//-- Sample Use:
//~ var pStyleNames = ['Body bj', 'Body Ragged brr', 'Body Wire bw']
//~ var selectedStyle = selectArrayElementViaDropdown ( pStyleNames , 'Choose the Paragraph Style to apply to the body of this story' ) ;
//~ if ( selectedStyle >= 0 ) {
//~ var theStyleNameToUse = pStyleNames[selectedStyle]
//~ // Do something with the style name here
//~
//~
//~ }// End of the if block
//-----------------------------------------------------------
//-- Written sometime in 2009 by Jon S. Winters
//-- eps@electronicpublishingsupport.com
//-----------------------------------------------------------
//
var listDialog = app.dialogs.add({canCancel:true});
with (listDialog) {
with (dialogColumns.add()) {
with (dialogRows.add() ) {
// show prompt
staticTexts.add({staticLabel:prmt});
}
with (dialogRows.add() ) {
//show the list
var userChoice = dropdowns.add({stringList:lst})
}
}
}
//-- Show the dialog
var listResult = listDialog.show() ;
//
if (listResult) {
return userChoice.selectedIndex ;
}
else {
return -1 ;
}
}
//