How to run a script from a "Button 1" button?

Hi all, I had this problem to have a window with several buttons named "Button 1" "button 2"... and run the script 'Script A' If you click on button 1, the script 'Script B' If you click on the button 2, etc... ".

Here is my small script:

indesign #target

create a table of contents that send directly to the good script

var l = new Window ("dialog");

var buttongroup = w.add ("group");

var panel = buttongroup.add ("panel");

var button1 is panel.add ("button", undefined,"Script");.

var button2 is panel.add ("button", undefined, "Script B");.

var button3 is panel.add ("button", undefined, "Script C");.

var cancel = buttongroup.add ("button", undefined, "Cancel", {name:'cancel'});})

buttongroup.addEventListener ('click', press)

w.Show ();

function press (e) {}

{if(e.Target.type=="Button")}

If {(A e.target.text is "Script. »)

w.Close ();

app.doScript (new File("c/scriptA.jsx"),ScriptLanguage.javascript);

}

Else if (e.target.text == "Script B") {}

app.doScript (new File("c/scriptB.jsx"),ScriptLanguage.javascript);

}

Else if (e.target.text == "Script C") {}

app.doScript (new File("c/scriptC.jsx"),ScriptLanguage.javascript);

}

}

}

Each manuscript A, B and C starts with an app.dialogs.add)

And that is the problem, he said that an alert or a modal dialog box is already active

I tried the w.close (), but it does not work...

I don't think that addEventListener is what I need, maybe I'm wrong for a window, but it is the only way to give names to the buttons, is it not?

Instead of var this:

w = new Window ("dialog");

Use this:

var l = new Window ("range");

Peter

Tags: InDesign

Similar Questions

  • How to run a script from a URL HTTP

    Hi all
    I tried to run an ODI scenario from an html page following the guide (all parameters are correct), but the result
    is:

    snps_exe_ok: false
    snps_session_no:-1
    snps_error_msg: MY_AGENT_NAME

    When I try to start a DND agent scenario works very well.
    Any suggestions?

    Thanks in advance,


    Ant

    Please,

    change the

    TO

    And this shoul solves the problem.
    I had the same situation a few months ago and take more than 3 days to figure this!

  • ScriptUI run the script in the button of the dialog box

    Here's what I have right now.  It's a little awkward in the way it works, and I just have a little smoother.

    I have a script at startup which creates a Menu item with a submenu of the menu item drop-down. When you click the submenu item, it runs a script.

    The first thing the script is pop up a message box that tells them that two dialog boxes go to the pop-up window. One by asking them to choose the location of an xml file and the second dialog box that ask them to choose the location of their folder of images.  After you finish choose their folder in the second dialog box, the script takes these two values, makes variable and continues to run the rest of the script.

    Here's what I would...

    1. open a window for dialogue with two input fields, both 'Browse' buttons and OK and CANCEL buttons

    2. When you click Browse next to the first input box for the first button, it will open a file dialog window.  You select your file and the file string will populate the input field

    3. When you click on the second button next to the second entry field, it opens a file dialog window.  You select the file and the string fills the second input field.

    4. When you click OK, it nurtures values in the input to a script fields.

    I already have scripts which opens the dialog for file and folder boxes, but what I can't understand how the is to start and run a script to a button press, in this case, when you press the OK button.  It's probably an onClick, but I was not able to find examples of what would be the syntax.

    Is the closest I found in the beginning ScriptUI document that was on the site of Jongware, in the section on Communication between the windows.  But each window opens with a different scenario and is not using a button to call a script.

    As always, any point in the right direction is much appreciated. Thank you.

    ScriptUI windows and JS file dialog boxes are not communucate. To get a return value in a file dialog box, you would do something like this:

    myFile = file (myFolder) .openDlg ("select files");

    If (myFile = null)

    back, do nothing

    The JavaScript Tools Guide CSx (see the Help menu on the ESTK) documents several dialogues selection of files and folders.

    Peter

  • When I run my script from a shortcut ExtendScript is invoked, but this isn't when I run the menu

    I use Photshop CS2 on Win XP

    I set up a keyboard shortcut (Ctrl + Alt + P) to execute a .jsx file in the folder... \Presets\Scripts\.

    When I activate the script via the keyboard shortcut ExtendScript is called and interrupts execution on main() statement (see below).

    When I activate the script via the menu file/Scripts that extendscript is not called and the script runs up to the end.

    The .jsx file is a wrapper for a .vbs script that does the 'real' work

    The .jsx is:-

    main() function
    {
    var VBSscript = file ("C:/Program Files/Adobe/Adobe Photoshop CS2/Presets/Scripts/GGN_PS_Code_v1_2.vbs");
    If (VBSscript.Exists) VBSscript.execute ();
    }
    main();

    Anyone have any ideas on how to disable the invocation of ExtendScript when I run the script from the skortcut?

    One thing to check is that the .jsx extension is associated with Photoshop and not ExtendScript.

  • How to run a script in environment unix and how to run this program into a toad

    Hello guys
    Please help me!
    How to run a script in the unix environment (Group of programs (cursor, programs...) stored in a file file.sql).

    file.sql luks like this


    WHENEVER OSERROR EXIT FAILURE
    WHENEVER SQLERROR EXIT SQL. SQLCODE
    SET the position
    SET serveroutput size 1000000
    coil ins2aais_jobs;
    SELECT "FILE IS: ins2aais_jobs' FROM dual;"
    SELECT "STARTED:' began, to_char (sysdate," YY/MM/DD HH24:MI:SS) TIME FROM dual; "
    DECLARE
    lv_upd_ct number: = 0;
    lv_ins_ct number: = 0;
    lv_exp_ct number: = 0;
    ---------------------

    date of lv_FROM_date;
    date of lv_to_date;
    lv_mon_or_week varchar2 (20);
    date of lv_week_end_date;
    lv_month_indicator varchar2 (8);
    -------------------------------------------------
    Aais CURSOR IS
    SELECT the ID substr (ID, 1, 7), SSN, FNAME, LNAME
    , SUCCESS, COMPENSATE, INSTALLATION
    , MODU, DRIVE, REVERSE, SUCC_RATE
    TRANS_TOTAL, FILE_NAME, WEEK_END_DATE
    RUN_DATE
    OF weekly_aais;

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

    I aais % rowtype;


    -------------------------
    PROCEDURE p_ins (r1 aais % ROWTYPE) IS
    BEGIN
    BEGIN
    INSERT INTO AAIS_JOBS
    (ID, SSN, SUCCESS, COMPENSATE, INSTALL, MODU
    , DRIVE, REVERSE, SUCC_RATE, TRANS_TOTAL
    FILE_NAME, WEEK_END_DATE, RUN_DATE
    AAIS_FNAME, AAIS_LNAME
    )
    VALUES
    (r1.ID, r1. SSN, r1. SUCCESS, r1. COMPENSATE, r1. INSTALLATION, r1. MODU
    r1. DISK, r1. CONVERSELY, r1. SUCC_RATE, r1. TRANS_TOTAL
    r1. File_name, r1. WEEK_END_DATE, r1. RUN_DATE
    r1. FNAME, r1. LNAME
    );
    lv_ins_ct: = lv_ins_ct + 1;
    EXCEPTION
    WHILE OTHERS then
    DBMS_OUTPUT. PUT_LINE ('ERROR IN THE INSERT STATEMENT');
    DBMS_OUTPUT. Put_line (SQLERRM);
    lv_exp_ct: = lv_exp_ct + 1;
    END;

    END;

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

    PROCEDURE p_disp_msg IS
    BEGIN
    DBMS_OUTPUT. Put_line (' number of insertion: ' | to_char (lv_ins_ct));
    DBMS_OUTPUT. Put_line (' number of Exceptions: ' | to_char (lv_exp_ct));

    lv_ins_ct: = 0;
    lv_exp_ct: = 0;
    END;

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

    BEGIN

    lv_FROM_date: = to_date ('& 1', 'DD-MON-RR');
    lv_to_date: = to_date ('& 2', 'DD-MON-RR');
    lv_mon_or_week: = 'and 3';

    lv_month_indicator: = di.get_month_ind (lv_mon_or_week, lv_FROM_date, lv_to_date);

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

    REMOVE FROM AAIS_JOBS
    WHERE WEEK_END_DATE = lv_to_date;

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

    COMMIT;

    Aais OPEN;
    LOOP
    EXTRACT the aais IN i;
    OUTPUT WHEN aais % NOTFOUND;
    BEGIN
    p_ins (i);
    END;
    END LOOP;
    Aais CLOSE;

    commit;

    DBMS_OUTPUT. PUT_LINE ('INSERT INTO TABLE JOBS AAIS');
    p_disp_msg;


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

    END;
    /
    SELECT "FINISHED: ' | '. TO_CHAR (sysdate, "MM/DD/YY HH24:MI:SS'") FROM dual
    /
    spool off
    "exit";


    and also how we organize this into a toad?


    Thank you.

    Hello

    You vous connecter connect to oracle through unix and SQL prompt, run these commands in a .sql file.

    Toad, you can run the instructions individually by selecting the sql statements or in a set with the F5 key.

    Kind regards
    AJR

  • How to run a plugin from Adobe Indesign?

    I have download indesign SDK CS6.

    and build the sample project: \Adobe InDesign CS6 Plugin SDK\build\win\prj\BasicDialog.sdk.vcxproj

    But i copy 2 files: BasicDialog.sdk.pln and BasicDialog.pdb to [C:\Program Files (x 86) \Adobe\Adobe InDesign CS6\Plug-Ins]

    It I open Adobe Indesign CS6, it shows the error message:

    Adobe InDesign does not recognize the BASICDIALOG. SOFTWARE DEVELOPMENT KIT. PLN as a plug-in. Please reinstall the BASICDIALOG. SOFTWARE DEVELOPMENT KIT. Plug-in PLN and restart InDesign.

    Redisplay this alert?

    How to run a plugin from Adobe Indesign?

    Thank you all.

    Hi daitranthanhoa,

    You must also copy the file (BasicDialog.sdk, resources). It is part of the plugin.

    Markus

  • Best way to run a script from a script

    Hello world

    I'm looking for running a script from an After Effects script, so far, there is aftereffects.executeScript (scriptContent) who use eval to run the script. The problem is that it uses eval so it is not really sure and he is slower. So I would like to know what is actually used when we file-> Script-> Run script file.

    As seen in the Javascript tool Guide CC page 168 in the section QAnywhere Corss-DOM.

    aftereffects.executeScript(theScriptContent); // Doesn't work with a script which as comments AND the script has access to my scope
    

    In addition, if there are comments like / * * / or / * / in the script I want to run, it no longer works.

    So, what is the best way to run a script from a script?

    If you want to evaluate a whole script file, you can use $.evalFile (file, timeout) - see description in ESTK object model viewer

    To evaluate a bit of code, you can use eval, that's for sure.

    Xavier

  • How to run a script for all the images in a folder?

    How to run a script for all the images in a folder?

    You can assign your script to an action, then use processor by batch or image with the option apply to all subfolders.

  • How to run a test from Unix script

    Hello

    Can someone guide me how to run a test case of (created in SQL Developer) unit from unix.

    Thank you
    Lifexisxnotxsoxbeautiful

    You should be able to run your tests using the command line interface:

    http://docs.Oracle.com/CD/E25259_01/AppDev.31/e24285/unit_testing.htm#BCGFBIDD

  • How to run an Application from Firefox?

    Hello
    I want to run an application from my Firefox browser, for example I want to run Notepad.exe from Firefox. I wrote the following program and it opens Notepad from Microsoft Internet Explorer successfully, but when I try to open the same page of Firefox, nothing happens. Firefox only opens it. Is there some sort of opening the Applications in Firefox? Kindly tell me how to open an Application of the Firefox browser.

       <script type="text/javascript" language="javascript">
           function RunFile() {
    
           WshShell.Run("C:\Windows\System32\KinectClothing2.exe", 1, false);
    
           }
       </script>
    

    Maybe the extension "external applications 2 buttons" at https://addons.mozilla.org/en-US/firefox/addon/external-application-button/ which is based on the extension of origin began by Torisugari over ten years ago.

  • Run SQL scripts from a unix directory

    DB version: 11.2
    Version of the operating system: Solaris 5.10

    We have a set of scripts that are used by administrators to display the info of Tablespace free space, file size information... etc.

    Currently these .sql files (say free_Space.sql) are stored in the directory/U02/dba_scripts /. To run these scripts a dba can navigate to this directory, and then connect to sql * plus and from there run it as
    SQL > @free_Space.sql
    I recently came across an environment where you can connect to SQL * more than any directory and you can run scripts as above any directory. How is that possible? Should what settings I set for this?

    Herbaceous says:
    DB version: 11.2
    Version of the operating system: Solaris 5.10

    We have a set of scripts that are used by administrators to display the info of Tablespace free space, file size information... etc.

    Currently these .sql files (say free_Space.sql) are stored in the directory/U02/dba_scripts /. To run these scripts a dba can navigate to this directory, and then connect to sql * plus and from there run it as

    SQL > @free_Space.sql
    

    I recently came across an environment where you can connect to SQL * more than any directory and you can run scripts as above any directory. How is that possible? Should what settings I set for this?

    SQLPATH environment variable

  • How to run a script in the idle task

    Hi all

    Successfully, I wrote and performed a routine of idle task that periodically executes a simple method. now, I need to add a feature to this method so that it performs a simple javascript.

    Here is my code:

    ...

    UInt32 myTestIdleTask::RunTask)
    UInt32 appFlags, IdleTimer * timeCheck) {}
    If (appFlags &)
    (IIdleTaskMgr::kMouseTracking
    | IIdleTaskMgr::kUserActive
    | IIdleTaskMgr::kInBackground
    | IIdleTaskMgr::kMenuUp))
    {
    Return kOnFlagChange;
    }

    This-> runTestScript();

    Return kmyTestFvExecInterval;
    }


    void myTestIdleTask::runTestScript() {}

    This is the test script

    PMString myTestScript ("app.activeDocument.exportFile (ExportFormat.pdfType, File(\"/Users/testuser/testing.pdf\"),false);" ');

    I think that I should call CScriptRunner::RunScript()
    somewhere here but without success

    }

    Any help on how to run the Javascript code for myTestScript from the runTestScript() method?

    Thanks in advance,

    Halin

    Already, I solved my problem by using "IExtendScriptUtils".

    For those who are interested, here is my solution:

    void myTestIdleTask::runTestScript() {}

    This is the test script

    PMString myTestScript ("app.activeDocument.exportFile (ExportFormat.pdfType, File(\"/Users/testuser/testing.pdf\"),false);" ');

    PMString engineName ("myengine");

    Int32 errorCode is Utils()-> RunScriptInEngine (engineName, myTestScript);.

    }

    Good luck.

    halin

  • How to run the script to EEM/TCL file

    Hello world

    I need to run the EEM script found in this link

    https://supportforums.Cisco.com/document/75806/interface-input-queue-Mon...

    Can you please point me to a HOWTO to download the file and run it under an interface?

    Thank you

    Federico

    Here is the manual how to run scripts tcl file - http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ios_tcl/configuration/1...

    In short - you download the script to switch via tftp and the tcl implementation with command tclsh interpreter. Then run the command source source

  • How to run the script with parameters such as alarm action .ps1

    Hello

    I know not how to configure alarms, I know that I can point to monitor cluster for changes (via the GUI), but... I have different groups and I would like to set an alarm by vCenter which monitors cluster for changes. Let's call it "RefreshCapacityInfoOnExternalDB".

    So, lets just say. I would like to run my script whenever a virtual computer is added, Reconfigured or ESX host are removed, added in a Cluster. The alarm would launch the .ps1 script written in turn the ability to update external db cluster info.

    Shortly said: ability to cluster values are changed

    What I need is this: run the script-> CapacityInfoRefresher.ps1 < Cluster_name_where_ReconfigEventsTookPlace >

    I guess that, first I need an environment variable (if it exists) that can be used as a parameter for the < Cluster_name_where_ReconfigEventsTookPlace > placeholder script. Right?

    Chapter 16 of the book of LucD & Friends "PowerCli reference" mentions some environment vars but I'm stuck. Anyone using these options?

    THX

    A.S.

    You can set your alarm on the node above in your vCenter tree, this way it will be active for all collections in the vCenter.

    These alarm environment variables are automatically available for your alarm script when it is triggered.

    These environment variables, you will be able to determine to which cluster the alarm was pulled.

    So I don't think that you need to pass this information as a parameter to the script.

    Perrhaps you could share what exactly alarm you want to set and what looks like the script which should trigger alarm.

    And Yes, I use these environment variables in scripts of alarm

  • How to run a script?

    I'm new on this bear so with me

    I would like to run this script to list all virtual machines and their data warehouses, but I don't know how to make it work lol... Please help thanks

    $report = @() 
    $allvms = Get-VM 
    foreach ($vm in $allvms) { 
            $clusterName = ($vm | Get-Cluster).Name
            $dstores = $vm | Get-Datastore 
            foreach($ds in $dstores){ 
                    $row = "" | select VMNAME, DATASTORE, Cluster 
                    $row.VMNAME = $vm.name 
                    $row.DATASTORE = $ds.Name 
                    $row.Cluster = $clusterName
                    $report += $row 
            } 
    } 
    $report | Export-Csv "C:\vm_ds.csv" -NoTypeInformation

    Of course, to get the information to the VMDK to a simple VM VMDK, just add

    $vmdk = ($vm | get-hard drive)

    $row. VMDKSIZE = ($vmdk. CapacityKB) / 1024/1024

    $row. VMDKFILE = $vmdk. File name

    in the loop where you're collecting information.

    You probably want to get the information for all the vmdk and for that you will need to browse all the files on disc - Get-HardDisk returns an array of VMDK when there is more than one.  Depending on how your output are collected, which could be interesting.

Maybe you are looking for