Bring the window forward in applescript

This is probably a general newbie, but here it is. I make a clean application. He activates another application and then enters it. The problem is that when you activate the application, it does not bring the application window to the forefront. I tried the application activate:

tell application "app_name.app"
activate
tell application "System Events" to keystroke "test"
end tell

Any help? Thank!

+5
source share
2 answers

If the target application does not have open windows, you need to open the default window again:

tell application "Terminal"
    reopen
    activate
end tell
+14
source

The correct way to execute commands in the terminal:

tell application "Terminal"
    do script "echo hi"
end tell
0
source

All Articles