user13054042
user13054042

Reputation:

How Can I simulate Return KeyPress within BashScript for Expo Build Process

My current script looks something like this:

#!/bin/sh
cd Desktop/work-directory/project-directory/
code .
npx expo run:ios -d
sleep 10
xdotool key Return

From an outsiders perspective, might anyone be able to shed some light on what I might be doing wrong? Is my syntax wrong? Does someone know if I have to use any different tools from xdotool to interact with the Expo CLI prompt? Any and all help would be greatly appreciated.

Thank you so much and I look forward to hearing from y'all within the Bash community :)

Upvotes: 0

Views: 40

Answers (2)

user13054042
user13054042

Reputation:

To answer my own question, I actually didn't need to simulate a return keyPress to automate one of the commands within the Expo CLI

I was able to come to a solution by using the following tool: FIG (https://fig.io/)

When I would input npx expo run:ios -d, before pressing enter like I usually do, fig had auto populated the device id to go after -d. Which made the whole command look something like this npx expo run:ios -d 00008030-000537H31B5573F (Numbers and letters have been changed). This alone allowed me to essentially respond to one of Expo's interactive prompts by providing the device id before it was ever asked.

Hopefully this can help someone else in the future. Cheers.

Upvotes: 0

Eric Marceau
Eric Marceau

Reputation: 1707

Looking at the manual page, , look for the reference to "Navigator".

That gives an example of how to make xdotool locate the window associated with your npx expo process, so that it can then send that signal to it.

Upvotes: 0

Related Questions