我怎样才能将结果(Applescript)返回到下一个工作流程?

时间:2012-02-13 15:38:16

标签: applescript automator

抱歉,我是Applescript& amp;的新手。自动机。

我创建了一个工作流程(使用Applescript)从某个网站获取快照(通过Firefox +附加组件"页面保护程序" +热键)。 但我希望将图像传递给另一个流程的下一步工作流程。

下一步该怎么做?

   tell application "Firefox"
   open location "http://xxx.xxx.xxx"
   activate

   tell application "System Events"
       keystroke "d" using {control down}
       -- take snapshot
   end tell
   delay 2
   close every window of application "Firefox"
   tell application "System Events"
       keystroke return
   end tell
   end tell

1 个答案:

答案 0 :(得分:1)

这很草率,但它确实有效。

在页面保护程序首选项中,将屏幕截图保存到: /用户/标记/文档/双床

main()

on main()
set screenshotFolder to (alias "Mac OS X:Users:Mark:Documents:Twin:")

tell application "Firefox"
    activate
    open location "http://www.stackoverflow.com"
    delay 3

    tell application "System Events"
        keystroke "d" using {control down}
        delay 2
        set latestDate to creation date of file 1 of screenshotFolder
        repeat with i from 2 to count of (list folder screenshotFolder)
            if creation date of file i of screenshotFolder is greater than latestDate then
                set latestDate to creation date of file i of screenshotFolder
            end if
        end repeat

        -- The targetFile is what you are looking for
        set targetFile to every file of screenshotFolder whose creation date is latestDate
    end tell
end tell
end main
相关问题