用AppleScript前面的窗口

Cha*_*ase 6 macos applescript

这可能是一个全新的问题,但在这里.我正在制作一个纯AppleScript应用程序.它激活另一个应用程序,然后键入.问题是,当它激活应用程序时,它不会将应用程序窗口置于最前面.我试着告诉应用激活:

tell application "app_name.app"
activate
tell application "System Events" to keystroke "test"
end tell
Run Code Online (Sandbox Code Playgroud)

有帮助吗?谢谢!

Lri*_*Lri 15

如果目标应用程序没有打开窗口,则必须重新打开默认窗口:

tell application "Terminal"
    reopen
    activate
end tell
Run Code Online (Sandbox Code Playgroud)