/***********************************************************************/
/*                                                                     */
/*      RunLabel :: Run the code keyed in the "Script Label" panel     */
/*                                                                     */
/*      [Ver: 1.01]    [Author: Marc Autret]    [Modif: 06/30/09]      */
/*      [Lang: EN]     [Req: InDesign CS4]      [Creat: 06/10/09]      */
/*                                                                     */
/*      Installation:                                                  */
/*                                                                     */
/*      1) Place the current file into Scripts/Scripts Panel/          */
/*                                                                     */
/*      2) Run InDesign, select a page item, type your code            */
/*         in the "Script Label" panel, then reselect the object       */
/*                                                                     */
/*      3) Exec script from Window > Automatisation > Scripts          */
/*         (double-click on the script name)                           */
/*                                                                     */
/*      Bugs & Feedback : marc{at}indiscripts{dot}com                  */
/*                        www.indiscripts.com                          */
/*                                                                     */
/***********************************************************************/

Application.prototype.main = function()
//--------------------------------------
// Run as a script the label of the selected object
// !! If you change the label, you must unfocus
// !! the "Script Label" panel to update it
{
try
	{
	if ( this.selection.length <= 0 )
		{
		throw new Error("No selection!");
		}
	var snippet = this.selection[0].label;
	this.doScript(snippet, ScriptLanguage.javascript,
		undefined, UndoModes.entireScript, "RunLabel");
	}
catch(ex)
	{
	alert(ex);
	}
}
app.main();