Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Emulate keystrokes is a variable possible

If you have a question or need help, this is the place to be.
Post Reply
rekinnect
Posts: 4
Joined: Tue Nov 15, 2011 12:30 pm

Emulate keystrokes is a variable possible

Post by rekinnect »

Is there any way to have an external variable in EG so a specific Emulate Keystrokes instruction can issue a string that is provided from this variable on execution? For example I want to issue a variable keystroke sequence at different times in a specific Emulate Keystroke command based on external input. Ideally this could be a variable field that is loaded before or when EG is launched that is used in the character string of the specific Emulate Keystroke command.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Emulate keystrokes is a variable possible

Post by jitterjames »

I think you can probably accomplish this with a bit of python scripting, but I can't understand your question.
rekinnect
Posts: 4
Joined: Tue Nov 15, 2011 12:30 pm

Re: Emulate keystrokes is a variable possible

Post by rekinnect »

Thanks for responding, let me be more specific.

My need is to have a Emulate Keystroke command write a character string that is not fixed but rather is the content of a variable that is set prior to the launch of EG.

For example, I would like to have an external variable (eg. $variable) that I load prior to launching EG which could be "content one" in one case and perhaps "content two" in another. The emulate keystroke command would contain the variable name (in this example $variable) and issue the associate keystrokes that were set in this variable prior to launching EG.

For example, I would like the option of having one EG Folder issue different emulate keystroke strings which would result in different programs to be executed in command prompt. If I can do this then I can use one EG folder rather than writing multiple folders each hard coded with the specific keystroke sequence that will cause program a or program b to launch in command prompt.

Please let me know if this description helps.

Also, as my be obvious, I am new to EG and perhaps this exists already but I could not find any documentation that spoke to which variables exist, how to set them or how to use them in action instructions.

Thanks for any help provided.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Emulate keystrokes is a variable possible

Post by jitterjames »

what do you mean by "that I load prior to launching EG". Load how? Into what?

I am getting stuck on all of the terminology that you are using because most of it is not very specific and could mean many different things to me. How are you triggering your EG commands and where are you storing the variables if not in EG itself?

I am pretty sure I can help you figure this out but you need to be precise, and explain more about the other programs involved and/or method you are using to trigger events. Perhaps you can explain more about what specifically you are trying to accomplish with the keyboard emulation in terms of a real world application.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Emulate keystrokes is a variable possible

Post by jitterjames »

for example you also say: " an external variable in EG "

I have no idea what this can possibly mean.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: Emulate keystrokes is a variable possible

Post by jitterjames »

maybe this link will help you

http://www.eventghost.org/docs/scripting.html

you should be able to use an eventghost variable in the keyboard emulation action by writing

{eg.globals.yourvarname}

but you will need to use scripting to get the string you want into that variable in the first place.

you can also use {eg.result} which would be replaced by the last result from an action.
eatmeimadanish
Experienced User
Posts: 118
Joined: Thu Oct 01, 2009 5:11 pm

Re: Emulate keystrokes is a variable possible

Post by eatmeimadanish »

EG is not really setup to be a command line driven only application. Instead it uses a running EG configuration, and the command line is used to generate events. These events can be parsed and turned into variables, but EG must stay running for those variables to continue to work. (PVAR is a plugin to save variables between sessions). EG is not designed to be launched and accept a variable at that time.
forcemaker
Posts: 1
Joined: Thu Dec 26, 2013 4:36 pm

Re: Emulate keystrokes is a variable possible

Post by forcemaker »

Dear rekinnect,

I think that I understand your problem and the use case. Even if your original posting is from 2011, I want to put in what I have figured out today, after searching quite some time. I think that this will solve your problem.

My use case:
  • I am sending messages to EventGhost from my Android device from the "AutoRemote App"
  • I receive these messages with the "AutoRemote plugin". But this should apply to all "EventGhost" events that carry a message!
  • The message contains the keys that the "Emulate Keystrokes action" should perform, e.g. pressing simultaneously "Alt+X"
In case of Autoremote the event is called "AutoRemote.Message" and it got a payload, which is a text that I chose to send from my Android device. I can access the payload text (maybe?) from all text fields available to configure an EventGhost Action.

So, if I receive an event with a payload I can call the "Emulate Keystrokes" Action from Category "Window -> Emulate Keystrokes" and enter in the field "text to type" this string:

Code: Select all

{eg.event.payload}
Enter this with the curly brackets as shown in the screenshot I posted below.

If the message contains ...

Code: Select all

{Alt+x}
... the "Emulate Keystrokes Action" will use this information to perform the keystroke as if you entered it manually in the configuration dialog.

This is how you can specify the keystroke action after having set up the rules and spontaneously decide what they should do.

I hope this helped somebody, as it was a little hard to figure out myself as I am a very to EventGhost.

By the way, my project is to use my Android tablet as a dashboard for an game called "Vendetta Online" which has quite some commands that I don't want to memorize. So I create with Tasker (1) (2) a simple user interface (Tasker calls them "Scenes") with buttons labeled with the function they call. On pressing the button the "AutoRemote App" is triggered and sends something like the above "{Alt+x}" to EventGhost, which will send this to the game. (At the time of writing this, I didn't get there, so I don't know yet, if "Vendetta" Online will accept these keystrokes.) The buttons will call the same Tasker task but with each a different payload string. Therefor I do create a button with the specified string on my tablet and not in EventGhost. I might do it the other way around, but I prefer writing "code" instead of clicking around.
Attachments
Keystrokes variable output A01.jpg
deadlyBP
Posts: 1
Joined: Fri Feb 14, 2014 11:31 pm

Re: Emulate keystrokes is a variable possible

Post by deadlyBP »

@forcemaker I created an account just to tell you thanks!! I was struggling with this all evening and could not find a detailed solution such as yours. Thank you for taking your time to make that post..
Post Reply