JS CS3 import external data in the dialog box.

I would like to create a drop-down list in a dialog box that is populated by txt or XML files. Is this possible?

  1. First a xml or txt file would be created that lists all current products that we do. He would sit on a server.
  2. The InDesign script reads the xml or txt file and in the dialog screen of by-products would only provide the user names in the xml/txt file.
  3. The user can select the product in the list and run the script.
  4. The xml/txt file may be updated at any time (add or remove products according to the needs)

Do not import the XML file. Instead, read it in and create your own XML object.

var prefXMLFile = File("/c/test.xml");

If (prefXMLFile! = null) {}

Ditto var = prefXMLFile.open ("r", not defined, undefined);

if(myResult == true) {}

xmlstr var = prefXMLFile.read ();

}

on the other

{

Alert ("Error")

}

prefXMLFile.close ();

}

var xmlobj = new XML (xmlstr);

Once you have the XML object, you can populate a drop-down list by making a loop like this (from one of my projects)

var countitems is xmlobj. Categories [0]. Category.length ();

for (i = 0; i<>

{

curitem = xmlobj. Categories [0]. Category[i][email protected] ();

myArtDialog.category_dd.add ("item", curitem);

}

You should read the JavaScript_Tools_Guide_CS3 for more information about how to use the XML object.

Ralf

Tags: InDesign

Similar Questions

  • Display document data in the dialog box

    I use a folder level script to do the following:

    Get the value of a specific field XMP against an open PDF file:

    this.info.InDesignFileName

    Define a dialog box

    Create a menu item that calls up the dialog box

    But for the life of me, I can't get the dialog creation function to fill the XMP value in a static text element.

    The function below is changed from the right example out of the Acrobat Javascript API Reference.

    var inDesignNameDialog = {}

    initialize: function {(dialogue)

    store InDesignFileName XMP

    var indfn = this.info.InDesignFileName

    Create a static text containing the current date.

    / * var todayDate = dialog.store () ["date"];

    todayDate = "Date:" + util.printd ("mmmm dd, yyyy", new Date()); "."

    Dialog.Load ({'date': todayDate});

    */

    var todayDate = dialog.store (['indfn']);

    currFN = "Date:"+ this.info.InDesignFileName; "

    Dialog.Load ({"indfn": currFN});

    },

    function: Commit (dialog) {/ / called pressed OK}

    results var = dialog.store ();

    Now do something with the data collected, for example,

    Console.println ("your name is" + results ["fnam"]

    + "" + results ['lnam']);

    },

    Description:

    {

    name: 'Personal data', / / title of the dialog box

    align_children: 'align_left,

    Width: 350,

    height: 200,.

    elements:

    [

    {

    type: "cluster."

    name: 'Your name',

    align_children: 'align_left,

    elements:

    [

    {

    type: "display."

    align_children: "align_row."

    elements:

    [

    {

    type: 'static_text. "

    name: "" first name: ".

    },

    {

    item_id: 'fnam ',.

    type: 'edit_text. "

    alignment: "align_fill",.

    Width: 300,

    height: 20

    }

    ]

    },

    {

    type: "display."

    align_children: "align_row."

    elements:

    [

    {

    type: 'static_text. "

    name: "" name: ".

    },

    {

    item_id: "lnam."

    type: 'edit_text. "

    alignment: "align_fill",.

    Width: 300,

    height: 20

    }

    ]

    },

    {

    type: 'static_text. "

    name: "InDesign file name: «,»»

    char_width: 50,.

    item_id: "indfn."

    },

    ]

    },

    {

    alignment: 'align_right ',.

    type: "ok_cancel."

    ok_name: "Ok."

    cancel_name: "Cancel".

    }

    ]

    }

    };

    cExec: "inDesignNameDialog.parentDoc =; app.execDialog (inDesignNameDialog); «,

  • The use of data in the dialog box

    Hello

    I started using DIAdem Dialog Editor and I wonder how I would use data that has been entered in a dialog box or table cell perform some calculations on it and display the results in another dialog box.

    I'd also be looking to retrieve data in a drop-down list or dialog box and and displayed it in my final report format.


  • Numbers - how to import external data to a cell in a single file into a new cell in another file?

    Numbers - how to import external data to a cell in a single file into a new cell in another file?

    I want to do the same thing in numbers (3.6.2 (2577) I used to do in Excel (any version):)

    to import a calculation of a cell in a file in a new cell in another file.

    Example: I want to import the result of a sum in a specific cell of my accountant in August to a cell in comparison in my accounting of September.

    It was so easy in Excel. Until the reference computer broke down.

    By the numbers, I tried to copy - paste the contents of the cell formulated, but not good.

    No help manual online or anywhere. I think that maybe the function is absent in number.

    Then I return to MicroSoft Excel, that I have used for many years and I am sorry to say feel much more wysiwyg.

    Formulas in a numbers document cannot reference cells in other documents of numbers.

    "Much more wysiwyg" is another way to express what many of those who "used (MS Excel) for many years" expressed as "more intuitive. These two descriptions usually boil up to ' what I'm used to, ", which is also true in the other sense.

    Whatever the real explanation, the standard advice is "the tool that will do the job." If "the job" requires referencing values in a separate document, the numbers (alone and without the help of AppleScript) are not the best tool for this job.

    Kind regards

    Barry

  • Specific PDF page without the dialog box options import

    Hello

    I do the multipage PDF to import programmatically (without the dialog box options).

    Import a PDF page specific to a graphic image of the first step for the solution. 

    I use the SDKLayoutHelper::PlaceFileInFrame function but I can't select a specified (for example, page 2) page programmatically

    Thanks in advance

    Károly

    I figured out by SnpPlaceFile.cpp

    ....
    // The solution
      InterfacePtr cmdSetPDFPlacePrefs(CmdUtils::CreateCommand(kSetPDFPlacePrefsCmdBoss));
      InterfacePtr pdfPlacePrefData (cmdSetPDFPlacePrefs, IID_IPDFPLACEPREFS);
      pdfPlacePrefData->SetTransparentBackground(kTrue);
      pdfPlacePrefData->SetPage(2);
      result = CmdUtils::ProcessCommand(cmdSetPDFPlacePrefs);
    //
    
      UIDRef frameRef = layoutHelper.PlaceFileInFrame(fileChooser.GetIDFile(),
      parentUIDRef,
      boundsInParentCoords,
      uiFlags,
      fileChooser.GetRetainFormat(),
      fileChooser.GetConvertQuotes(),
      fileChooser.GetApplyCJKGrid());
    
  • Looking for model/data format to import survey data in the survey on demand in the apex 4.2.5

    Hello

    Looking for a model/data format to import survey data in the survey on demand in the apex 4.2.5.

    Thank you

    hayatms wrote:

    Where I can get this CSV format, so I have to add in the file accordingly. Thank you

    Click on the button create poll on the surveys page, then select the option to create a survey from a text file. An example of the required format is displayed. It is not a CSV format.

  • [CS3 - Win] - Auto cancelled the dialog box

    Hello

    I have to cancel my Modal dialog box move after a few minutes (applying the UserCancelled() function automatically).

    Try this code:

    Application InterfacePtr < IApplication > (gSession-> QueryApplication());
    InterfacePtr < IDialogMgr > dialogMgr (application UseDefaultIID());

    InterfacePtr < ICommand > closeDialogCmd (CmdUtils::CreateCommand(kCloseDialogCmdBoss));)
    CloseWinData InterfacePtr < ICloseWinCmdData > (closeDialogCmd, IID_ICLOSEWINCMDDATA);
    closeWinData-> Set (dialogMgr-> GetFrontmostDialogWindow());
    CmdUtils::ProcessCommand (closeDialogCmd);

    Result: the dialog box is closed, but I don't have access to the application.

    Do you have any idea, please.

    Best regards
    BADR

    Hi Badr,

    If you just want to call UserCancelled() on the foreground dialog box, you can try this:

    InterfacePtr application (gSession-> QueryApplication());
    InterfacePtr dialogMgr (application UseDefaultIID());
    InterfacePtr window (dialogMgr-> GetFrontmostDialogWindow (), UseDefaultIID ());
    InterfacePtr panelCtrlData (window, UseDefaultIID ());
    IControlView * iCtrlView = panelCtrlData-> FindWidget (kCancelButton_WidgetID);
    InterfacePtr iiSubject (iCtrlView, IID_ISUBJECT);
    If (iiSubject)
    iiSubject-> Exchange (kTrueStateMessage, IID_IBOOLEANCONTROLDATA);

    HTH.

    Kind regards
    Jasmine Shaikh

  • I get no answer to by clicking "Edit" in the dialog box indexing options. ;

    original title: indexation of dialog options change

    I recently followed instructions from this forum on the removal of invalid index locations; I have rebuilt the index. Unfortunately, an external drive that had been indexed throughout without asking me, is not be indexed now.  When I followed the instructions from Microsoft on the addition of the search location, I get no answer to by clicking "Edit" in the dialog box indexing options. ; nothing happens.

    Help!

    Hello

    Method 1: Let flow the fixit available in the link below and then check

    Fix Windows Search when it crashes or shows no results

    http://support.Microsoft.com/mats/windows_search/en-us

     

    Method 2: If a Protection of resources Windows (WRP) file is missing or is damaged, Windows may not behave as expected. Auditor of file system (CFS) scan to fix all of the corrupted system files. To do this, follow the steps mentioned in the link below:

    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

     

    Method 3:  Select the boot and then check if the problem persists

    Follow step 1 in the link below,
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem.

    Continue with the remaining steps to pin-point on the third party service.

    After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.

  • When you delete a file in Vista, the dialog box remove does not close until the computer is restarted

    When you delete a file in Windows Vista, the dialog box remove don't close until the computer is restarted. It is sometimes possible to remove it by closing tha task list. When this is done, the Explorer is closed and restarted.

    Hi Brian,.

    (1) since when are you facing this problem?

    (2) remember to make changes?

    Method 1: Run the fixit available in the link below and check if that makes a difference

    Difficulty of broken desktop shortcuts and common system maintenance tasks


    Note:
    Fixit would attempt to recover bad sectors on the hard disk, in the course of this process there are chances of data loss from that particular area.

    Method 2: If a Protection of resources Windows (WRP) file is missing or is damaged, Windows may not behave as expected. Auditor of file system (CFS) scan to fix all of the corrupted system files. To do this, follow the steps mentioned in the link below:

    How to use the System File Checker tool to resolve missing or damaged on Windows Vista or Windows system files

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

    Method 3:  Select the boot and then check if the problem persists

    Follow step 1 in the link below,
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.

  • Subvi behaves like the dialog box

    Hello LV'ers.

    I have a problem in my program of LV: 'I need my Subvi to behave like a dialog box.

    Design: if I call this Subvi (through the server VI - FPopen of the property node), my mainVI should NOT be controlled until the end of the Subvi. I think it's the same based on the dialog box, once the dialog box appears, we need to deal with first before you can make the controls of our main VI.

    my current status: I have two while loops, running in parallel: 1st loop for tracking data, 2nd loop of the menu setting. the Subvi that opens has been in the 2nd loop - it appears when I pushed the button (event structure/VIserver). now, once I called this Subvi, I can still click and control my mainVI that should not happen!

    I think it's quite possible, I don't know how. Anyone who knew this feature?

    Kind regards

    Properties of Sub - vi, the appearance of windows, click on Dialig.

    /Y

  • Change "Date and time dialog box.

    Hi all.

    Is it possible to change the time and Date dialog box that is displayed in a time and a Date control? There are several details, I want to change, for example, translate the labels in Spanish, or remove the 'Help' button.

    Thank you very much

    Francisco

    Check out this thread.  http://forums.NI.com/NI/board/message?board.ID=170&message.ID=421557

    The dialog box is a VI that is stored in the directories of the LabVIEW program.  I would not recommend changes that affect everything else that you would do in LabVIEW.  But if you make a copy, do not show the button browse on your order, but do a similar button that calls the a copy of the VI that you modified to your liking and have your code to manage the treatment of this button as the writing of the date / time selected for the control, I think you do have a behavior similar to the way the native LabVIEW control behaves.

  • Cannot access the dialog box when I right click

    I have a laptop with Vista Ultimate. Previously, I was able to right click on the desktop to access the dialog box. I can do it no longer. Can anyone provide a solution.

    To toggle to the current user

    Start > run > Regedit
    Goto registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
    Modify/create the types of data accepted by value and value name (s) as described below.
    Data type: DWORD / / value name: NoViewContextMenu
    For value data: [0 = off / 1 = on]
    Restart and exit Registry

    To turn to Local computer

    [Start] [Run] [Regedit]
    The registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer
    Modify/create the types of data accepted by value and value name (s) as described below.
    Data type: DWORD / / value name: NoViewContextMenu
    For value data: [0 = off / 1 = on]
    Restart and exit Registry

  • A screen popup menu is opened after the closure of the dialog box

    Hello

    I have a test application with a screen containing a button.

    When I click on the button (pressing the button on my BlackBerry 9220 trackpad), it opens a dialog box.

    Then when I press ESC to my BlackBerry 9220, it closes the dialog box and I'm back on my screen.

    Now, if I add to my screen, a menu item, the changes in behavior:

    When I click on the button (pressing the button on my BlackBerry 9220 trackpad), it opens a dialog box.

    Then when I press ESC to my BlackBerry 9220, it closes the dialog box and opens a menu screen.

    So, I would add my item of menu but keeping the old behavior of my application after you close the dialog box.

    Any idea?

    Thank you.

    Best regards.

    Here is the code:

    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.ButtonField;
    Import net.rim.device.api.ui.component.Dialog;
    Import net.rim.device.api.ui.container.MainScreen;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.FieldChangeListener;
    Import net.rim.device.api.ui.MenuItem;
    Import net.rim.device.api.util.StringProvider;
    SerializableAttribute public class TestApplication extends UiApplication
    {
    public TestApplication()
    {
    this.pushScreen (new TestScreen());
    }
    Public Shared Sub main (String [] args)
    {
    Application TestApplication = new TestApplication();
    application.enterEventDispatcher ();
    }
    }
    final TestScreen class extends FieldChangeListener implements screen
    {
    public TestScreen()
    {
    / * MyMenuItem MenuItem = new MenuItem (new StringProvider ("my menu item"), 0 x 230000, 0); * /
    ButtonField myButtonField = new ButtonField ("button my field");
    myButtonField.setChangeListener (this);
    This.Add (myButtonField);
    / * this.addMenuItem (myMenuItem); * /
    }
    ' Public Sub fieldChanged (field field, int context)
    {
    Dialog.Alert ("test");
    }
    }

    Here are a few screenshots:

    It comes from the popup menu. create the button with CONSUME_CLICK would be the simplest solution.

  • March 2011 the dialog box print Adobe recently becomes too big

    RECENTLY, possibly after agreeing an Adobe upgrade, I can no longer access the button 'ok' in the print dialog box. The box is too large to be completely visible.   What should I do to make things for the parameters I used a couple of weeks.  I made NO changes.  I've printed PDF files recently, cannot now.

    Thanks to a few simple, easy to follow help.

    Hello

    1. what upgrade Adobe do you have installed?

    2. not this problem only occurs when you try to print from Adobe?

    a. you can resize the dialog box by going into a corner and get the arrow to decrease the size of the dialog box.

    b. you can also change a smaller screen resolution to see if that helps.

    Check out the link:

    Change your screen resolution

    http://Windows.Microsoft.com/en-us/Windows7/change-your-screen-resolution

    c. also, you can use your scroll button and hold down the ctrl key at the same time. It changes your whole screen turned to more or less important.

    You can also visit the Adobe support links and check if it helps:

    Resolve PDF printing problems. Acrobat, Reader

    http://kb2.Adobe.com/CPS/873/cpsid_87346.html

    http://forums.Adobe.com/thread/391730

    Hope this information is useful.

  • Problem with dismissing the dialog box

    Hello world

    This is my first post here. Sorry if the question is very simple...

    I need to download an image on server. I display a dialog box to confirm if the file should be downloaded.

    Everything works well except that the dialog box is dismissed after that the whole process is over. I know I'm missing something-related threads. pls help me to understand.

    Here is my code:

    public void fieldChanged(Field f, int context) {
        if (f == addButton) {
                        FileSelectorPopupScreen fps = new   FileSelectorPopupScreen();
            fps.pickFile();
            theFile = fps.getFile();
    
            if (theFile == null) {
                Dialog.alert("Screen was dismissed.  No file was selected.");
            }
            else {
                UiApplication.getUiApplication().invokeAndWait (new  Runnable(){
                public void run(){
                    int confirmationResult = Dialog.ask(Dialog.D_YES_NO, "Do you                    want to upload?", Dialog.YES);
                    if (confirmationResult==Dialog.YES) {
                             status=1;
                    } else {
                             status=0;
                    }
                }
              });
    
            }
    
            if(status==1){
                Thread t= new Thread(){
                    public void run(){
                        //MY CALL TO WEBSERVICE                     }
                }};
    
                try{
                    t.start();
                    t.join();                                           refreshData(); //call to method to post the image data to server                        //and refresh the screen with new image
                }
                catch(Exception e){
    
                }
    
                }
            }
    
        }
    

    My problem is that the I selected YES the dialog box only after the call to webservice licensees are completed and the image is published on the server and the screen is refreshed with the new image.

    Let me know what I'm missing.

    Welcome to the forum!

    Correctly, you start the process of network on a separate Thread.  Then you attach the wire event for this Thread by using the following instructions:

    t.Start ();
    t.Join ();

    So you give up the thread of events not until your networking activity has finished.  It does not block your event feed so that your application will become unresponsive to the user and as you noted, activities requiring feed event, such as the removal of your dialog box, cannot occur.

    You must reprogram your treatment so that the activity of the network as a completely asynchronous operation.  You can't wait on this.  You should get to tell you when it has finished.  I suggest that looking at the observer model during the implementation of this process.

Maybe you are looking for

  • Cannot install extensions - access denied

    I am trying to install an extension, but a message pops up saying that Firefox prevented me from moving it. I'm going to the addon website and try to install from there, but I get another message saying Firefox "cannot change the necessary file. I th

  • WNDR3400v2 w/TWC on a map of 200 Mbit/s

    I've recently updated to a 100 Mbps plan. I got a new Modem that is set for a concert. When I have the modem connected directly to my computer, I get 260Mbps/20. When I connect the modem, my speed is reduced to 96/20. TWC checked the connection and t

  • HP Officejet Pro 8600 Plus: print jobs get stuck in the impression that

    Documents of any kind stuck in printing (QC) email, print screen, word, excel.  It does not matter.  And it happens intermittently on a daily basis.  I read older messages and understand how to remove the impression that, but I want a solution as to

  • How can pass data to a version of exe with LabVIEW?

    I have an application that allows to launch one or more instances of the same executable using "system Exec' VI, false option" wait until the end? My problem is I want to transmit a different value for each instance, to an input parameter. Something

  • storage of jpg files

    How can I store jpg files in a folder NOT in alphabetical order