如何将(Applescript的)结果返回到下一个工作流



很抱歉,我是Applescript&Automator。

我已经创建了一个工作流程(使用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

这是草率的,但它是有效的。

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

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

最新更新