Keyboard event capture [CS6]

Hello

I need to capture a key event in InDesign. I tried using "keydown" event, but it gives the error: 'keydown' is not a recognized event type

app.addEventListener ("keyDown", function(k){
         if(k.escKey)
           {
             if(app.activeDocument && app.activeDocument.placeGuns.loaded)
                 app.activeDocument.placeGuns.abortPlaceGun();
           }
    })

Can someone let me know what I'm doing wrong or how to capture this event.

Thank you

Mac

Mac_06 wrote:

Support of keyboard in the document-level event? How know what taken events are supported by a particular object?

I don't think so.

By saying "at the level of the Application" I meant that keyboard/mouse events are not implemented at all in the scope of the application script (in contrast with ScriptUI) model.

Note: It's a misconception to think events like belonging or triggered by some specific objects in the DOM. In fact, objects can listen for events (through the addEventListener methods), and usually any object can listen to any event according to the method of capture and the phase of the event. During its spread, an event (instance) provides such as target and currentTarget properties that provide details on the context, but there is no real link between the event and an object specifier. The event is triggered by the subsystem.

In CS5 and later we have six events, represented by the 'classes' following fields: DocumentEvent, MutationEvent, ImportExportEvent, PrintEvent, event (base class), IdleEvent. This is just a prototype API for all types of events which InDesign agree to make available in the DOM:

AFTER_ACTIVATE  [Event]
AFTER_ATTRIBUTE_CHANGED  [MutationEvent]
AFTER_CLOSE  [DocumentEvent]
AFTER_CLOSE  [Event]
AFTER_CONTEXT_CHANGED  [Event]
AFTER_DELETE  [Event]
AFTER_EMBED  [Event]
AFTER_EXPORT  [ImportExportEvent]
AFTER_IMPORT  [ImportExportEvent]
AFTER_INVOKE  [Event]
AFTER_LINKS_CHANGED  [Event]
AFTER_MOVE  [Event]
AFTER_NEW  [DocumentEvent]
AFTER_NEW  [Event]
AFTER_OPEN  [DocumentEvent]
AFTER_OPEN  [Event]
AFTER_PLACE  [Event]
AFTER_PRINT  [PrintEvent]
AFTER_QUIT  [Event]
AFTER_REVERT  [DocumentEvent]
AFTER_SAVE  [DocumentEvent]
AFTER_SAVE_AS  [DocumentEvent]
AFTER_SAVE_A_COPY  [DocumentEvent]
AFTER_SELECTION_ATTRIBUTE_CHANGED  [Event]
AFTER_SELECTION_CHANGED  [Event]
AFTER_UNEMBED  [Event]
AFTER_UPDATE  [Event]

BEFORE_CLOSE  [DocumentEvent]
BEFORE_CLOSE  [Event]
BEFORE_DEACTIVATE  [Event]
BEFORE_DELETE  [Event]
BEFORE_DISPLAY  [Event]
BEFORE_EMBED  [Event]
BEFORE_EXPORT  [ImportExportEvent]
BEFORE_IMPORT  [ImportExportEvent]
BEFORE_INVOKE  [Event]
BEFORE_MOVE  [Event]
BEFORE_NEW  [DocumentEvent]
BEFORE_OPEN  [DocumentEvent]
BEFORE_PLACE  [Event]
BEFORE_PRINT  [PrintEvent]
BEFORE_QUIT  [Event]
BEFORE_REVERT  [DocumentEvent]
BEFORE_SAVE  [DocumentEvent]
BEFORE_SAVE_AS  [DocumentEvent]
BEFORE_SAVE_A_COPY  [DocumentEvent]
BEFORE_UNEMBED  [Event]
BEFORE_UPDATE  [Event]

FAILED_EXPORT  [ImportExportEvent]
ON_IDLE  [IdleEvent]
ON_INVOKE  [Event]

I guess that this list may change in the future...

@+

Marc

Tags: InDesign

Similar Questions

  • Capturing keyboard events?

    How is it possible to listen to keyboard events, as the depressed return key?  I understand the class ReturnKeyType does not yet work for the QNX InputText component, but even when it's that I'm not sure it will include keyboard events or if it will just be a Visual change to the BACKSPACE on the keyboard.

    I intend using the class flash.text.TextField (for portability) instead of qnx.ui.text.InputText.  Currently, the keyboard will activate and disappear the flash.text.TextField receives or loses the focus.  However, these text fields are the fields of data entry, so I would listen to the back of the key on the keyboard so that I may as well save entered data and remove the keyboard of the screen - or perhaps more simply, just leave the text field to listen to when it loses focus to save the data and allow the keyboard to disappear.  But how do I activate either by pressing back on the keyboard?

    Hey David,

    You can achieve this by using a listener to listen to the keys on your input object as a textfield and response following which keys are pressed. in your case you would listen for the Enter key and perform your actions like taking the focus and the keyboard on the screen. You can use the program below as a reference as to how this can be done:

    package
    {
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.KeyboardEvent;
        import flash.text.TextField;
        import flash.text.TextFieldAutoSize;
        import flash.text.TextFieldType;
        import flash.ui.Keyboard;
    
        [SWF(width="1024",height="600",backgroundColor="#CCCCCC",frameRate="30")]
        public class TextFieldTest extends Sprite
        {
    
            private var myInput:TextField;
    
            public function TextFieldTest()
            {
                super();
    
                // support autoOrients
                stage.align = StageAlign.TOP_LEFT;
                stage.scaleMode = StageScaleMode.NO_SCALE;
    
                myInput = new TextField();
                myInput.width = 300;
                myInput.height = 50;
                myInput.type = TextFieldType.INPUT;
    
                /*
                 * listen for what keys are being pressed and react with
                 * onKeyDown function
                */
                myInput.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
    
                addChild(myInput);
    
            }
            private function onKeyDown(e:KeyboardEvent):void
            {
                /*
                 * You can listen for any key presses under the
                 * flash.ui.Keyboard class. it has all the constants
                 * such as .ENTER, .END, etc
                */
                if (e.keyCode == Keyboard.ENTER)
                {
                    trace("You just entered");
    
                    /*
                     * Steal focus away from the textfield object
                     * focus can be set to anywhere and the keyboard
                     * will disappear
                    */
    
                    stage.focus = null;
    
                    /*
                     * Perform other actions such as saving data
                    */
                }
            }
    
        }
    }
    

    hope that helps. Good luck!

  • Keyboard events can be captured by our plugins?

    My plugin runs through the paths of PDEPage and the elements, placing those surrounded by the classic rubberband rectangle in the Windows Clipboard. In short, it implements the copy half an installation "copy / paste".

    Sometimes, the user may choose to type Ctrl-A to select a maximum rectangle.

    Is this possible? How?

    TIA

    If you have a custom tool is active, your tool can register for keyboard events.

  • Specific keyboard events

    Hi all

    I read a post showing how to display and hide the keyboard, then I could listen to type by hiding a textbox behind the keyboard.

    However, I can't seem to find a way to listen to, as when a user presses the BACKSPACE on the keyboard of the playbook, I would be eternally grateful if someone knows a way that I am at a loss.

    Concerning

    Try this:

    this.mytext.textField.addEventListener( KeyboardEvent.KEY_UP, KeyUp );
    
    ////////////////////////////////////////////////////////////////////////
    private function KeyUp( event : KeyboardEvent ) : void
    {
        if( event.keyCode == Keyboard.BACK) // capture enter key
        {
            // do something
        }
    }
    
  • Sniff for PrintScreen. In Windows 8 blocked keyboard events, monitor what task is to the point.

    In God we trust.

    Good day, everyone.

    My application designed to block the screen capture. It is based on the events of keyboard hook.

    In Windows 8 my callback function is not called, when the monitor of the task is in short.

    I save my callback function with:

    lowLevelKybdHook_ = SetWindowsHookEx ( WH_KEYBOARD_LL, (HOOKPROC): MyCallbackFunction, hInstance, 0);

    It works perfectly in Windows 7 for all cases.

    Windows 8:

    -He works when the monitor of the task is not open.

    -It works, when Task Monitor is opened, not to the point.

    -It does NOT works when the monitor task in short, i.e. my callback function is not called when the task to monitor is the currently selected window.

    -Continue to work (to be called), when the monitor of the task is not to the point.

    I tried to use RegisterHotKey instead SetWindowsHookEx, it has the same effect.

    Any idea?

    Thank you in advance,

    Israel

    PS: I see the same effect with Microsoft Spy ++.
    Keyboard events are blocked, when Microsoft Spy ++ open and in focus.

    Hello Israel,

    Welcome to the Microsoft community.

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forum. It is better you post the same query in the Microsoft Developer Community. You can get more effective suggestions and adapted by experts familiar with this topic.

    You can also consult the following link:

    https://social.msdn.Microsoft.com/forums/en-us/4cda8492-df2e-4D6F-8eee-4b85c491a493/packet-sniffing?Forum=netfxnetcom

    Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

    Thank you

  • Global keyboard event listener?

    Is it possible to create a global keyboard event listener that is unrelated to a window, button, or other user interface element?  The best I could get to add the event to the window listener.  This only works if the window is active.  If the user clicks outside the window and then the receiver for the keyboard does not work.  In addition, when the dialog box appears first of all, it won't work until after the user has made some type of interaction with the window.  I want is to have keyboard shortcuts for users that work regardless of the place where they clicked on the screen, even if the dialogue window is not 'active'.  Is this possible?

    Here is the code I use to the receiver of keyboard for the window.

    mywindow.addEventListener ("keydown", function (k) {keyListen(k)});
    function keyListen(k){if(k.keyName=="Z"){alert("Do stuff here");}}
    

    I don't think that you can create listeners of world events, as for the first appearance of the dialog box, I solved this problem in my script: scripts buliarca BCM_ExtendShortcuts UI by a button activates the event listener to this button. A problem with attach listeners to window, it's in CC2015 events can only be attached to controls and not windows. Setting for windows works in CS6...

  • Help with keyboard events

    Hi, I'm a rhythm box design in flash pro Cs6 actionscript 3.0 and I am trying to add a keyboard event that will trigger a key event that I have created loan, I can create the event to play the sound, but is not what I want, can I call for the button click event moves on the key event triggering the sound Here is an example of one of my buttons... code btn, thanks if anyone can help.

    import flash.events.KeyboardEvent;

    /*

    playsound2.fla

    PlaySound with additional features:

    Added TextBox.

    Display the ID3 information

    */

    btn.addEventListener (MouseEvent.CLICK, playSomeSound);

    function playSomeSound(e:MouseEvent)

    {

    var req:URLRequest = new URLRequest ("Savage.mp3");

    var s:Sound = new Sound (req);

    s.addEventListener (Event.COMPLETE, onSoundLoaded);

    s.addEventListener (Event.ID3, onID3Info);

    }

    function onSoundLoaded(event:Event):void

    {

    var localSound:Sound = event.target as Sound;

    localSound.play ();

    }

    function onID3Info(e:Event):void

    {

    var id3Props:ID3Info = e.target.id3;

    var sOut:String = txt.text = "";

    for (var propName:String in id3Props)

    {

    sOut = propName "=" + id3Props [propName] + "\n";

    trace (sOut);

    txt.appendText (sOut);

    }

    txt. Text = id3Props.comment;

    }

    var ba: ByteArray = new ByteArray();

    var gr:Sprite = new Sprite();

    Gr.x = 5;

    Gr.y = 50;

    addChild (gr);

    var time: Timer = new Timer (50);

    time.addEventListener (TimerEvent.TIMER, timerHandler);

    Time.Start ();

    function timerHandler(event:TimerEvent):void

    {

    SoundMixer.computeSpectrum (ba, false);

    var i: int;

    Gr.Graphics.Clear ();

    gr.graphics.lineStyle (2, 0xFF0000);

    gr.graphics.beginFill (0x00ff00);

    gr.graphics.moveTo (10, 10);

    Draw a circle. ;

    var w: uint = 15;

    for (i = 0; I < 512; i += w)

    {

    var t:Number = ba.readFloat ();

    var n: Number = (t * 200);

    gr.graphics.drawCircle (i, 0, - n);

    }

    }

    You can use the following to trigger your button event:

    btn.dispatchEvent (new MouseEvent (MouseEvent.CLICK));

  • Keyboard event!

    Hello

    I want to create a keyboard event listener in a flex air application. When I try to launch the application it popup a message and says:

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    hand / windowedapplication1_creationCompleteHandler () [F:\Flex Project\experiment\Capture keyboard Input\src\Main.mxml:19]
    hand / ___Main_WindowedApplication1_creationComplete () [F:\Flex Project\experiment\Capture keyboard Input\src\Main.mxml:4]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent() [E:\dev\4.0.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:12266]
    to mx.core::UIComponent / set initialized() [E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1577]
    at mx.managers::LayoutManager/doPhasedInstantiation() [E:\dev\4.0.0\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:759]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback() [E:\dev\4.0.0\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1072]

    I don't know what I did wrong.

    Here's my code for the application:

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:WindowedApplication ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" creationComplete = "windowedapplication1_creationCompleteHandler (event)" >
    < fx:Declarations >
    <! - Place non-visual elements (e.g., services, items of value) here - >
    < / fx:Declarations >
    < fx:Script >
    <! [CDATA]
    Import mx.events.FlexEvent;
    public void handleKeyDown(event:KeyboardEvent): void
    {
    Display.Text = "key has been pressed:"+ event.keyCode;»
    }

    protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
    {
    stage.addEventListener (KeyboardEvent.KEY_DOWN, handleKeyDown);
    }

    []] >
    < / fx:Script >
    < s:Label id = "Display" / >
    < / s:WindowedApplication >

    Hope you can help me to find out why it didn't work. Thank you.

    You use the incorrect event. Change to applicationComplete creationComplete and it will work.

    Kind regards

    Select this option.

  • Unforeseen event, captured by the structure of the digital change notification event

    Using the specific or similar to http://decibel.ni.com/content/docs/DOC-2280 code (change digital notification.vi) I'm observing behavior unexpected, but coherent structure of the event. The structure of the event capture an event, the first time data is received in the structure of the event; even if there was no change in the digital port assigned. After this initial unexpected event, the structure of the event behaves as expected.

    I just wanted to know if someone had a glimpse of it. What is the task of detection of change this event to initialize?

    In this case, you would have to ignore the event first, which in my opnion is valid because it reserve no value to a value.

  • event capture a lov in OPS Page LOV

    Hi all

    I know there are discussions already raised for this but nothing has provided the solution. can someone pls share the code snippet to capture the event lov lov source and the selected value.

    Thank you


    I put a quick post about it. It shows how to get values returned by the LOV also.

    This could help.

    Advice from the Oracle Johny: OAF: how event Capture LOV in Oracle Application Framework

    See you soon

    AJ

  • Keyboard event handler

    I want to process keyboard events and execute a method on every key stroke. It works, but the value sent is a character behind what is actually typed

    < af:resource type = "javascript" >

    function doSomething (evt) {}

    var _keyCode = evt.getKeyCode ();

    model var = evt.getSource ();

    Alert (COMP.getSubmittedValue ())

    AdfCustomEvent.queue (comp, "KeyboardEvent",

    {

    FValue: comp.getSubmittedValue)

    },

    (false);

    evt. Cancel();

    }

    < / af:resource >

    < af:inputText label = "Label 1" id = "it1' autoSubmit ="true">

    < af:clientListener type = "keyPress" method = "doSomething" / >

    < af:serverListener type = "KeyboardEvent" method="#{pageFlowScope.myBean.handleKeyboardEvent}"/ >

    < / af:inputText >

    So, if I type

    ADF

    The first time I will get an empty string, the second time 'a' and the last time "ad".

    Is there a way to get the current value?

    JDev 11.1.2.4

    My work now code I used the keyPressed instead of keyUp event. So now, getSubmittedValue returns the correct value.

    I can't use autosuggest because what the user types is not the value that is to be submitted. For example, the user is looking for a phone country code, it will start to type Ger and the suggested value is Germany + 49 but the value which should be in the form is + 49 and not Germany + 49.

  • If (child on screen) AS3 {play child} (keyboard.event)

    Maby someone can help me with this? :

    I have this script:

    var answerA:Array = [];

    function answerF(answerS:String,x:int,y:int,space:int):void {}

    stiff var: int = answerS.length;

    Word of the var: int;

    If ((answerS.length % 2) == 0) {}

    Word = (((raides * 150) + ((raides-1) * space)) / 2-150);

    } else {}

    Word = (((raides-1) * 150) + ((raides-1) * space)) / 2) - 75;

    }

    var nextX:int = x - Word;

    var C: Class;

    var letter: MovieClip;

    for (var i: int = 0; i < answerS.length; i ++) {}

    C = Class (getDefinitionByName (answerS.charAt (i)));

    Letter = new C();

    addChild (letter);

    answerA.push (letter);

    letter.x = nextX;

    letter.y = y;

    nextX += letter.width + space;

    }

    }

    On the library, I have objects whose names A, B, C, D, E, f... to Z

    This script adds letters from the library. With this script all ok it works perfectly for me, but I want keyboard event for each letter to play but now I don't know how to do this.


    I have a script:


    stage.addEventListener (KeyboardEvent.KEY_DOWN, AKeyDown);

    function AKeyDown(event:KeyboardEvent):void {}

    If (event.keyCode == Keyboard.A) {}

    A.Play ();

    }

    }

    This script works then object instance name.

    And I want to do:

    stage.addEventListener (KeyboardEvent.KEY_DOWN, AKeyDown);

    function AKeyDown(event:KeyboardEvent):void {}

    If (event.keyCode == Keyboard.A) {}

    If child with class name an exist on screen}

    playing the object with the name of class A


    } else {}

    var erreur.r: Sound = new eror();

    errorR.play (0, 1);

    }

    }

    }

    What you need to do, is to give each child a name as you load them.  Then, you can target with their name property.

    var C: Class;

    var letter: MovieClip;

    for (var i: int = 0; i<>

    C = Class (getDefinitionByName (answerS.charAt (i)));

    Letter = new C();

    letter. Name = answerS.charAt (i);

    addChild (letter);

    answerA.push (letter);

    letter.x = nextX;

    letter.y = y;

    nextX += letter.width + space;

    }

    }

    stage.addEventListener (KeyboardEvent.KEY_DOWN, AKeyDown);

    function AKeyDown(event:KeyboardEvent):void {}

    trace ("key pressed:" + string.fromCharCode(0)) (event.charCode));
    var ltr:MovieClip = MovieClip (getChildByName (string.fromCharCode(0)) (event.charCode)));
    LTR. Play();

    }

    You will probably need to convert the string.fromCharCode(0)) (event.charCode) uppercase if you are naming them with capital letters.

  • sequence of images, add the keyboard event loop?

    Hi all

    I have a sequence of 3d images that I want to run with the mouse and drag.

    So far I succeeded with that.

    Also added keyboard event.

    stage.addEventListener (KeyboardEvent.KEY_DOWN, keyPressed);

    function keyPressed(event:KeyboardEvent):void
    {
    If (event.keyCode is 39)
    {
    images_mc.gotoAndStop (images_mc.currentFrame + 1);
    }
    Else if (event.keyCode == 37)
    {
    images_mc.gotoAndStop (images_mc.currentFrame - 1);
    }
    }

    I tried looping event, that is, playing continuously until the button is pressed.

    Help, please.

    Thanks in advance.

    function keyPressed(event:KeyboardEvent):void

    {

    If (event.keyCode is 39)

    {

    If (images_mc.currentFrame<>

    images_mc.gotoAndStop (images_mc.currentFrame + 1);

    }

    else {}

    images_mc.gotoAndStop (1);

    }

    Else if (event.keyCode == 37)

    {

    {if(images_mc.currentFrame>1)}

    images_mc.gotoAndStop (images_mc.currentFrame - 1);

    }

    else {}

    images_mc.gotoAndStop (images_mc.totalFrames);

    }

    }

    }

  • Error 1119: Access of a property may not set with a keyboard event

    Scene 1, Layer 'layer 1', frame 1, line 5.1119: access of property may be undefined LEFT through a reference with static type class.
    Scene 1, Layer 'layer 1', frame 1, line 6.1119: access of property may not set down through a reference with static type class.
    Scene 1, Layer 'layer 1', frame 1, line 7.1119: access of possibly undefined property BACK through a reference with static type class.
    Scene 1, Layer 'layer 1', frame 1, line 8.1119: access of property may not set through a reference with static type class.

    I think that to have public but do not know how the value Keyboard.Event.LEFT, UP, DOWN, RIGHT.

    import flash.events.KeyboardEvent;

    stage.addEventListener (KeyboardEvent.LEFT, characterMove);

    stage.addEventListener (KeyboardEvent.DOWN, characterMove); ------Headphones of events for left keyboard etc.

    stage.addEventListener (KeyboardEvent.UP, characterMove);

    stage.addEventListener (KeyboardEvent.RIGHT, characterMove);

    new audience; function characterMove(evt:KeyboardEvent):void {------function to move the person}

    Switch (evt.keyCode) {}

    case Keyboard.LEFT:

    Person.x-= 20;

    case Keyboard.RIGHT:

    Person.x += 20;

    case Keyboard.DOWN:

    Person.y-= 20;

    case Keyboard.UP:

    Person.y += 20;

    by default:

    trace ("keyboard event error")

    }

    }

    Your listeners must specify KeyboardEvents and upward, DOWN, LEFT, RIGHT aren't KeyboardEvents, they are key keyboard codes.  Using KEY_UP and KEY_DOWN instead of each of them in the headphones.

  • Send the keyboard event of the clip loaded by the parent mouse click

    Hello. I'm building a swf wrapper that loads the third-party swf games. The customer wants a button in the package, that will send a keyboard event in the loaded swf file.

    Can someone give me hand on how to build an event to send in the wrapper which penetrates into the loaded swf file?

    Thank you very much!

    After that is finished loading:

    MovieClip (yourloader.content) .dispatchEvent (new KeyboardEvent (somekeyboardevent));   If the loaded swf file is a movieclip

Maybe you are looking for

  • Satellite M45-S269 shuts down and won't restart

    I have a satellite M series, it froze during use, and when I went to restart it would not immediately. Lights in front I sometimes can go down all the way to the desktop screen, but then it stops again and will not restart immediately. I bought the n

  • 8710p updated to 8.1 Windows (worth it?)

    I just upgraded my RAM, looking at upgrading the processor, but I really want to upgrade my OS to Windows 8.1. Is it wise for a machine this old? Can it manage 8.1 and be able to work effectively with this OS (use all of its features and benefits). I

  • Windows Server 2008 Hardenning

    Hello I installed on a DELL Windows Server 2008 Server. What would be the best way to do the following: Turn off the to-do bar. Allow the user to access both software only and add only those software on the desktop shortcut. Disable all USB ports. Th

  • I have Vista but recquires game 2000 XP

    I don't know if I download Windows 200 XP on my PC which has Vista, if it will mess it up completely and I usually, being able to play my game. Should I just get a new game that is compatible with Vista? The game is Super Pack of CSI.

  • Update of mess even once, will not download, searches are endless.

    * Original title: updated new disorder It is the 2nd computer with which I had problems with major update. Will not download, search are endless. Now he says I never downloaded an update. I tried the suggested corrections and do not work. Said the mi