Cancel the problem in a dialog window

Hey supergeniuses! I'm kinda new to scripting in InDesign, although I made a few script Illustrator a few years. I'm familiar enough with javascript to make a difference, but I'm not 100% fluent.

I'm trying to get back into it and I wrote this script which takes a selected collection and scales everything down to the same width or height (including the width/height line widths) based on the object in the collection with the size of the more small or large, or some entries manually the dimensions. There is an option also to constrain proportions during the measurement.

The script itself works pretty well actually! My problem is that when I hit Cancel in the dialog, rather than to leave the script, he runs into the validation and gives me an alert 'Options'. Here is the code for the dialog window and lines of validation (yes I know I'm a little unnecessarily redundant and messy, but it helps me keep things straight):

var dlg=new Window('dialog', 'Scale Multiple Objects');
        dlg.alignChildren="fill";
        dlg.options2=dlg.add('panel', undefined, 'Dimension', {borderStyle:'sunken'});
        dlg.options=dlg.add('panel', undefined, 'Object', {borderStyle:'sunken'});
        dlg.options.add('statictext', undefined, 'Choose which object will determine the chosen dimension.');
        dlg.options.optionbtns=dlg.options.add('group');
        dlg.options.optionbtns.orientation="column";
        dlg.options.optionbtns.optionSmaller=dlg.options.optionbtns.add('radiobutton', undefined, 'Object with smallest dimension.');
        dlg.options.optionbtns.optionBigger=dlg.options.optionbtns.add('radiobutton', undefined, 'Object with largest dimension.');
        dlg.options2.add('statictext', undefined, 'Choose which dimension will be scaled.');
        dlg.options2.optionbtns2=dlg.options2.add('group');
        dlg.options2.optionbtns2.orientation="row";
        dlg.options2.optionbtns2.optionWidth=dlg.options2.optionbtns2.add('radiobutton', undefined, 'Width');
        dlg.options2.optionbtns2.optionHeight=dlg.options2.optionbtns2.add('radiobutton', undefined, 'Height');
        dlg.add('panel', undefined, undefined);
        dlg.or=dlg.add('panel', undefined, undefined, {borderStyle:'raised'});
        dlg.or.alignChildren="center";
        dlg.or.add('statictext', undefined, 'OR');
        dlg.add('panel', undefined, undefined);
        dlg.manual=dlg.add('panel', undefined, 'Scale to Manual Dimensions', {borderStyle:'sunken'});
        dlg.manual.add('statictext', undefined, 'Alternatively, enter manual dimensions to scale the items to.');
        dlg.manual.add('statictext', undefined, 'You may enter either one or both dimensions.');
        dlg.manual.textboxes1=dlg.manual.add('group');
        dlg.manual.textboxes1.orientation="row";
        dlg.manual.textboxes1.add('statictext', undefined, 'Width:');
        dlg.manual.textboxes1.manualWidth=dlg.manual.textboxes1.add('edittext', undefined, undefined);
        dlg.manual.textboxes1.manualWidth.characters=10;
        dlg.manual.textboxes1.add('statictext', undefined, app.activeDocument.viewPreferences.horizontalMeasurementUnits.toString().toLowerCase());
        dlg.manual.textboxes2=dlg.manual.add('group');
        dlg.manual.textboxes2.orientation="row";
        dlg.manual.textboxes2.add('statictext', undefined, 'Height:');
        dlg.manual.textboxes2.manualHeight=dlg.manual.textboxes2.add('edittext', undefined, undefined);
        dlg.manual.textboxes2.manualHeight.characters=10;
        dlg.manual.textboxes2.add('statictext', undefined, app.activeDocument.viewPreferences.verticalMeasurementUnits.toString().toLowerCase());
        dlg.aspectRatio=dlg.add('checkbox', undefined, 'Scale items proportionally?');
        dlg.btns=dlg.add("group");
        dlg.btns.orientation="row";
        dlg.btns.cancel=dlg.btns.add("button", undefined, "Cancel", {name:"cancel"});
        dlg.btns.add("button", undefined, "OK", {name:"ok"});
        dlg.show();

        if((dlg.manual.textboxes1.manualWidth.text==""&&dlg.manual.textboxes2.manualHeight.text=="")&&((dlg.options2.optionbtns2.optionWidth.value==false&&dlg.options2.optionbtns2.optionHeight.value==false)||(dlg.options.optionbtns.optionSmaller.value==false&&dlg.options.optionbtns.optionBigger.value==false))){
            alert("Choose options.");
            exit();
            }
        if((dlg.manual.textboxes1.manualWidth.text!=""||dlg.manual.textboxes2.manualHeight.text!="")&&((dlg.options2.optionbtns2.optionWidth.value!=false||dlg.options2.optionbtns2.optionHeight.value!=false)||(dlg.options.optionbtns.optionSmaller.value!=false||dlg.options.optionbtns.optionBigger.value!=false))){
            alert("Choose only one mode.");
            }

So why is it alert me with 'Choose options.' when I hit Cancel it? It's probably something basic and stupid, but I can't seem to understand. I'm the first to admit that I have not much idea how OK/Cancel works... so any help would be amazing.

When the script reaches the show() line, it shows the dialog box and waiting for

He was fired (or if you have configured event listeners, of course

He deals with them). Once the window is rejected (regardless of the value of the)

Show() returns [and show() returns a value that indicates HOW the]

dialog box was rejected]) the script simply continues to the next line and

that is running. Who is be a line which gives a warning (see the)

options box) in your case.

In order to avoid that:

Do a check to see what value show() returns. I can't remember offhand

the value for Cancel. Maybe 2. So if dlg.show () == 2 just do an exit().

Or conversely, if dlg.show ()! = 2 do the rest of the stuff.

But you'll need to experiment a little see what is the value of the difference

for show(). Just do alert (dlg.show ()) and try out with different

buttons.

HTH,

Ariel

Tags: InDesign

Similar Questions

  • Unfortunately I couldn't find another option in Firefox to describe the problem. I use Windows 7. Since the Firefox update (now I use 16.0.2) when I

    Unfortunately I couldn't find another option in Firefox to describe the problem.
    I use Windows 7.
    Since the Firefox update (now I use 16.0.2) when I use the Google Translator in Firefox, I can't copy and paste into Microsoft Word.
    But when I use it in Internet Explorer, I can't use the copy paste it to Microsoft word (MS Word 2010).
    my e-mail address: [email protected]

    Hello
    Thank you very much for quick help
    It's work with the instruction of Ctrl + C.
    perditer

  • AF:dialog cancel the problem on the new line of VO

    With the help of 11.1.1.4.

    I have an af:popup that contains an af:dialog which itself contains entrable components mapped to attributes of VO, the first being an af:selectOneChoice (list of the part of the body). The list of the part of the body draws from a LOV configuration on the underlying VO attribute. LOV rowset is initialized in the model of the line layer whenever the popup is called to make sure that it contains all the allowed values.

    Everything works fine except when:

    (a) user adds a new row to the underlying VO and invokes the popup to initialize the values of the new line, and
    (b) the user selects a value in a list of the part of the body, and
    (c) user chooses to cancel the dialog box

    The PopupCanceledEvent triggers a Delete on the underlying VO in the case above operation, to remove the new line has been added.

    It all works very well, but if the dialog box is now called either for another new line or an existing line, the list of the part of the body indicates the value that has been selected to b) above and not on the value as it is in line with model (this has been verified). If I add and remove line using the Delete operation out of an icon above the table of VO (outside), then no problem. The problem is not correct itself unless / until the user goes in the new dialog box and completes the process of adding line by pressing the button of the OK dialog box. User can then delete this new line using the icon and then edit and add all operations work fine again.

    All about the model seems very well, the problem seems to be that the user interface components in the dialog box are not properly initialize values which I know to be in the model WHEN AND ONLY WHEN the dialog box was canceled on the addition of a new line (cancellation of a change does not cause the problem). I tried various RPP requests to try to synchronize the items with related values, but not luck.

    Does anyone have any suggestions as to what might be going on here?

    Thank you

    Check this box:
    http://www.adftips.com/2010/10/ADF-UI-resetting-or-clearing-form.html

    Thank you
    Nini

  • Satellite A200-22I - DHCP and SENSE of the problems when you start Windows Vista

    When I started my laptop yesterday, I noticed it was going quite slowly, more there was a message saying that windows could not connect to a specified service.

    As a result my firewall was off tour and I can t connect to the internet. I tried to turn on the firewall, but I couldn't... and today, I tried another connection to inalambric, but I couldn't connect to the internet.

    I checked the registry of the solution and the problem and found it was something related to DHCP and sense.

    But really, I don - t know what causes this problem...

    I searched other forums where people have had the same problem but I could t find any solution apart from reinstalling Vista...

    Can someone help me? Help will be very appreciated!

    Thank you

    Hello

    What do you mean with SENSE? I never heard tell about.

    I put t know what are the causes of the problem too but did you look in Event Viewer? Sometimes, it's really useful.
    If you have a network problem, you must update the driver WLAN or LAN (depending on whether you are using). You can find it on the Toshiba site:
    http://EU.computers.Toshiba-Europe.com-online decision-making supported Downloads & => Download drivers

    It would be interesting to know what Windows service, you mean. View more information on this error.

    Welcome them

  • Cancel the problems caused by Windows 7 updates

    It's new, the standard operating system of Microsoft for Windows 7 to 45 minutes to work out its kinks and be functional?  From the Auto Update April 30, that's my experience.  My new laptop Toshiba with preinstalled Windows 7 worked beautifully.  Besides the fact that it seems that the user is not supposed to have any control over his own computer, I liked Windows 7 OK, except for the change to the Control Panel, which now seems to have a bunch of useless information and no real way to actually 'control' anything.  However, now that updates 30 April and 12 may have slowed down my system a complete analysis (for the first 45 minutes, anyway), I find myself longing for a new Macintosh.

    Contact Norton Support or...

    1. download the Norton Removal Tool, save it to your desktop: ftp://ftp.symantec.com/public/english_us_canada/removal_tools/Norton_Removal_Tool.exe

    2. close all open applications (that is, anything with an icon on the taskbar).

    3. After completing some you have a copy of your handy product key, uninstall all Norton software (including LiveUpdate and everything Norton Add ons) via Control Panel | Programs | Uninstall a program (or Control Panel |) Programs and features, if you are using the classic view).

    4 IMPORTANT! -Online activate Windows Firewall immediately after the restart.

    NB: Now you're "working without a net": no to ANYTHING else online (e.g., navigation, reading e-mail, chat) until you have completed step #7 below!

    5. right click on the file that you saved in step #1 above, and then select run as administrator.  DO TAP not your keyboard until the race ends, then restart.

    6. do a clean install of NIS 2010 using your product ID & reboot: [1] http://www.symantec.com/norton/support/kb/web_view.jsp?wv_type=public_web&docurl=20080514162318EN

    NB: Do not activate or install additional modules of Norton (for example, Norton Anti-Phishing) immediately.

    7. manually and repeatedly run LiveUpdate (Norton) until you get a prompt "no update more".

    8. reset IE8 now by http://windows.microsoft.com/en-US/windows7/Reset-Internet-Explorer-settings

    8 b. then, reset Windows Update by...

    How to reset the Windows Update components?
    [Ignore the section to APPLY to, if a Win7 user;] KB971058 access via IE8 32 bit only. Run the difficulty in the default and aggressive modes]
       http://support.Microsoft.com/kb/971058

    9. restart & test.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [1] or empty the Norton bloatware and install Microsoft Security Essentials (free) instead

  • How can I solve the problem of a pop window that appears whenever firefix titled load [Javascript Application] and said: "balance.balance is undefined".

    The little ' [Javascript Application] and balance.balance is not defined ' pop-up window is followed by a pop up that shows a sign of prudence and the number 3. They repeatedly pop up when I click on the button OK or X, I have to click 10 times until they disappear. Then, Firefox seems to work normally until I exit and try to come back later to Firefox.
    I uninstalled Firefox and reinstalled without effect. I also ran a convenience store that seemed to refer to distance to this problem with no effect.
    This does not happen when I load Internet Explorer or Google Chrome. Except for this issue, I prefer Firefox over one or the other.

    Hello, you can try to reproduce this behavior when you start firefox in safe mode, once? If not, probably an addon intrudes here...

    Troubleshoot extensions, themes, and issues of hardware acceleration to resolve common problems of Firefox

  • Set the CS6 PS 'Open' dialog window size and location

    I just upgraded to OS X Mavericks for OS X El Capitan.  Until the upgrade, I've always been able to set the size of the 'Open' dialog PS CS6 and location, but it would seem that the option is no longer available.  What I get now is a window rather small (default).  I can resize and locate it, but it will not stick.  Next time I open the dialog box window is again at the default size and location.  I'm sure that there is probably an easy answer to this, but it is that I have not found so far.

    Thank you

    Gary

    The size and location of the operating system open and save dialogs are controlled by the operating system.

    And MacOS 10.11 has some bugs regarding the size and location of these dialog boxes that Apple is still trying to solve.

  • MS fix Ctr error 'invalid command line argument' & ' code: 0 x 80070002 "&" context: Elevated ' for ' diagnose & difficulty of the problems of security of Windows '&' diagnose & repair problems Windows folder & "programs.

    I downloaded MS difficulty It Center yesterday and ran 'Improve performance and security in Internet Explorer' and it worked very well. I am running Windows XP Home Edition w / Svc Pack 3, if this information is not displayed.

    Hi rcserve,

    1. did you of recent changes on the computer?

    2. do you have security software installed on the computer?

    I suggest that you manually download Fixit instrument and save the Fixit file on the computer and later do a right click on it and click run as administrator and check if it installs on the computer.

    Open the Web tool Fixit page and click Advanced-download to run on a computer disconnected, or different when you get the prompt to save on the portable device, select desktop as the location to save it.

  • Is it possible to cancel the last version upgrade of Windows - Photoshop -

    I installed the upgrade to Photoshop. Not only is so different that it took me a lot of time to do even to resemble the previous version that I used and loved the Raw Converter of my camera (Pentax KS-1) is not usable. He brings just corrupted data. I messed with graphics acceleration but I'm limited kind of there with an Intel/Graphic chip. I don't have a dedicated card. I tried to revert to a previous version through CC but not all were available.  I also completely uninstalled Photoshop and downloaded again, in the hope that it would be upgrading pre version. It wasn't. Is it possible to cancel this upgrade? If I knew it was still in beta, I would not have applied. Thank you!

    Thanks for the update.

    Go to the menu edit in Photoshop > preferences > Camera Raw > uncheck the option 'use the graphics processor' down > restart Photoshop > trying to open any image in Camera Raw again and that should help.

  • Cancel the problem

    I'm following the doScript examples I found on the web and can't seem to get my cancellation of work.

    I use the following code:

    app.doScript (mainScript (4,2), ScriptLanguage.javascript, undefined, UndoModes.fastEntireScript, "StoryBoard");

    This is called when you click on a button in a scriptUI Panel.

    When I go to my menu cancel, there is no evidence of the script, but if I cancel and then it goes back through the steps my script.

    How can I just have one point of cancellation?

    Any help would be appreciated.

    Phil

    Hi Phil,

    As Jeff said, you can't pass arguments like this.

    You can either just use the Jeff said, or any method

    Add quotes around ' mainScript (4.2) "and it should work.

    app.doScript("mainScript(4,2)", ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT,"StoryBoard");
    

    Hope that helps.

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

  • How to uninstall Bluhell... .it is at the origin of the problems 4 me with Windows XP.

    I can't find a way to uninstall Bluhell. It is not listed in my ccleaner or remove Windowsw XP programs. I have same triedn for Firefox to uninstall and reinstall but this shit is always on my netbook causing problems. Thanks for any advice/guidance clear about how to uninstall this program. Please respond to my e-mail address: [email protected]

    Thank you

    Bobber

    Bluhell Firewall installs in Firefox as an extension.

    See - How to remove extensions

  • y at - it a fix for the problems of compatibility for windows Vista when you try to install windows 95/98 games?

    just replaced an old unit under xp home which took place games supporting windows 95/98, new unit has windows Vista and will not load these games.thanks for any help.

    Hello

    Have you tried compatibility mode?

    http://Windows.Microsoft.com/en-us/Windows-Vista/make-older-programs-run-in-this-version-of-Windows

  • When I try to assess my computer via the control panel by pressing 'rates receive this computer' i a that 'message windows could not calculate windows experience index because the user cancelled the assessment' how can I solve this problem.

    Ideas:

    • information on the performance and the tool programs having problems
    • the user cancelled the assessment
    • installation of Windows vista service pack 2
    • Tracking FAQ

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

    Hello Marie Claude fernando.

    Thanks for posting on the Microsoft answers Forums.

    In a command prompt elevated.  WinSAT formal type

    I hope that this answer to your questions, if you need further assistance please come back and post, we are more than happy to help you.

    Kind regards

    Edgar
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How do you get the beta version of windows 7 to solve the problem created when the auto update 0x0000c1f5 ran?

    How do you get the beta version of windows 7 to solve the problem of stop 0x0000c1f5 windows vista home edition created when the automatic update ran?

    Previous discussions about the error: ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Problems with latest updates Windows (KB) do not install & repeated notifications via the taskbar icon

    Hello everyone,

    In my view, there are many people who seem to have a similar problem to mine, although I was unable to find an answer to one of my questions in this post.

    Description of the problem:

    Although my Windows Update is defined on download & install updates during the night hours every day, the latest updates, KB26333880, KB2572073and KB2518864 are not be installed.  I went to the Windows Update site to check my editing history.  He showed the green/white checkmarks next to all 3 updates.  The record also showed that updates have been tempted 3 times during the night.  After clicking on the button "Express" on the Home Page, the results show 3 above updates, but show "0 bytes', then '0 download time. '

    To me, this indicates that there is no update to download, despite the yellow Shield of Notification of update continues to appear in the taskbar.

    Corrective measures attempted:

    1. I tried to download / install twice unsuccessfully using IE8 and FF (including restarting the computer).

    2. download & run the program MS Fixitattempted, but received a message which read, "an unexpected error has occurred, please try again later." No. error code has seen with this message.  (I could RECORD the program on my desktop... just couldn't run the establishment).

    3 tried to search for the presence of these updates using start > run > %windir%KB###.log (where the # is the individual number of update KB).  Every time - a message appears indicating that the file is not found.

    4 looked at the Add/Remove Programs list (with the Show updates checkbox checked).  No updates KB mentioned above could be found.

    5 with SAS, MBAMand Outpost Security Suite Pro scans revealed no malware/security issues.  (SAS and MBAM are used only as scanners on request).

    This problem with the updates does not download & repeated notifications being indicated in the taskbar has occurred many times before.  On this occasion, I called Microsoft several times before finally, my computer remotely accessible support person and spent about 50 minutes to fix the problem.

    (Also, it is noted that almost every support person I spoke with has always tried to tell me that MS is not help with the problem of this type.)  I had to be rather several in my reply... tell the person that MS IS in fact provide assistance free security-related Windows updates.  They now provide free assistance is unknown). Besides... I have more a phone number for States anyway.

    My questions to the community:

    1. is it possible to download & install these 3 updates?

    2 is there an explanation as to why MS Fixit program will not be installed, and if so, are there certain corrective measures I can take which will allow me to download & run this program?

    System Specs:

    Desktop Dell Dimension 3000 Tower;  WIN XP Pro SP3.  2 GB OF RAM;  3.00 gHz CPU;  Outpost Security Suite Pro.  MBAM Pro (on request only).  SAS (on request only);  SpywareBlaster;  IE8 & FF

    Thank you for your time and help, review!

    Pete C.

    See the RESPONSE message in this thread-online http://answers.microsoft.com/en-us/windows/forum/windows_xp-windows_update/security-updates-kb2633880-kb2633870-are-not-being/49ed2fe1-6782-4498-814a-ccfa6ec1dfc9

Maybe you are looking for