Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate running script for each simulator #123

Open
danispringer opened this issue Jan 1, 2024 · 6 comments
Open

Automate running script for each simulator #123

danispringer opened this issue Jan 1, 2024 · 6 comments

Comments

@danispringer
Copy link
Contributor

Is there any way we can automate the script so that inject runs for each simulator, instead of running it manually for each result of xcrun <UDID>?

@chrisvasselli
Copy link
Collaborator

Hmm, you could probably grep the output of xcrun simctl list and somehow pull the list of ID's out of that, and then run the script on each one. But I haven't attempted something like that.

@chrisvasselli
Copy link
Collaborator

ChatGPT came up with the same idea. I haven't tried it, but you could do something like this:

https://chat.openai.com/share/23e601a8-6ae5-4db1-8f79-6d966cd25319

@danispringer
Copy link
Contributor Author

xcrun simctl list devices | grep "(Booted)" | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})"

This outputs the list of booted simulators. Now I just have to find how to run build_and_inject.sh VALUE for each line of an output such as:

123
ABC
XYZ

@chrisvasselli
Copy link
Collaborator

This might work

xcrun simctl list devices | grep "(Booted)" | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})" | while read line; do
  ./build_and_inject.sh "$line"
done

@danispringer
Copy link
Contributor Author

danispringer commented Apr 5, 2024

That looks like it works! Thanks @chrisvasselli !

(didn't fully test yet as I had already manually run it so status bars were already "cleaned")

Perhaps we can add something to README, like "boot up every wanted simulator and then run this"

@danispringer
Copy link
Contributor Author

danispringer commented Apr 5, 2024

@chrisvasselli now I'm looking for a way to quickly boot a list of simulators, given a list of names like

iPhone 13 Pro Max
iPhone 15 Pro Max
iPhone SE (3rd generation)
iPad Pro (12.9-inch) (6th generation)

Basically trying to automate some more of the process

I'm guessing some more of the xcrun simctl list somehow, gonna look into it

EDIT: Maybe my approach is a "XY", and really there is a more direct way to boot sims and run something on them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants