How do I simulate a keystroke with another keystroke

0 favourites
  • Hi,

    I need to simulate a keystroke with another keystroke. e.g.: on key "o" pressed - simulate keystroke "p"

    (How) Is it possible?



  • Could you explain what you need it for?

    Is it for typing or for attaching events to the keystroke?

  • I need a key-signal for a software parallel to construct, which controls electricity.

  • That doesn't really answer my question, but you could use things like "on keycode pressed" and such..

    See the keyboard entry in the manual for reference..

    A lot of it depends on what you are trying to do and in what way you want to do it..

  • Ah, ok. I need it for typing, in other words: construct should send a specific key-signal 'outside' which another software, which runs besides construct, picks up.

    Does this help?

  • Would something like this work for you?

    keyboard on o pressed : set variable to "p"

  • Don't really get it. Which variable and can I attach a variable to a keystroke?

    Thanks, I'm A beginner


  • Don't really get it. Which variable and can I attach a variable to a keystroke?

    Thanks, I'm A beginner


    If you don't get it, I don't..

    You want to send something to another application, you say..

    That message should be set to the keystroke, but not the key touched, but another one..

    Instead of "the message" (I have no idea how you are going to send it) I set a variable, so you can send the variable as a message..

    Create a text variable and you see, you can set it to another letter as you wish..

    You could also create a text-object and use that instead of the variable (or just to show the variable so you can see it works)..

    If this isn't what you want, please explain in greater detail..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for keeping up

    Maybe I didn't explain it right. I try again:

    I don't want to set another key as a 'graphical symbol' which can be read on the screen.

    The whole story is: I want to run a game, programmed with construct, and in that I want to combine certain actions with light effects (with real lights in a real room).

    So I need an impuls which can be picked up by a dmx-application, a software, which can control real lights (on, out, etc.). And this dmx-software can control the lights with key-commands.

    So, my wish in construct is something like this:

    Keyboard - on P pressed - set sprite.xy visible

    - simulate keyboard press O

    Does this help?


  • I do not understand what the simulate keypress would do in this example..

    There don't seem to be any actions attached to the keypress..

    Maybe I don't understand, but..

    If the other program runs at the same time and needs a specific key pressed, why not press that key?

  • No action within construct. The action is happening outside in the dmx-software.

    It's a game, someone is playing. Without any other person there, who is the light-jockey, who presses the key which sets the lights.

  • So how should the dmx-software know a key that isn't being pressed is virtually pressed inside another program?

  • Thats exactly my task, i have to solve. There are lots of less powerful programs than construct is, which can do that. So, i thought, there might be away. No way?

  • You can't do that in construct, since it runs with html5/javascript and it would be a security violation to let stuff that runs on a webpage simulate keystrokes as if the user pressed it.

    To do it you'd have to use something much lower level that has access to the winapi, and even then simulating a keystroke in another program is kind of hacky.

  • Maybe you'll have some luck with autohotkey. I believe it can simulate a keystroke when a string is copied to the clipboard.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)