answer try catch until the name of the paragraph right

Hi, I have to apply a paragraph style to grep preferences before a cycle of research.

If user input is a paragraph name not existing is not in the document, the script returns an error.

First error rules stop right but second script. And, of course, I need to go forward on behalf of right paragraph.

Here's the javascript

app.findGrepPreferences = app.changeGrepPreferences = null;

var prompt = myPara ('a seizure paragraph style', ' ');

try {}

app.activeDocument.paragraphStyles.itemByName (myPara) .name;

Alert ("this is a paragraph style!");

}

{} catch (MonErreur)

var myPara = prompt ("is NOT a paragraph style! \rType existing style "," ").

}

app.findGrepPreferences.appliedParagraphStyle = myPara;

Alert ('Correct! \nStyle applied in grep preferences! ») ;

Any idea? ... maybe a while loop could solve (tryied without success)

Thank you

No real need by try/catch. This scenario is what concerns the property of .isValid . Example with while loop:

var doc = app.activeDocument,
    promptText = "Input a paragraph style name.",
    shouldPrompt = true,
    tempStyle, style, name;

while (!style && shouldPrompt) {
    name = prompt(promptText, '');
    if (name === null) {
        shouldPrompt = false; // or skip the shouldPrompt checks and just exit(), if you prefer
        continue;
    }
    tempStyle = doc.paragraphStyles.itemByName(name);
    if (tempStyle.isValid) {
        style = tempStyle;
    }
    else {
        promptText = "\"" + name + "\" is NOT a paragraph style!\rType existing style.";
    }
}

if (style) {
    // carry on with find/change
}

Note that this will only find styles to the root. If you have, or might have, groups of style paragraph in your document, you will need to loop through doc.allParagraphStyles instead.

If I did that, I think I just present the user with a drop-down list of all the style names, the document contains and let them choose. You can use ScriptUI or just InDesign API normal dialogue. See "User Interfaces" in the script Guide.

Good luck

Jeff

Edited; Jive is weird with tags.

Tags: InDesign

Similar Questions

  • ID CC 2015 crashes as soon as I (try to) apply the paragraph style to the text.

    I work on a Mac Pro (mid-2009), OS X 10.10.4, 16 GB of RAM

    Original hard drive is 1 TB (where applications are installed), second drive (designated as working drive, and where all the work files are housed) is 2 TB.

    Currently subscribe to Adobe CC 2015, using InDesign with last update

    I have been working for several days on a long paper (paper) and have developed 12 paragraph styles, using two fonts - Garamond first Pro and Helvetica Neue LT and the document has facing pages.

    Yesterday, my client (the author) has asked all text flow on the odd pages, for illustrations on all pages, so I did all the text boxes thread directly downward of pages on the right (odd pages).

    The first three chapters were style before I changed the threading of text box. Now, when I open the document and begin to apply styles to paragraph for the rest of the text (nine more chapters, which automatically adopted the style of main text as soon as I stuck in the newly-threaded text boxes), ID crashes when I highlighted a section of text and click a paragraph style.

    I checked the permissions and preferences. The only thing I can think is from the document from scratch.

    Any other suggestions?

    Thread the text boxes only on odd pages cause the problem, since it does not have facing pages?

    Thank you.

    There could be corruption in the document.

    Save the document with IDML and reopen the IDML in InDesign.

  • Need a try/catch, but IOErrorEvent does not seem to support...

    I am loading a remote image using a charger and where the image is missing I want to replace the missing image with a placeholder image generic.  Normally, a try/catch construct would be perfect for this.  But with charger, he lifts an IOErrorEvent which then calls another function, and I'm then thrown out of the context of my original function, so I can't easily do what I have to do.

    Any ideas on how to work around this problem?  I have trouble understanding why some classes use try/catch, while others throw error events.

    Thank you!

    you will need to use an ioerror event handler.

    and the difference between your mistake and likely errors in try/catch is the difference between asynchronous and synchronous errors

  • Insert a blank space in the paragraph style?

    Is it possible to integrate a white space inserted (en character) in a paragraph style?

    I created a paragraph to chapter headings style. Chapter and number are centered horizontally on the page with a thick end line (key) on each side - a little like that, except that I use the dashboard to create the line in this example:

    -------------------------------------  Chapter 2  ------------------------------------

    Inserted white spaces before and after 'Chapter 2'.  However, when I try to apply the paragraph style to another title, the spaces are not there.

    (Line thin thickness was created as text underscore and the offset is vertically centered with the text.  It would make a difference if I created the thick end line in the form of a graph?)

    Oh and I also tried to create an object style, but it does not recognize spaces, either.  I know that something will work, but little by little learning has not met yet the solution.

    Thank you.

    Do it like this:

    1 make the high line a paragraph above net. Assign the 'Column' width (full) and set its vertical offset in right position.

    2. Add a paragraph below NET. Together, this upright even shifted, but makes a little (or a lot) more thick. Set its color [Book]. Set the width of 'Text', not 'column '. Then set the negative value of the width approx. white space you want on the left and right - something like 'mm-2' the left indent and right.

    3. you're done!

  • If I try to type a name such as my videos in the address bar in my computer and press ENTER, it will not open.

    To the right:

    My name is Andrew Wissler. I have a Dell Inspiron 6000 running a 32-bit version of Windows XP Media Center with Windows Service Pack 3.  I'm having a problem where if I try to type a name such as my videos in the address bar in my computer and press ENTER, it will not open.  Instead, Windows Internet Explorer opens and a Google search results page comes up with the search term in the search box and results are presented.  Is it possible that I can enter the term into the address bar and open the folder?

    Thank you

    Andrew

    Hi André,.

    This is the default behavior. You will need to type the full path of the folder my videos to open in Windows Explorer. To do this, try the following steps:
    a. Click Start, click my computer.
    b. in the address bar, type the following and press ENTER: Shared Documents\My videos

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Try to copy the corrupted user profile profile settings and I am met with the error message "too long file name!

    I tried to connect to my laptop today and instead of recording in the usual way a message that windows creates new office settings. When he finally connects me I get a message of bubble speech saying I was connected to a temporary profile, I reboot several times and the problem persists. After a little google research, I realize my old profile is probably corrupted... I have not downloaded a new software/hardware.

    I followed the steps of miscrosoft to copy the files from my old profile to a new user, everything in the file transfer went well until the last few files to copy. Then, I get this error message saying "the file names would be too long for the destination folder", only two options are cancel and skip available. Which are useful.

    I do not recognize these folders that are too long (the names are the random letters and numbers), I tried to look for them, nothing is done. And to be honest, I don't understand what that means.

    UPDATE: I decided to copy folder a bit at a time and it solved my problem, that all the files were copied successfully. However, now I was struck with a new problem. Whenever I try to access my files, I get a message that says windows cannot access the specified device, path or file. You may not be authorized appropriate. How can I fix it?


    It comes to my laptop and I administer it / have access to passwords, etc.

    It simply means that your old account was the owner of that file or folder.  You can change the security to access your new account.  Here are the instructions: http://windows.microsoft.com/en-PK/windows-vista/Troubleshoot-access-denied-when-opening-files-or-folders

    (It says Vista, but the steps are the same for 7).
  • How can I report an error in the cmdlet new - vm, when try/catch catch him?


    I used PowerCLI 5.0.1 and tries to add a processing error on the create a new virtual machine.  My try/catch block doesn't seem to be jumping to catch code.

    try {}

    new-vm-name badvm - vmhost "10.10.1.1" datastore - bad

    ECHO "inside to try"

    }

    catch {}

    $msg = $_. Exception.Message

    ECHO "inside wrestling"

    echo $msg

    }

    When I run the present, I get the appropriate error «...» Cannot find StorageResource with the name of 'bad '... ' appears on the screen and the text ' to try '.  I expect to fall into the Catch code.

    The host is valid and connected; so, it seems that the new - vm cmdlet Gets the host - successfully - and then the host will return the error, but don't know the code to Catch.  Could the successful connection be confusing wrestling?

    I thought call get - vm with the name and check if it was created, but I would like to tell you the cause of the failure.

    Thanks for any help,

    Maureen

    You could add -ErrorAction stop to this cmdlet.

    Or to investigate the content of $error [0] after that you call the cmdlet

  • Captivate 7 - hide / disable the button 'next' until the question is answered

    We try to make mandatory to answer a question before moving on to the next slide.

    Ideally, we want to hide / remove the following navigation button until the answer to the question.

    Any help would be appreciated

    P.S. I have check the Adobe forums and he suggested to put the next button under the clear key - that works... but not if you go to the slide - you can then go forward

    Thank you very much

    Al

    You found my suggestion to the next button, which is designed as a "Skip" button during Quiz, under the Clear button, which also has the advantage that it can be a confusion between the transmission and the next button indeed and it was certainly also mentioned that it is supposed to not allow movement back and hide the playback bar in this case.

    http://blog.lilybiri.com/question-question-slides-in-Captivate

    The buttons on question slides cannot be controlled as the other buttons. They are integrated into the question slide. If you want total control, you must create question slides personalized (lots of work).

    Another approach with the default question slides is to check the required "Answer All" option in Quiz preferences, settings. Or you can use submit all, allowing movement to the rear and a warning appears if all the questions are answered, but you alow to present even in this case.

    And you could try, if you feel uncomfortable with stocks advanced, to create a conditional action on enter for each slide, which displays a form button that will be back next movement button...

    Lilybiri

  • Try to configure the scan to the network folder, name of user and password is incorrect about JO 8600 N911n

    Hello - I have an Officejet 8600 N911n, product number CN577A. My OS is 64-bit, Win8

    My error message is either your user name or password is incorrect, please go back and correct your user name or password.

    No changes were made because this system has a few months other than downloads.

    I tried using the username provided by the scan to network folder setup with the IPL used for the HP forum and support. Also, I deleted the user name provided by the scan to network configuration folder and created a new pw. They have also objected. What user name and pw should be used?

    Hi Wardell1,

    I appreciate that you try to configure the scan to network folder.

    Where do you get this error message?

    Do you get this error message when you try to access SAP of the printer?

    You get this message on the printer?

  • 57F error code I have Vista and I am running MS Office 2002 for students. When I try to install the updates, I get this error code. Until a few months ago I had no problem with the installation of updates for MS Office 2002

    Ideas:

    • Programs that you have problems with MS OFFICE 2002
    • 57 E error messages
    • Recent changes made to your computer NO
    • What you have already tried to fix the problem error code search

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Hi halecky6,

    Welcome to the Microsoft answers site!

    (a) update you are trying to install? (It would be better, if you can provide the number of KB)

    (b) are the other updates related to Windows from installing on your computer?

    I suggest you try the following steps:

    Step 1: Disable the software security and then try to install the update

    Note: Activate security software once the test is completed.

    Step 2: Download and install the update in the clean boot state

    To perform a clean boot on a computer that is running Windows Vista, follow these steps.

    1. click on start, type msconfig in the search box and press ENTER.

    If you are prompted for an administrator password or a confirmation, type the password, or click on continue.

    2. in the general tab, click Selective startup.

    3. under Selective startup, clear the check box load startup items.

    4. click on the Services tab, select the hide all Microsoft Services check box, and then click Disable all.

    5. click on OK.

    6. When you are prompted, click on restart.

    After starting the computer, download the update manually and try to install it.

    http://www.Microsoft.com/downloads/en/default.aspx

     

    Note: Return the computer to normal - reset the computer to start as usual (follow step 7 in the link) once everything is done.

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

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

    You can also post your question on the office community, please visit the link below:

    http://www.Microsoft.com/Office/Community/en-us/FlyoutOverview.mspx

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • I am trying to install ION Slides2pc scanner. When I try to install the driver, I get a message "system administrator has established policies of prevention of this type of installation. All the answers?

    I'm trying to install the software for a slide ION Slides2pc scanner.  When I try to install the driver I get the following message "system administrator has established policies of prevention of this type of installation.  All the answers?

    Try right click on the installer and selecting 'run as administrator '.

    Support http://www.ionaudio.com/support ION

  • Error when you try to burn a CD: Windows Media Player cannot burn the files. If the burner is busy, wait until the current task is complete. If necessary, check that the burner is connected properly and that you have installed the latest device driver

    Windows Media Player cannot burn the files. If the burner is busy, wait until the current task is complete. If necessary, check that the burner is connected properly and that you have installed the latest device driver. ???

    I just burn a CD with no problem at all.  Using the same type of CD, brand new, I tried to burn another CD and got this error message:

    Windows Media Player cannot burn the files. If the burner is busy, wait until the current task is complete. If necessary, check that the burner is connected properly and that you have installed the latest device driver.

    I close all programs running, restarted my computer, changed on the devices tab, the speed of burning... everything I know to do and all the things I've read in these forums, no luck... still get the exact same message.  No idea why my CD-writer has decided to stop working for me?

    Hi Cierrajade,

    1. you have any third-party DVD burning software installed on the computer?

    Method 1

    You can use the convenience store open playing and burning CDs, DVDs and Blu - ray discs built in Windows 7 and check to see if it helps you to trouble the CD plays the questions.

    For more information about how to open the resolution of problems in Windows 7, go to the link below and follow the steps.

    http://Windows.Microsoft.com/en-us/Windows7/open-the-playing-and-burning-CDs-DVDs-and-BluRay-discs-Troubleshooter

    Method 2

    If you have any third party CD\DVD software installed on the computer of engraving I suggest you uninstall and check back later if you can burn CDs with success.

    Disc burning: frequently asked questions

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

    Method 3

    If the previous step fails, check if you can burn CDs using Windows Explorer

    Burn a CD or DVD in Windows Explorer

    http://Windows.Microsoft.com/en-us/Windows7/burn-a-CD-or-DVD-in-Windows-Explorer

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Try to catch as the exception handling in Pl/Sql

    In a procedure, I want to do 1 logical unit, is not serious if it fails, execute the logic unit 2

    This seems to be a typical scenario of try-catch. But how can I do it in pl/sql?

    create or replace
    PACKAGE BUILD_PKG
    AS
    PROCEDURE reset_seq_and_truncate_tbl(
      p_seq_name 
    IN VARCHAR2,
      p_table_name
    IN VARCHAR2 );
    END BUILD_PKG;
    /
    create or replace
    PACKAGE BODY BUILD_PKG
    AS
    BEGIN
    PROCEDURE reset_seq_and_truncate_tbl(
      p_seq_name 
    IN VARCHAR2,
      p_table_name
    IN VARCHAR2 )
    IS
      l_val NUMBER
    ;
    BEGIN
      
    BEGIN
      
    EXECUTE immediate 'truncate table ' || p_table_name;
      EXCEPTION
      
    WHEN OTHERS
      
    THEN dbms_output.put_line(SQLCODE);
      
    END;

      
    BEGIN
      
    EXECUTE immediate 'alter sequence ' || p_seq_name || ' increment by 1 minvalue 0';
      EXCEPTION
      
    WHEN OTHERS
      
    THEN dbms_output.put_line(SQLCODE);
      
    END;
    END reset_seq_and_truncate_tbl;

    END BUILD_PKG;

    Try below

    PROCEDURE reset_seq_and_truncate_tbl(
      p_seq_name  IN VARCHAR2,
      p_table_name IN VARCHAR2 )
    IS
      l_val NUMBER;
    BEGIN
       BEGIN
       EXECUTE immediate 'truncate table ' || p_table_name;
      EXCEPTION
       WHEN OTHERS
       THEN dbms_output.put_line(SQLCODE);
       END;

    BEGIN
       EXECUTE immediate 'alter sequence ' || p_seq_name || ' increment by 1 minvalue 0';
      EXCEPTION
       WHEN OTHERS
       THEN dbms_output.put_line(SQLCODE);
       END;
    END reset_seq_and_truncate_tbl;

  • Hey I have a problem with the library, when I try to enable the creative cloud desktop application it keeps saying "cannot restore the file: C/users/USER name as the location of the file is not available."

    Library Eroor.jpg

    This is a double post of a following:

    Hey I have a problem with the library, when I try to enable the creative cloud desktop application it keeps saying "cannot restore the file: C/users/USER name as the location of the file is not available."

  • I try to open the version cc 2015 Photoshop in my office, but it can not open properly, before update until 2015, 2014 version is fine.

    I try to open the version cc 2015 Photoshop in my office, but it can not open properly, before update until 2015, 2014 version is fine.

    Hi to wing,

    Please provide more information such as: -.

    > What operating system is your computer works (Windows 10, MAC 10.10.4 etc.)

    > Your computer specifications (quantity of RAM & graphic card)

    > What error message do you get when you open Photoshop

    > Post a Screenshot

    Click on the camera icon in the menu editor to download the image stored on the current position of the cursor

    Concerning

    Assani

Maybe you are looking for