scottinNH Posted April 3, 2023 Share Posted April 3, 2023 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: Start emulator (which auto-loads a disk, and auto-runs my CC65 executable) 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. Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 3, 2023 Share Posted April 3, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
matosimi Posted April 3, 2023 Share Posted April 3, 2023 https://windowsreport.com/automate-pc-tasks/ 1 Quote Link to comment Share on other sites More sharing options...
scottinNH Posted April 3, 2023 Author Share Posted April 3, 2023 (edited) 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 April 3, 2023 by scottinNH clarity edit, but this is just 1 possibility Quote Link to comment Share on other sites More sharing options...
thank you Posted April 3, 2023 Share Posted April 3, 2023 (edited) 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 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 April 3, 2023 by thank you specific example 1 1 Quote Link to comment Share on other sites More sharing options...
scottinNH Posted April 3, 2023 Author Share Posted April 3, 2023 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) 1 Quote Link to comment Share on other sites More sharing options...
SenorRossie Posted April 3, 2023 Share Posted April 3, 2023 AutoIT for Windows is able to send keystrokes to the emulator, emulated host and probably is able to copy text from the emulated host to the Windows clipboard (if supported by the emulator). 1 Quote Link to comment Share on other sites More sharing options...
thank you Posted April 3, 2023 Share Posted April 3, 2023 This seemed like an excuse to try out tesseract-ocr... ...well maybe not lol... perhaps if i knew the proper ImageMagicks... 1 Quote Link to comment Share on other sites More sharing options...
invisible kid Posted April 3, 2023 Share Posted April 3, 2023 On getting text out of atari800. I know you used to be able to compile a version that would be text-only and just use the native terminal as the emulator. Obviously will only work with text-only programs. Also, there may be other ways, better ways, this is just one that I remember off-the-cuff. Quote Link to comment Share on other sites More sharing options...
thank you Posted April 4, 2023 Share Posted April 4, 2023 Just for fun, to see if I could get it to work. I can post the scripts if anyone would like them. 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.