applescript可以很好地移动终端和查找器窗口,但不能移动Chrome窗口

applescript可以很好地移动终端和查找器窗口,但不能移动Chrome窗口,applescript,Applescript,这会移动Finder和Terminal的窗口,但由于某些原因,无法与其他应用程序配合使用,比如谷歌Chrome,如下代码所示 tell application "System Events" set activeApp to name of application processes whose frontmost is true do shell script "echo activeApp " & quoted for

这会移动Finder和Terminal的窗口,但由于某些原因,无法与其他应用程序配合使用,比如谷歌Chrome,如下代码所示

tell application "System Events"
    
    set activeApp to name of application processes whose frontmost is true
    do shell script "echo activeApp " & quoted form of (activeApp as string) & ¬
        " >> ~/Desktop/as_debug.txt"
    
    
    tell application "Google Chrome"
        do shell script "echo count windows " & quoted form of ((count windows) as string) & ¬
            " >> ~/Desktop/as_debug.txt"
        repeat with x from 1 to (count windows)
            set position of window x to {0, 22}
        end repeat
        
    end tell
    
end tell
错误相当模糊:
无法将窗口1的位置设置为类型引用。


任何关于Applescript抱怨什么以及为什么它对Finder和Terminal起作用的线索

set theApp to "Spotify"


tell application "Finder"
    set screenResolution to bounds of window of desktop
end tell

set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution



tell application "System Events"
    tell process theApp
        repeat with x from 1 to (count windows)
            set the size of window x to {screenWidth / 2, screenHeight}
            set position of window x to {0 + 0 * screenWidth / 2, 22}
        end repeat
    end tell
end tell

您需要查看Google Chrome脚本字典。术语由开发人员决定-不能保证任何给定的术语在不同的应用程序中做相同的事情。