Send the setting click on the button (panels)

Hello world

I'm currently trying to create a dockable panel on AE with ExtendScript, and I have a problem when I create the buttons.

the thing is the number of buttons and their callbacks is not resolved and is sent to the script via a socket connected to a python interpreter.

This part works well, according to what I have sent on the socket, AE creates buttons more or less.

The problem comes when I have to click on the buttons. For now, I use this:

function createUI(thisObj)
          {
                    myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "test panel", [100, 100, 300, 300]);
                    var panelstr = "myPanel.";


                    for(var i=0 ; i < commands_lenght ; i++)
                    {
                              var cmd_name = commands_name[i].Name;
                              cmd_name = cmd_name.replace(/\s+/g, '');
                              cmd_name = cmd_name.split('.').join("");
                              var cmd = panelstr.concat(cmd_name);
                              button = eval(cmd);


                              var posb = 5 + 25*i;
                              var pose = posb + 20;
                              button = myPanel.add("button", [0, posb, 100, pose], commands_name[i].Name);
                              button.onClick = testclicked;
                    }


                    return myPanel;
          }


          function testclicked()
          {
                    alert("you clicked, well done! \nwant a medal?");
          }

or is that what I would like to send a parameter to the function being called when (onClick)

something like that:

function createUI(thisObj)
          {

                              button.onClick = testclicked(parameter);
          }


                    return myPanel;
          }


          function testclicked(parameter)
          {
                    alert("you clicked the" + parameter + " button, well done! \nwant a medal?");
          }

and so far, it has not worked.

so I wonder if it is still possible to do ^^'

Thanks in advance for your answers

Justin

You cannot add an argument to a reminder.

What are you trying to do exactly? The problem is that I do not understand what should be the variable 'parameter.

If you need to use a specific variable within your callback you could just add to your variables button, I have not tried but it doesn't work?


button1.onClick = testclicked();
button1.myParameter = "first";

button2.onClick = testclicked();
button2.myParameter = "second";

function testclicked()
{
    alert("you clicked the " + this.myParameter + " button, well done! \nwant a medal?");
}

Tags: After Effects

Similar Questions

  • Changing the default setting to change the button panel.

    10 items, the default setting for the button of the Panel change is extended. I had contracted him who put in the tray Panel. It gave me a more narrow Panel tray and more space of the editor. After resetting the panels I can't find how new contract as if it was. Someone knows how to do this or have any ideas?

    When you have the broad provision on your photo, double-click the left edge first.  That will reduce the Panel in a semi-iconized State.  Then you can change the width I described.

    Ken

  • Run a script by clicking on a button panel

    Hello

    I am very new scripting in after effects and in general.
    Several months ago I write several small scripts to speed my work flow. I have run it through the "Launching pad" script Panel.
    Now, I have my scripts in my own panel but miss me properties to bind the part "script" and the "part of the group.

    For the Panel, I have (just one button for now):

    ---------------

    win = new window ('window', 'new project', [0,0,500,500], {Center:true,});})

    but_1 is Win.Add ("Button", [33,16,103,36], "Sharpen3Way");.

    Win.Center ();

    Win.Show ();

    ------------------

    and my previous script that operate independently.

    ----------------

    myComp = app.project.activeItem;Select the composition active

    app.beginUndoGroup ("sharpness 3 Way");Starting group Undo

    mySolid01 = myComp.layers.addSolid ([100,100,100], "Whet", myComp.width, myComp.height, 1);   Layer of United Nations Adds solid

    mySolid01.adjustmentLayer = true;En transforms the solid layer of setting
    mySolid01.label = 5;Sets the color of a layer of setting
    mySolid01.opacity.setValue (40);Change the opacity of the layer

    myEffect = mySolid01.property("Effects").addProperty ("Unsharp Mask") .name = "Unsharp Mask wide";Adds an effect on this layer

    myEffect = mySolid01.Effects.property ("Unsharp Mask Large") (1) .setValue (10);

    myEffect = mySolid01.Effects.property ("Unsharp Mask Large") (2) .setValue (40);

    myEffect = mySolid01.property("Effects").addProperty ("Unsharp Mask") .name = "Unsharp Mask Medium";Adds an effect on this layer

    myEffect = mySolid01.Effects.property ("Unsharp Mask Medium") (1) .setValue (65);

    myEffect = mySolid01.Effects.property ("Unsharp Mask Medium") (2) .setValue (1);

    myEffect = mySolid01.property("Effects").addProperty ("Unsharp Mask") .name = "Unsharp Mask Fine";Adds an effect on this layer

    myEffect = mySolid01.Effects.property ('Unsharp Mask Fine') (1) .setValue (95);

    myEffect = mySolid01.Effects.property ('Unsharp Mask Fine') (2) .setValue (0.5);

    app.endUndoGroup ();Dispose of end group

    ---------------------------

    How the relationship to run the script, when I click on the but_1 ("Sharpen3Way")

    Thank you.

    Hello

    If you have a lot of paperwork and they are short like that, you can turn them into functions and in, click events, the function is called.

    A little off topic but I think it is important, to (1) avoid type windows showcase, pallets are better, (2) you must use the keyword "var" in the declaration of new variables,

    (3) to make attachable take a look at the tutorials from David Torno ([tutorial] after effects ExtendScript written Script).

    Edit: And also (4), you must use matchNames (or index) return to properties, not English name. If you give this script to someone who doesn't have an AE I English, this probably will not work

    For example myEffect should be instead: myEffect = mySolid01.property("ADBE_Effect_Parade").addProperty ("ADBE blur Mask2");

    Xavier.

    (function(){
    
        var win, but_1, but_2;
    
        win = new Window("palette","new project",[0,0,500,500],{resizeable:true,});
        but_1=win.add("button",[33,16,103,36],"Sharpen3Ways");
        but_2=win.add("button",[33+100,16,103+100,36],"Sharpen0Way");
        but_1.onClick = sharpen3Ways;
        but_2.onClick = sharpen0Way;
        win.center();
        win.show();
    
        function sharpen3Ways(){
    
            var myComp, mySolid, myEffect;
    
            // Selectionne la composition active
            myComp = app.project.activeItem;
    
            if (myComp instanceof CompItem){
                app.beginUndoGroup("Sharpen 3 Way");                  // Start Undo Group
    
                // Ajoute un layer Solid
                mySolid01 = myComp.layers.addSolid([100,100,100], "Sharpen", myComp.width, myComp.height,1);
                mySolid01.adjustmentLayer = true;                                                                                                      // Transforme le Solid en Adjustement Layer
                mySolid01.label = 5;                                                                                                                            // Attribue la couleur d'un Adjustement Layer
                mySolid01.transform.opacity.setValue(40);                                                                                                          //  Change l'opacité du Layer
    
                // Ajoute un effet  sur ce calque (unsharp mask)
                myEffect = mySolid01.property("Effects").addProperty("Unsharp Mask");
                myEffect.name = "Unsharp Mask Large";
                myEffect(1).setValue(10);
                myEffect(2).setValue(40);
    
                // Ajoute un effet  sur ce calque (unsharp mask)
                myEffect = mySolid01.property("Effects").addProperty("Unsharp Mask");
                myEffect.name = "Unsharp Mask Medium";
                myEffect(1).setValue(65);
                myEffect(2).setValue(1);
    
                // Ajoute un effet  sur ce calque (unsharp mask)
                myEffect = mySolid01.property("Effects").addProperty("Unsharp Mask");
                myEffect.name = "Unsharp Mask Fine";
                myEffect(1).setValue(95);
                myEffect(2).setValue(0.5);
    
                app.endUndoGroup();                // End Undo Group
                }
            else{
                // ignore or send some alert
                };
            return;
            };
    
        function sharpen0Way(){
            alert("About to do something, ... dont know yet what.");
            };
    
        return;
        })();
    
  • How to keep the button in the center of the resizable dialog / Panel?

    Hi all

    Y at - it means to make a button always at the center of the dialog/Panel when I resize dialog/panel without changing the size of the image?

    I use kBindAll but will change the button frame size. Is someone can you please help me solve which?

    Screen Shot 2014-07-04 at 2.09.20 PM.png

    My attribute of the button:

    ButtonWidget

    (

    kAMPBrowseBtWidgetID,

    kSysButtonPMRsrcId, / / The Plugin ID

    kBindAll, / / binding framework

    Frame (64,220,200,246) / / Frame (4,4,265,320) / / framework

    kTrue, / / is this visible

    kTrue, / / is - this permit

    'Browse Pages', / / the string value

    ),

    Hello

    I couldn't make it work by using binding.

    There may be a better way to do it, but I got it by assigning them to kBindNone and moving the button panel resize events:

    First of all, make sure that you have a custom class for display in your control panel.

    Annotate in the file en for boss of the Group widget class with:

    IID_ICONTROLVIEW, kMyPanelViewImpl,

    Add the definitions of ID, list of factory etc. and put in place a class MyPanelView (or whatever you want to call it...), derived from PanelView, for this implementation

    Then your class of MyPanelView, put in place since the function of resizing as below:

    void MyPanelView::Resize (const PMPoint & dimensions, invalid bool16)

    {

    PanelView::Resize (dimensions, invalid);

    InterfacePtr panelData (Utils()-> QueryPanelByWidgetID (kMyPanelWidgetID));

    if(panelData == Nil) return;

    IControlView * myWidget = panelData-> FindWidget (kMyButtonWidgetID);

    If (myWidget == nil) return;

    PMRect lecadrage is myWidget-> GetFrame();.

    PMReal = left (dimensions. X() - theFrame.Width (()) / 2;

    PMReal = left + theFrame.Width ();

    theFrame.Left (left);

    theFrame.Right (right);

    myWidget-> SetFrame (lecadrage, kTrue);

    }

    You will have need of these includes:

    #include 'Utils.h.

    #include "IPalettePanelUtils.h".

    Hope that helps

  • Went and found buttons panel

    Hi all

    For some reason any my Indesign CS4 shows nor the button panel. Window > Interactive shows that bookmarks, links and the Page Transitions as options. I tried all the workspaces (same interactivity) and the option to show the button panel does not appear. In addition, there is also no option to create a new button. Object > Interactive went as well.

    What happens here?

    the default plugin works with button panel is ButtonUI.apln under windows, the operating system is not mentioned on the thread.

    You can check that the plugin in the folder adobe Indesign program folder files (windows) or applications folder (mac).

    If it isn't found, just to re - install, (no need to uninstall)

  • How can I set up a structure of the event that sends text when the user presses the button "Return"?

    I'm new to programming of the Structure of the event.  I am trying a program which causes the content of a control to the string to be processed when the user presses the button back in after typing in the control of the chain.  I think (I hope!) that it is simple, I just can't understand how do.

    Basically, I would take the attached VI and change so that the user can send the value of control 'String In' to the indicator "String Out" either by pressing the 'Return' key or press the button 'send string. '

    Any help would be greatly appreciated.

    This example has nothing to do with the RETURN key specifically.  It fires all simply whenever the value of the control is changed.  If you click outside the text box or on another still controls the value changes and still the event is raised.  This is often the desired so if it works in your application, you good to go.

    You CAN ONLY answer a particular key if you wish.  Set your event to meet 'This VI' > key down.  Then, read the proposal Vcle on the left side of the structure of the event and compare it to the RETURN (for example).  The Boolean result of the comparison gets connected to a structure to deal with your code to run inside.  You can also wire Vcle directly to a case structure and execute different code based on which key was pressed last.

  • Is there a way to put a button on the front panel only when clicked gives a pop-up dialog box with more information on it?

    Hello world

    The simulations that I create are very simple themselves but are intended to use in the classroom to help students learn more about the proven theory.  I hope to be able to place a 'help' or 'other info' button on the front panel that rises wants more info on theory, they can click on it and a pop up appears with background information on it.  It should also have a second button to close it and return to the main façade.  Can anyone lead me in the right direction?

    Thank you!

    Use a structure of the event on the main vi when the button is clicked, launches a "help" void / vi. On the inside of the Sub vi (with the set properties to load the front when it is called, of course), use another structure of the event to wait until then click on the button of the Subvi, you can return to the main VI. Do you need assistance on using the structures of the event?

    Charles

  • Click on the button - send text dynamic text control HTML5

    Hello

    I want to click a button on my Html5 canvas that sends the text specified in a dynamic text box.

    It does not work... That's what I have on frame 1 of the scenario

    this.myBtn.addEventListener ("click", fl_MouseClickHandler_3.bind (this));

    function fl_MouseClickHandler_3()

    {

    Start your custom code

    This code example displays the words 'mouse clicked' in the output panel.

    Alert ('mouse clicked');

    sym. $("myText") .html ("my dynamic text here");

    Complete your custom code

    }

    The red line is my problem... I don't know how to get the right code for the TextBox on the Web.

    I want finally to be able to add a few basic etc. PHP functions.

    Thanks in advance

    Figured it out...

    this.myBtn.addEventListener ("click", fl_MouseClickHandler_3.bind (this));

    function fl_MouseClickHandler_3() {}

    this.myText.text = ' My dynamic text here ';

    }

  • Problem of setting a value for the hidden item click on the button with processes action or pl/sql dynamic

    Apex 4.1

    Oracle 11g

    I have a page which consists of a main and several sub-regions area.  I have a pl/sql process in after the header SET_DISPLAY(:P400_DISPLAY:='MAIN';))

    Three subregions have a contional show where P400_DISPLAY = STORE.  It works in the hiding of the sub regions.

    Now, I want to change the value P400_DISPLAY to the STORE to show the subregions when I hit a button.

    I tried to create a dynamic action for the click on the Add button, but get the following error:

    The selected button uses a model of 'button' that does not contain the #BUTTON_ID substitution string #.

    I went to the models and found:

    Substitution strings

    Top

    Substitution strings are used in sub models to reference the value of the components. This report details use of string substitution for this model.
    Substitution string Referenced De Description
    #LINK #.YesModelTo be used in an attribute "href".
    #JAVASCRIPT #.NO.To be used in an "onclick" attribute
    #LABEL #.YesModelButton label
    #BUTTON_ATTRIBUTES #.NO.The attributes button
    #BUTTON_ID #.NO.ID generated button will be ID either the static button if defined, or if not will be a generated ID internally in the format 'B ' | [Internal ID of the button.

    I then tried to create a page process, pl/sql,: P400_DISPLAY: = 'STORE '; If the button is pressed.  The action of the button is submit page. However, it does not change the value of P400_DISPLAY and the subregions are hidden.

    Suggestions please on how to fix the template or change the value of P400_DISPLAY?

    The question of the root, it's that, even if you change the value of the element of your page, it is not visible to other areas of the page until it is in the session. Thus, any other action based on the value of the element of your page. the visibility of a control, a report based on the value of the item, etc. will be affected by changing the value of the item page until it has been changed in the session. Even after that, items are stored in the session, then you must do something to influence the revalued value. To see the effect of this, observe that your page will load and assesses the value of the element of your page, it sees which is the "MAIN" and mask areas. However, he didn't reassess after that.

    Then; your choices for this value set at the session are send the page, or use JavaScript to set the value in the session. If you use the latter, you will have to do extra work to make visibility tests be re - run, so, let's stick with the submit method.

    What you did above sounds correct to do this but, there are a lot of decisions, that you might have done that may have caused things to do not occur in the correct order.

    First of all, we will confirm that what I describe above is your problem. From the development environment, load the page, click on the button to change the value and submit. Now, click on the link marked the Session. He is always at HAND? If the answer is "Yes"; That's your problem.

    Let's start with your calculation after the header. You set it to * only * run if the current value of the element of your page is null? If this isn't the case, it's your problem.

    Load the Page-> Item set to 'Hand' by calculation-> click on the button--> Item set to STORE-> Submit-> Page Load-> point by calculating the value 'hand '.

    See the problem?

    Assuming that's not the question, you have created a branch to the same page, right? What is your process for the branch point? Is it * after * Validation, computation etc.? Because if not, you are not changing the value before that didn't get to submit.

    I bet that's the first question, but take a look at these.

    See you soon,.

    -Joe

  • How to set a value of outputText 0 during the click on the button cancel using javascript

    Hi Experts,

    JDEV version 12.1.3.0

    I have an outputText at the foot of the column. And I have a button cancel on the top of the page. Then click on the button cancel. How can I set the outputText zero value.

    Thank you

    AR

    Hello

    Please check the labour code. Make clientComponent = "true" in the output text.

    function customOutputValue (event) {}

    var buttonComponent = event.getSource ();

    Find the client component for the af:outputText 'greeting '.

    var oComponent = buttonComponent.findComponent ("ot1");

    Set the value of the outputText component

    oComponent.setValue("0")

    }

    >

    Thank you
    Amey

  • I don't see the Audio waveform in the timeline panel. No triangle click button. Just changed pcf. Help!

    I don't see the Audio waveform in the timeline panel. No triangle click button. Just changed pcf. Help!

    I solved the problem.  It was just a matter of push lines down and creating a larger space of work for each row of the audio.  Never had this problem at the time of AVID or FCP.  I appreciate your help!

  • How to open a modal dialog box of click of a button on the Panel?

    Hi all

    I tried to open a modal dialog box on the click of a button on the Panel the other day. But failed. I managed to have a panel appear on click of a button. But the Group appeared at the forefront of the parent panel. I don't want to. Here are some screenshots of what I managed to do and what I want to do.

    This Panel will appear on the click on the button "Click." Note that the child Panel cannot be moved outside the bounds of the parent panel.

    1.JPG

    Instead, I want the behavior of the child Panel as shown below. As the modal dialog box that appears when we create a new action game in the Actions Panel.

    2.JPG

    This Panel can be moved all around the application window. Kindly guide my way through from there to achieve.

    Thank you!

    Post edited by: poortip87

    You can open a modal secondary window like this:

    var w: Window = new Window(); A mx:Window, or your own subclass

    w.type = CSXSWindowTypes.MODAL_DIALOG; in the package com.adobe.csxs.types

    w.Open ();

    There are up to four types of different windows that you can open in the form of secondary windows, although not all are currently available in all products.

    HTH

    David.

  • Create new vi by clicking a button on the front panel

    Hello. I'm quite new with Labview.

    I have to use an if statement to activate a button (I don't know if it is possible or not in LabVIEW) then when the button is enabled for the user must click on the button (allows the button say NEXT) to close that vi and open an another vi to a specific address. I have need to record anything the previous VI that I just need to close and open a new one.

    Does anyone know how to activate a button to get the right answer to an if statement first and also how to close and open the new vi by clicking this button.

    Thank you very much.

    I think that the seal will help you much further.  I have documented if necessary.  If you have any other questions, feel free to ask.

    Open Main.vi and run

  • Want to send the pdf file automatically when you click on the SUBMIT"" button.  With the help of Acrobat 11?

    Rather than send the email as an attachment in the email, it opens an email which must be then 'send '.  Using Firefox

    Hey dennis5646,

    You choose Attach button in the toolbar will automatically send the PDF file as an attachment to Email.

    Reference: Acrobat/Reader: attach to button Email does not not for PDFs referenced from a long URL

    Let me know if this helps.

    Kind regards

    Ana Maria

  • Documents on the right panel of the Start button may not work?

    Documents on the right panel of the Start button may not work?
    Right click show properties, Blank? Previously ok when click on it goes in the document folder.

    Hello

    1 did you change on your computer?

    2. What happen exactly when you open documents?

    3. are you able to Documents to another location for example the windows Explorer folder?

    Method 1:

    Step 1:

    I suggest you check in safe mode.

    Start your computer in safe mode

    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    Step 2:

    I also suggest you perform the clean boot and check.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: After a repair, be sure to set the computer to start as usual as mentioned in step 7 in the above article.

    Method 2:

    I also suggest you to run the System File Checker.

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

    I suggest you send the screenshot of the windows properties document...

    Provide this link to screenshot

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/how-do-i-post-a-screen-shot-on-this-forum/c86de820-C620-401c-A804-9f6337cd3053

Maybe you are looking for