【问题标题】:Simple script no longer works on Lion简单的脚本不再适用于 Lion
【发布时间】:2012-07-09 20:50:55
【问题描述】:

我有一个简单的 Applescript,它会在您选择的文件夹中拍摄许多图像,然后使用图形转换器镜像图像。如果我把它放在一个新的 AS 文件中,这个脚本就会运行;但是,如果我再次尝试运行它,我会收到以下错误“无法获取应用程序“GraphicConverter”的窗口 1。无效索引。”

此脚本始终在 OSX 10.6 上运行

我正在运行 OSX 10.7.4 和 Graphic Converter 8.1(最新版本)。

这是脚本

tell application "Finder"
   activate
   set loopFinish1 to 0
   set pathName to (choose folder with prompt "Choose Folder Containing Images")
   set fileList1 to every file of folder pathName
   set loopFinish1 to count of items of fileList1
end tell

tell application "GraphicConverter"
   activate
   repeat with i from 1 to loopFinish1
       set currentFile to item i of fileList1
       open currentFile as alias
       mirror window 1 in horizontal
       close window 1 saving yes
   end repeat
end tell

这快把我逼疯了!

【问题讨论】:

    标签: osx-lion applescript


    【解决方案1】:

    GraphicConverter 有其他窗口(可见和不可见),最好使用文档来获取正确的窗口。 另外,可能图片没有打开,所以没有窗口,使用try 块。

    activate
    set pathName to (choose folder with prompt "Choose Folder Containing Images")
    tell application "Finder" to set fileList1 to (document files of folder pathName) as alias list
    
    tell application "GraphicConverter"
        activate
        repeat with tFile in fileList1
            set currentDoc to open tFile
            set CurrWindow to (first window whose its document is currentDoc)
            mirror CurrWindow in horizontal
            close currentDoc saving yes
        end repeat
    end tell
    

    【讨论】:

      猜你喜欢
      • 2015-02-08
      • 1970-01-01
      • 2012-08-12
      • 2017-12-03
      • 1970-01-01
      • 2023-04-03
      • 2012-04-17
      • 1970-01-01
      • 2019-12-04
      相关资源
      最近更新 更多