0

对不起,我是 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
4

1 回答 1

1

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

在页面保护程序首选项中,将您的屏幕截图保存到:/Users/Mark/Documents/Twin

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
于 2012-02-14T16:41:15.537 回答