Dockable panel script laucnher

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
djbennyj
Posts: 11
Joined: April 7th, 2009, 5:47 am

Hey everyone.

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

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


I wrote the script for this (based on a script i found here) , and it almoast works.
It creates 3 buttons, but only the first launches its scripts. The 2 others are inefectives...

Code: Select all

{
   function onScriptButtonClick()
      {
         var scriptFile = new File(this.currentDirectory+this.scriptFileName);
         scriptFile.open();
         eval(scriptFile.read());
         scriptFile.close();
      }
   
   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) YourPanel.show();

}

Here is the code.


I hope somone will spot my mistake ;)


Regards,
ben.
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

Benny,
Try positioning all 3 buttons "at the same position", it should solve your problem.
Something like this (in the createUI function):

Code: Select all

var BTmidi = addScriptButton(myPanel,[0,0,130,20], "Meteo du midi",  "/Medias/benji/scripts/", "meteo_semaine_midi.jsx");
var BTsoir = addScriptButton(myPanel,[0,0,130,20], "Meteo du soir",  "/Medias/benji/scripts/", "meteo_semaine_soir.jsx");
var BTWe   = addScriptButton(myPanel,[0,0,130,20], "Meteo du week end",  "/Medias/benji/scripts/", "meteo_week_end.jsx");
Koby.
djbennyj
Posts: 11
Joined: April 7th, 2009, 5:47 am

Hey , thx for answerig me

I trired your way, and it dosnt work.


The 3 buttons are overlaping, and i can only see one of'em (when i test it as a dockable panel).

If i lauch the script wirg file.scripts/execute script, the button are not stacking, i can see them all, but the probleme is still here, only the first one is working...
djbennyj
Posts: 11
Joined: April 7th, 2009, 5:47 am

Ok once again, i solved my problme on my own lol

I had an error in my second script (the one i tried ti launch)

I typed some random letters at the end... (by mistake ^^)

It works now
Yenaphe
Posts: 84
Joined: February 3rd, 2009, 6:30 pm
Location: Paris - France
Contact:

I've had this problem often, and this is a design flow i guess. AE doesn't warn you when you launch a script from a script if there is an error in the script, it just does nothing.

I recommand you testing and working on your script within Extended Toolscript. You can link it to AE with the small anchor link on top of the menu bar, on the left. It will help you avoid this kind of loss of time :)

Vive la météo sous After.

Seb
Post Reply