Jump to content
IGNORED

sending a keystroke to emulator, from host OS


scottinNH

Recommended Posts

Hey all,

 

I have a simple need to send a keystroke into an emulator which has some application running.  I want to keep all possible solutions open, so I keep this requirement very loosely-define. So: any emulator, any host OS, any Accessibility or any OS automation is valid.

 

Flow:

  1. Start emulator (which auto-loads a disk, and auto-runs my CC65 executable)
  2. After N seconds, send my executable a standard keystroke (fake the user inputting "42", followed by Return)

 

Caveat: this input has to happen as some kind of timed event, or recorded action, or command-line argument to the emulator. Or some automatable OS-level accessibility tool that transmits the keypresses. Anything that does not require me to physically be in front of the emulator keyboard, and manually typing. 🙂

 

Context

The text-mode EXE I'm playing with works under both Linux/mac + Atari. To do this requires #IFDEF macros in the code. It works, but when I make a change it is double the testing. I can write an automated test that compares active application's screenshot to some baseline. But a prerequisite to that step is knowing how to send/trigger keypresses inside any emulator.

Link to comment
Share on other sites

I had the need for something similar about 15 years ago but it was related to using an IR remote control with the computer.

At the time I'm fairly sure 2 programs I came across to do some of what I needed were Girder and HIP (Human Interface Parser)

 

Whether they're still around or are good for what you want, I'm not sure.

But there's other automation packages around though some aren't cheap.

There's stuff like input redirection that can take controller or key input and pass to a program as one or the other.

From what you seem to say, you seem to want to send predetermined keystrokes to the emu.

 

A search "Send keystokes to a program" brings up a fair number of solutions.

  • Like 1
Link to comment
Share on other sites

Ohh, I found a breadcrumb:

Quote

I know it is possible in Altirra to call it via command line passing the parameter /type "keys" which will type the "keys" after launching the emulator.

source: https://forums.atariage.com/topic/312435-sending-keystrokes-to-atari800-or-atari800macx-emulator-via-command-line-parameters/

 

PROBLEM then is... where can I find online documentation on this Altirra feature (`/keys`)? 

virtuabdub.org has 2 PDF docs: Hardware PDF and BASIC PDF). 

Is there online docs for CLI args?  For Altirra's Debugger also?

Edited by scottinNH
clarity edit, but this is just 1 possibility
Link to comment
Share on other sites

in linux you can use xdotool

 

sudo apt install xdotool

atari800 -basic

 

[then from another terminal]

 

xdotool key --window $(xdotool search --name "Atari 800 Emulator, Version 4.2.0") a

 

atari004.png.e445781c302143db517f9982db7741f1.png

 

edit: send multiple keystrokes like this, we have to add delay between them.

xdotool key --delay 100 --window $(xdtool search --name "Atari 800 Emulator, Version 4.2.0") 4 2

Edited by thank you
specific example
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

23 minutes ago, thank you said:

edit: send multiple keystrokes like this, we have to add delay between them.

xdotool key --delay 100 --window $(xdtool search --name "Atari 800 Emulator, Version 4.2.0") 4 2

Thanks! EXACTLY the kind of solution I wanted: it gets a handle to the window, and lets you send typing more than once.

 

There isn't any way to get text OUT of Atari800, is there? (Not required for my plan but would be nice to have)

 

 

👆Anyone else with ideas, don't let this prospect shut down the convo if you have another solution)

Basically what I want to do is script an integration test, that checks emulation display vs a pre-captured screenshot.

I haven't done this kind of test using screenshots, but I've seen a bunch of examples online (and some screenshot tests run in "headless mode" which is even better for me)

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...