Script does not work on mac os, only on windows? SOLVED!

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
bugreport
Posts: 3
Joined: March 2nd, 2015, 2:05 pm

This script should create null Layers with specific layer names for a better overview (separation) in big compositions.
Everything works on Wondows 7 in CC and CS6.
In MAC OS, nothing works.
Does anyone have any idea why?

Code: Select all

{
   function myScript(thisObj){
      function myScript_buildUI(thisObj){
         var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Layer Separation v01", undefined, {resizeable:true});
// Definition of Buttons and Textfields
         res = "group{orientation:'row',\
            grp1: Group{orientation:'column', text:'',\
               grp2: Group{orientation:'row', text:'',\
                  Button01: Button{text:'CAM',preferredSize:[30,20]},\
                  Button02: Button{text:'CC',preferredSize:[25,20]},\
                  Button03: Button{text:'LIGHTS',preferredSize:[50,20]},\
                  Label: StaticText{text:'custom label:',preferredSize:[65,20]},\
                  Textfield: EditText{text:'Type in here'},\
                  Button04: Button{text:'Take it!',preferredSize:[50,20]},\
               },\
            },\
         }";

         myPanel.grp = myPanel.add(res);    
         
         // delete default text in EditText "CustomText"               
         myPanel.grp.grp1.grp2.Textfield.onActivate = function(){                                                 
           myPanel.grp.grp1.grp2.Textfield.text ="";
                        }            
         
         // Button event
         myPanel.grp.grp1.grp2.Button01.onClick =  function(){
             onTabClicked(myPanel.grp.grp1.grp2.Button01.text);
             }
      
         myPanel.grp.grp1.grp2.Button02.onClick =  function(){
             onTabClicked(myPanel.grp.grp1.grp2.Button02.text);
             }

         myPanel.grp.grp1.grp2.Button03.onClick =  function(){
             onTabClicked(myPanel.grp.grp1.grp2.Button03.text);
             }
         
         myPanel.grp.grp1.grp2.Button04.onClick =  function(){
             onTabClicked(myPanel.grp.grp1.grp2.Textfield.text);
             }         
      // create null layer and add specific name   
      function onTabClicked(standard) {
                        myComp = app.project.item(1);
                        neuNull = myComp.layers.addNull();    
                        neuNull.name = "____________________________ " + standard.toUpperCase();                          
//         alert(this.text + " button clicked");
      }         
         
         myPanel.layout.layout(true);

         return myPanel;
      }
   

   
      var myScriptPal = myScript_buildUI(thisObj);

      if (myScriptPal != null && myScriptPal instanceof Window){
         myScriptPal.center();
         myScriptPal.show();
      }

   }
   myScript(this);
}
Last edited by bugreport on April 27th, 2015, 9:59 am, edited 1 time in total.
zold
Posts: 14
Joined: March 25th, 2011, 9:15 am
Contact:

Hi.
I have to confess that I am currently on a (Mac) machine that has no CC or CS apps on it, other than ExtendScript Toolkit. I know. Don't ask.
So I won't be able to test for the AE functionality until I get to another machine tonight (but that part looks totally right to me).
But I can report that I was able to debug some of the script, and my version, with AE stuff commented out, is below.
I did have to adjust sizes of buttons to see the text properly, and I had to use this.text to automatically send the right text to the function (as the "standard" variable). Maybe this can get you on your way. You should check it on Windows.

Code: Select all

{
   function myScript(thisObj){
      function myScript_buildUI(thisObj){
         var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Layer Separation v01", undefined, {resizeable:true});
// Definition of Buttons and Textfields
         res = "group{orientation:'row',\
            grp1: Group{orientation:'column', text:'',\
               grp2: Group{orientation:'row', text:'',\
                  Button01: Button{text:'CAM',preferredSize:[44,20]},\
                  Button02: Button{text:'CC',preferredSize:[44,20]},\
                  Button03: Button{text:'LIGHTS',preferredSize:[55,20]},\
                  Label: StaticText{text:'custom label:',preferredSize:[88,20]},\
                  Textfield: EditText{text:'Type in here'},\
                  Button04: Button{text:'Take it!',preferredSize:[66,20]},\
               },\
            },\
         }";

         myPanel.grp = myPanel.add(res);   
         
         // delete default text in EditText "CustomText"               
         myPanel.grp.grp1.grp2.Textfield.onActivate = function(){                                                 
           myPanel.grp.grp1.grp2.Textfield.text ="";
                        }           
         
         // Button event
         myPanel.grp.grp1.grp2.Button01.onClick =  function(){
             onTabClicked(this.text);
             }
     
         myPanel.grp.grp1.grp2.Button02.onClick =  function(){
             onTabClicked(this.text);
             }

         myPanel.grp.grp1.grp2.Button03.onClick =  function(){
             onTabClicked(this.text);
             }
         
         myPanel.grp.grp1.grp2.Button04.onClick =  function(){
             onTabClicked(this.text);
             }         
      // create null layer and add specific name   
      function onTabClicked(standard) {
                    //    myComp = app.project.item(1);
                     //   neuNull = myComp.layers.addNull();   
                    //    neuNull.name = "____________________________ " + standard.toUpperCase();                         
         alert(standard + " button clicked");
      }         
         
         myPanel.layout.layout(true);

         return myPanel;
      }
   

   
      var myScriptPal = myScript_buildUI(thisObj);

      if (myScriptPal != null && myScriptPal instanceof Window){
         myScriptPal.center();
         myScriptPal.show();
      }

   }
   myScript(this);
}
bugreport
Posts: 3
Joined: March 2nd, 2015, 2:05 pm

The Problem is solved!
The reason for this problem is not the OS (Win/Mac), but the language.
Unbelievable!
The problem disappears by switching the language from german to english (code was written and tested in the english version).
Why adobe raise language barriers in a programming environment?
The same bullshit effetcs expressions in Ae.

The global programming language is english!

I'm done with upset. :-)
Post Reply