Page 1 of 1

Dockable panel script laucnher

Posted: April 10th, 2009, 2:59 am
by djbennyj
Hey everyone.

I finished my script (the one i had problem with, in my previous topic); and i have 3 version of it, for 3 different task.

I'd like to launch my 3 script from a dockable panel.

I wrote the script for this, and it almoast works.
It create 3 button, but only the first launch its scripts. The 2 others are inefectives...

Code: Select all

   function onScriptButtonClick()
         var scriptFile = new File(this.currentDirectory+this.scriptFileName);;
   function addScriptButton(palette, buttonRect, buttonLabel, buttonCurrentDirectory, buttonScriptName)
         var newButton = palette.add("button", buttonRect, buttonLabel);
         newButton.scriptFileName   = buttonScriptName;
         newButton.currentDirectory = buttonCurrentDirectory;

         newButton.onClick = onScriptButtonClick;
         return newButton;

   function createUI(thisObj)
         var myPanel = ( thisObj instanceof Panel) ? thisObj : new Window("palette", "Lancement méteo", undefined, {resizeable:true});
       var BTmidi = addScriptButton(myPanel,[0,0,130,20], "Meteo du midi",  "/Medias/benji/scripts/", "meteo_semaine_midi.jsx");
		var BTsoir = addScriptButton(myPanel,[0,30,130,20], "Meteo du soir",  "/Medias/benji/scripts/", "meteo_semaine_soir.jsx");
		 //var BTWe = addScriptButton(myPanel,[0,60,130,20], "Meteo du week end",  "/Medias/benji/scripts/", "meteo_week_end.jsx");
                        //You can add how many buttons you want
         return myPanel;
var YourPanel = createUI(this);

   if (YourPanel instanceof Window);


Here is the code.

I hope somone will spot my mistake ;)