【问题标题】:applescript inside python not working after monterey update蒙特雷更新后python中的applescript无法正常工作
【发布时间】:2021-12-30 05:23:36
【问题描述】:

我在 python 文件中有以下代码:

applescript.run('''

        tell application "System Events"

            -- one second delay
            delay 1
            -- to press command+shift+g
            keystroke "G" using {command down, shift down}
            
            delay 2
            -- to enter file path
            keystroke "/Users/***/Documents/web_images/image_1.jpg"
            delay 1
            
            -- hit return twice
            keystroke return
            delay 1
            keystroke return

        end tell
        
''')

在我安装 Monterey 之前它运行良好,现在它不再运行了。有人知道如何解决吗?

【问题讨论】:

    标签: python applescript macos-monterey


    【解决方案1】:

    解决了这个问题,从脚本编辑器运行了一个类似的脚本,不得不再次授予权限,现在它又可以在 python 内部工作了。

    【讨论】:

      猜你喜欢
      • 2019-08-10
      • 2014-05-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-07
      相关资源
      最近更新 更多