[solved] Help start game with bash script
-
Hello, I'm on Ubuntu 20.04 and trying to start a flash game with a script and I'm facing 2 problems.
The script looks like this:#!/bin/bash wine start /unix "/home/tar/Applications/flashpoint/FPSoftware/Flash/flashplayer_32_sa.exe" /home/tar/Retropie/roms/flash/FPAWorld1_07a.swf && antimicro --tray --profile /home/tar/RetroPie/fancypants.gamecontroller.amgp & sleep 3 && xdotool key --window 'Adobe Flash Player 32' "ctrl+f"
First problem:
When I execute the script in retropie the game starts but when the ctrl+f input gets send and the Adobe Player maximises the screen switches back to emulationstation (while the game is still running maximised)Second Problem:
Trying if it works without sending ctrl+f input from script I saw that I can play the game and also maximising the window by hand. But the problem is that when I close the game/flash player I'm stuck in retropies console with this:QFSFileEngine::open: No file name specified
I can switch back to emulationstation with alt+tab. When I start the script from terminal the above message is also there but the process ends and i could start writing new commands to the terminal. I searched for this error message but I couldn't figure out how to solve this and I don't think it needs an urgent fix because if I switch back to ES with alt+tab i can start new games without any issues and get back to ES when I end the game.
Can anyone help me with this?
-
The more I think about this the only problem is that it switches to the wrong window. Is it possible to change the script in a way that the screen stays at the adobe player when he get maximised and after that when closing the player switches back to emulationstation?
Any help would be appreciated, thanks in advance -
@tardigrada said in Help start game with bash script:
xdotool key --window 'Adobe Flash Player 32'
Try to activate/raise the window with
xdotool
, before sending it 'Ctrl + F'. -
@mitu Thanks for your input, unfortunately adding
xdotool search Adobe windowactivate
to the script doesn't change the outcome. Tried it with setting the command before sending ctrl+f and also after. If I use the command in terminal it works and switches to the game... Also tried it with windowraise but that even didn't work from terminal.
Another strange behavior is that every now and then when I start the game from ES the window isn't maximised but there isn't any suspicious in the log... -
OK I solved the issue by using wmctrl instead of xdotool:
#!/bin/bash wine start /unix "/home/tar/Applications/flashpoint/FPSoftware/Flash/flashplayer_32_sa.exe" /home/tar/Retropie/roms/flash/FPAWorld1_07a.swf && antimicro --tray --profile /home/tar/RetroPie/fancypants.gamecontroller.amgp & sleep 2 && wmctrl -r 'Adobe Flash Player 32' -b toggle,fullscreen & sleep 2 && wmctrl -r 'Adobe Flash Player 32' -b add,above
@mitu Thanks for your help
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.