Leave the dialog box change the text display/display

I have a dialog box that is created with some text objects attached to its buttons. The user can make choices for each one, press OK, and asked of their choice. What I would like is for the buttons to the user in the text, so that they can see it in the context as they decide (that's the only reason why they are buttons; otherwise, they would be static text). I know how to handle this with a palette, but I wonder if there is a way to do it with a dialog box. With the help of a palette for all this seems unfair; I really don't want users to be able to make changes to the document, while the palette is open, and I don't want to change anything in the document until the user clicks OK. It is a dialogue with a palette as oddity, really.

The problem is that. showText() and setting the activePage throw them the error "Cannot process the request because a modal dialog box or the alert is active." I tried to adjust the dialog box to .the = false or .visible = false, but it has no effect. Is it just impossible? This feature, change the view but not the content, seems to live in a grey zone between the way in which the work of dialog boxes and palettes of way work, so I don't know if I'm just a useless way. Any idea would be appreciated.

Here's a code example to illustrate what I'm doing:

#target indesign


main();


function main(){
    if (app.documents.length == 0){createTestDoc();}
    runDialog();
}


function createTestDoc(){
    //create a test document
    var myDocPre = app.documentPresets.add({name: "testPre", createPrimaryTextFrame: true, pagesPerDocument: 5});
    var myDoc = app.documents.add(true, myDocPre);
    var myPSty = myDoc.paragraphStyles.add({name: "newPageSty", startParagraph: StartParagraph.NEXT_PAGE});
    var myCSty = myDoc.characterStyles.add({name: "CSty", underline: true});


    myDoc.textFrames[0].contents = "1\r2\r3\r4\r5";
    myDoc.textFrames[0].texts.everyItem().appliedParagraphStyle = myPSty;


    app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
    app.findTextPreferences.findWhat = "^9";
    app.changeTextPreferences.appliedCharacterStyle = myCSty;
    myDoc.changeText();


    myDocPre.remove();
}


function runDialog(){
    //find text with a particular character style and send that text to my dialog creation function.
    var myDoc = app.activeDocument;
    var myCSty = myDoc.characterStyles.itemByName("CSty");
    if (myCSty.isValid){
        app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
        app.findTextPreferences.appliedCharacterStyle = myCSty;
        var myResults = myDoc.findText();
        myDialog(myResults);
    }
}


function myDialog(textRngs){
    //create the dialog.
    var myWin = new Window("dialog", "Test Dialog", undefined);
    var mainGroup = myWin.add("group");
    mainGroup.orientation = "column";
    //each text range gets a row.
    for (var i = 0; i < textRngs.length; i++){
        var myTextRng = textRngs[i];
        var myRow = mainGroup.add("group");
        myRow.orientation = "row";
        var myBut = myRow.add("button", undefined, myTextRng.contents);
        //attaches the text object to the button.
        myBut.targetObject = myTextRng;
        //does nothing - just a reminder that the actual dialog will do something at the end based on the info entered.
        myRow.add("editText");
        
        myBut.onClick = function(){
            //this is what I do when I want this functionality within a palette. Selects the text so that it can be seen in context.
            if (!(this.targetObject.hasOwnProperty("select") && this.targetObject.hasOwnProperty("showText"))) {}
            else{
                this.targetObject.showText();
                this.targetObject.select();
                
                //OR
                //tried this as an alternative, but setting myWin.visible does nothing.
                //myWin.visible = false;
                //myDoc.layoutWindows[0].activePage = this.targetObject.parentTextFrames[0].parentPage;
                //myWin.visible = true;
            }
        }        
    }
    var OKGrp = myWin.add("group");
    var OKBut = OKGrp.add("button", undefined, "OK");
    
    OKBut.onClick = function(){
        //do something
        myWin.close();
    }
    myWin.show();
}

You have no choice: If you want the script to interact with the text that you will need to use a palette.

P.

Tags: InDesign

Similar Questions

  • Why "limit maximum instances of this event in the queue" in the dialog box change events?

    Why I "would limit the maximum instances of this event in the queue" in the dialog box change events?

    I think that this is new for LV 2014, but I couldn't find an explanation for an instance of good use. A research on OR displays only the 2014 help text, which explains what it does, but not why?

    Does anyone know good arguments to use this option?

    Thanks in advance.

    Justin Tyme

    It is useful for user interface elements that can enqueue actions as quickly as they can be made.

    For example, say it takes takes 1 second to take a picture and save it. The user presses the button "Take a photo", but they do not see a new image file again after a wait of 250 ms (human beings humans can be impatient) so they press twice. Finally, they see a new file image... and then another... and then another... To get rid of this possibility, check this box.

    Or that you have a cursor to adjust some settings. Moving the cursor updates very fast! If the user swipes from 0 to 1 then the program might try to send all the rest as a parameter to your instrument, which takes some time. Instead of sending all of these values, it is probably better if the software can keep up with the cursor and send a value of about 1 at the same time, the cursor said 1. If you do not check this box, the user can be 1, but the unit will continue to receive values from 0.53, 0.54, 0.55...

  • Break the thread, but leave the text in place

    Trying to separate some text boxes, but leave the text where it is. Whenever I double-click to remove the link, the text in my 2nd box disappears and goes back down [Red +] of the first box.

    Any help?

    Thank you!!

    There is a sample script called SplitStory.jsx that will divide all the frames of a story in separate stories and one called BreakFrame.jsx that will pull a single image on a thread.

  • Can I remove paragraph styles while leaving the text as it is?

    I have the text that was somehow connected to a paragraph style that is not the right model. I need to change this style of paragraph... but I don't want this other text to change (which is what's happening). I tried to rename the style of the text I want to preserve as is, but even that changes the text. How can I leave the text as it is, but have no style paragraph related? I use InDesign CC on an iMac.

    Thank you!

    Julie

    Select the text and choose break link to style in the paragraph Panel menu styles

  • Why is OK disabled in Debugger dialog box change value?

    Hello

    For some reason any OK disabled in the dialog box, change the value of the debugger. None of what I've seen so far explains why this happens. The variable stores an oracle.jbo.domain.Date, and the source ADF library was imported into the project.

    Ideas?

    James

    Is the AutoCorrect on my cell phone. I meant type, not a torus.

    Yes, you should be able to change a string or int type in your code.

    Timo

  • Programmatic equivalent to the Find dialog box change functions

    Hello

    Is there a reasonable programmatic equivalent of the buttons change to the Find dialog box? FDK or ARE? I have no urgency to find one, but I was going to use it if they are available. I'm looking for something simple and direct, not savages button-push-automation-routines or something like that.

    I hope this isn't a stupid question. I'm amused that after all these years, this is the first time I ever thought that the need for it.

    Russ

    Hi Russ,

    using 'find', you will receive a textlocation. Now, he must 'manually' change the text with oDoc.Delete (TextRange) and then insert your text replace.

    I hope I understood your question right?

  • Change the text displayed, based on the threshold value

    Hi users of Labview,.

    I need help with display and editing text in labview.

    The text should display and change according to the following conditions:

    0 volt - "no power".

    1 volt - "controller ON".

    2 Volt - "Rotor Running"

    3 volt - "Rotor stopped".

    Based on the voltage read by the channel, the text must be displayed and modified on the same area of the front panel. For example, initially it will be 0 Volt and the text "No power" should appear as an indicator of text (and not as a warning message). He needs to change ' controller we ' when the chages of voltage from 0 to 1 volt. The canal reads the analog input voltage (range 0 - 5V).

    I'm relatively new to labview. So please give me pointers or from suggestions on how can be done. Any help is greatly appreciated.

    Thank you

    REDA

    Hello

    Thanks for the crossrulz of notes, have not used the front threshold.  For this simple example, it is "symmetrical", but I can see how the values in the table have been does not correspond to the index position that is so true useful.  Learn something every day, I could not resist, wanted to try.

    OK, here's a sample VI that puts a custom message based on the crossing of a threshold.  Home work is to study the components before asking to :-)

    The dice are the analog signal of 0 to 6.   He rounded to the whole number to provide the index number.  Power is the index number in the index table, the table being hard-coded text messages.

    Two additional indicators may be deleted, useful to see what is happening.

    And get rid of the value 0 if you want the text to match the number, he he he

    Enjoy.

  • Save dialog box under does not display the list of files

    Terminal Server R2 of 2012.  Dialog box "Save as" for a user does not display the list of files.  The address bar shows the way, there is a form for the file name box, and the user can save the file successfully.  But the space that would show the files in the selected directory is empty.  There is no form for the list of files box, it's just the grey box dialog box space - that is to say, it is not that it looks like an empty folder, there is simply no display form box.

    The 'Open' dialog box appears normal, showing the list of files in the selected folder.

    I had the user close the session on the Terminal Server and access it from another PC, even if I was not expecting to make a difference, and it didn't.  I have also connected on myself and has not experienced the same problem.  So it seems to be user-specific.

    What a setting, the user has selected by mistake, or a mistake any?

    Thanks for any help.

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • How can I reverse the function of the curves in the dialog box change the curves

    in the oldest version of PS, there was a small set of arrows to reverse the function of the curves in the change the curves dialog box. I miss it greatly, because I use them in front of the standard direction for more than 20 years.

    A way to change this DC?'

    old_ps_curves_dialog.jpg

    Wow. guess I should have tried to click that. the description made zero sense to me. couldn't guess that's what he did.

    Thank you.

  • How to read the text displayed in the field "search in" a JFileChooser?

    Hello

    I'm working on a windows environment and I have a drive mapped to my computer network.

    The mapped network drive letter: X:\

    When I open the JFileChooser and pointing to that drive and choose, under the JFileChooser ' search in ' this is what is written: Version6.1 on server(X:) mais quand j'ai le choisir et imprimer le nom de chemin il retourne uniquement la réseau mappé lettre de lecteur (c'est-à-dire X:\) (which is of course understandable).)

    The user wants to see the name of the folder he chose not only the letter drive.

    How can I possibly have the exact test shown in the JFileChooser before returning?

    Thank you.

    >
    When I open the JFileChooser and pointing to that drive and choose, under the JFileChooser ' search in ' this is what is written: Version6.1 on server(X:) mais quand j'ai le choisir et imprimer le nom de chemin il retourne uniquement la réseau mappé lettre de lecteur (c'est-à-dire X:\) (which is of course understandable).)

    The user wants to see the name of the folder he chose not only the letter drive.

    How can I possibly have the exact test shown in the JFileChooser before returning?
    >
    Your question is confusing. If the user chooses a folder then they will see the name of the file and the full path.

    You could reference on behalf of display system for the drive itself. If that's what you want, you need to add the code to get this name and display it to the user. The dialog box will not appear the display name.

    For example if I have a map drive z on the drive c from another computer I can get this drive name from how it is displayed:

    restoreFolderChooser.getFileSystemView().getSystemDisplayName(new File("z:\\"))
    
    "c$ on 'blade1' (Z:)"
    

    Is this what you are looking for?

    See the class FileSystemView in the Javadocs
    http://docs.Oracle.com/javase/1.4.2/docs/API/javax/swing/filechooser/FileSystemView.html
    >
    getSystemDisplayName
    public String getSystemDisplayName (File f) of a file, directory or folder name, such that it will appear in a file system browser. Example of Windows: the directory 'M:\. "shows as"CD-ROM (M :) ". "The default implementation gets information from the ShellFolder class.

    Parameters:
    f a file object
    Returns:
    the file name as it would be displayed by a native file picker
    See also:
    JFileChooser.getName (java.io.File)

  • All the text displays too large, Ctrl + 0 does not

    Enabled Firefox this afternoon to find all the text made too big by about 30%. Icons in the bookmarks bar and the tabs are too big, as well. If I press on Ctrl + - twice, then it seems normal, but Ctrl + 0 returned any abnormally high. Gmail in particular seems wrong no matter what I put the zoom, as if the user interface is too large, but the text is too small.

    I don't know what is happening. Several reboots of Firefox has not helped. Disabling each addon and plugin did not help.

    Can you use Ctrl ++ (zoom full page) to increase the size on Gmail? I'm sure that at least a few sites you will need to do this, depending on the size of pixel of your screen.

  • Empty dialog boxes and missing text in tools

    Acrobat 10.1.8 - Adobe Creative Suite Standard

    Has several dialog boxes have become empty and fill the entire screen, for example the box that appears when a scan is complete.  In addition, when the tools are displayed (and the buttons on the toolbar for the tools are not there anymore) the icons but not the text.

    I guess it's either a police problem - maybe some fonts used by Acrobat have been deleted - or I have to download the prgoramme and reinstal it.  But I can't find a download site for Acrobat 10.  There is no problem with the other Creative Suite programs.

    What should do?

    Make sure that you have the complete Segoe UI font family. These aren't the Adobe fonts, but essential Windows fonts.

  • No dialog box change Site with new installation on Lion 10.7.3

    Today, I installed Dreamweaver CS5.5 on OS X Lion 7.3. I'm unable to edit any site. Does not display the Edit dialog box. It gives no error when I create a new Site, but even when there is no edit dialog box.

    Thanks in advance.

    Open disk utility and run the repair permissions function.  If this does not work, you may need to back up site definitions from the screen of the Site Manager where the Edit button does nothing.  Disable this feature (help-> dŽsactiver) Dreamweaver.  Run the vacuum cleaner ( http://www.adobe.com/support/contact/cscleanertool.html ) and re-install.  If it still does not at this time here, it could be a more serious problem with the installer and 10.7.3.  My version was installed before and if Apple changed something where Setup fails, you will need to contact Adobe at this time here.  They provide installation help: http://www.adobe.com/aboutadobe/contact.html .

  • How to remove toolbar icons and just leave the text?

    In previous versions of "Firefox", you could-'text only' or 'text and icons' in the toolbar.

    In the most recent version 32.0.2, options is no longer available, you get icons and text. Just, it clutters the toolbar and restricted the number of URL for quick access.

    I want to just 'Text' only.

    Thank you

    John O

    Add code to the file userChrome.css below default @namespace.

    @namespace url("https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #PlacesToolbarItems > .bookmark-item > .toolbarbutton-icon { display:none !important; }
    

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the folder of chrome in the Firefox profile folder.

    You can use this button to go to the Firefox profile folder currently in use:

    • Help > troubleshooting information > profile directory: see file (Linux: open the directory;) Mac: View in the Finder)
    • Create the folder chrome (lowercase) in the .default < xxxxxxxx > profile folder if the folder does not exist
    • Use a text editor like TextEdit to create a userChrome.css (new) file in the folder chrome (file name is case sensitive)
    • Paste the code in the userChrome.css file in the Editor window
    • Make sure that the userChrome.css file starts with the default @namespace line

    Be sure to save the file in plain text format and not as rich text.

  • How can I upoad pictures if my AutoPlay dialog box will not be displayed?

    I want to download my pictures from my camera to my computer but my AutoPlay dialog will not appear anywhere, how do I get my pictures on my computer?

    Hello

    ·         What operating system do you use?

    I suggest you follow the articles below and check if it helps:

    Change AutoPlay settings

    http://Windows.Microsoft.com/en-us/Windows7/Change-AutoPlay-settings

    AutoPlay: Frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/AutoPlay-frequently-asked-questions

    How can I get pictures from my camera to my computer?

    http://Windows.Microsoft.com/en-us/Windows7/how-do-I-get-pictures-from-my-camera-to-my-computer

    Hope this helps,

Maybe you are looking for