2 Replies Latest reply on Jun 25, 2012 2:09 AM by derflow85

    JavaScript - Closing dialogue box with NumPad Enter

    derflow85

      Hi there,

       

      I have a JavaScript in Photoshop (CS6) that opens a dialog box with an OK and a Cancel Button.

      If I hit return on the keyboard the box closes as if i clicked the OK button, if I hit the NumPad Enter key nothing happens.

       

      Any ideas on how to get the NumPad Enter key to work properly on this?

      (not that this is a BIG deal, but I always use the NumPad to close dialog boxes as it is next to my mouse, and I don't wanna switch between the two keys all the time...)

       

      I'm on a Mac btw.

       

       

      kind regards

       

      derflow

        • 1. Re: JavaScript - Closing dialogue box with NumPad Enter
          c.pfaffenbichler Level 9

          The numerical keyboard enter key works for me with a JavaScript dialog in Photoshop (Photoshop 13.0 on Mac OS 10.6.8, also tested on 10.7.4 on a colleague’s station) – I wonder if this may not be more of an OS issue rather than one with Photoshop/JavaScript.

          • 2. Re: JavaScript - Closing dialogue box with NumPad Enter
            derflow85 Level 1

            Strange.. I'm on 10.7.4, tested it in CS6 and CS5...

             

            Here's what i got, can you see what it could be?

             

             

             

            // ========== FENSTER START=============

            function fenster (dpi, dateiendung) {

             

             

            var headermeldung = docRef.name + ": " + docRef.resolution + "dpi";

            var dpiyes = "auf 300dpi umwandeln";

            var dpino = docRef.resolution + "dpi belassen";

            var dlgy = 10;

             

             

            var dlgsizex = 370;

            var dlgsizey = 90;

            if(aufloesung<dpiOk){dlgsizey = dlgsizey + 90;}

            if(formatcheck == -1){dlgsizey = dlgsizey + 70;}

            var dlg = new Window("dialog",headermeldung,[1,1,370,dlgsizey]);

             

             

            // dpi Auswahlkästchen

            if(aufloesung<dpiOk){

            dlg.oben = dlg.add("panel",[10,dlgy,350,dlgy+80],"DPI Umwandeln");

            dlg.oben.radio1 = dlg.oben.add("radiobutton",[10,10,400,40], dpiyes);

            dlg.oben.radio1.value = true;

            dlg.oben.radio2 = dlg.oben.add("radiobutton",[10,40,400,70], dpino);

            dlgy = dlgy + 90;

            }

             

             

            // TIF speichern Auswahlkästchen

            if(formatcheck == -1){

            dlg.mitte = dlg.add("panel",[10,dlgy,350,dlgy+60],"TIF speichern?");

            dlg.mitte.tif = dlg.mitte.add ('checkbox',[10,10,35,35]);

            dlg.mitte.tif.value = true;

            dlg.mitte.tiftext = dlg.mitte.add ('statictext',[45,10,160,35],"TIF SPEICHERN");

            dlg.mitte.tifopenbox = dlg.mitte.add ('checkbox',[170,10,195,35]);

            dlg.mitte.tifopenbox.value = true;

            dlg.mitte.tifopentext = dlg.mitte.add ('statictext',[205,10,325,35],"vorh. TIF öffnen");

            dlgy = dlgy + 70;

            }

             

             

            dlg.unten = dlg.add("panel",[10,dlgy,350,dlgy+60],"Übernehmen?");

            dlg.unten.cancel = dlg.unten.add("button",[10,10,155,40],"Abbrechen", {name:"cancel"});

            dlg.unten.ok = dlg.unten.add("button",[170,10,325,40],"OK", {name:"ok"});

             

             

            //Fenster anzeigen

            dlg.center();

            ok = dlg.show() == 1;       

             

            if(aufloesung<dpiOk){  //dlg.oben wurde sonst ja nicht definiert

            with (dlg.oben){

               

                if(radio1.value == 1) { reschange = 1; }

                if(radio2.value == 1) { reschange = 0; }

            }

            }

            if(formatcheck == -1){  //dlg.mitte wurde sonst ja nicht definiert

            with (dlg.mitte){

                if(tif.value == true) { tifsave = 1;}

                if(tif.value == false) { tifsave = 0;}

               

                if(tifopenbox.value == true) { tifopen = 1;}

                if(tifopenbox.value == false) { tifopen = 0;}

            }

            }

            // ========== FENSTER ENDE =============

            }