0

I created this bash file, first it clicks the java icon in the dock and then it uses cliclick to move the mouse to where the textbox usually is, and then types those commands (for a minecraft server)

#!/bin/bash

osascript -e 'tell application "System Events" to tell process "Dock"
    click UI element "java" of list 1
end tell'

sleep 1 # wait for window to appear

/usr/local/bin/cliclick m:800, 650 c:+0,+0

osascript <<EOD
tell application "System Events"
    tell process "Main"
        
        # Type the message
        keystroke "say will close in 5 seconds"
        
        # Press the enter/return key
        keystroke return

    delay 5

        # Type the message
        keystroke "stop"
        
        # Press the enter/return key
        keystroke return

    end tell
end tell
EOD


When I run it in terminal using ./stop.sh it works fine but if i run it from an app which was converted from the original bash file using automator or platypus it moves the mouse to the wrong spot, any ideas or help?

0 Answers0