Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将(Applescript的)结果返回到下一个工作流?_Applescript_Automator - Fatal编程技术网

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

如何将(Applescript的)结果返回到下一个工作流?,applescript,automator,Applescript,Automator,对不起,我是Applescript&Automator的新手 我已经创建了一个工作流(使用Applescript)从某个网站获取快照(通过Firefox+附加“页面保护程序”+热键)。 但我希望将图像传递到工作流的下一个步骤,以便进行另一个流程 下一步怎么办 tell application "Firefox" open location "http://xxx.xxx.xxx" activate tell application "System Events"

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

工作流的下一步是另一个AppleScript吗?是的,我也有类似的想法。我最初的想法是让查找者在ScreenShot文件夹中获取“文件名”。你在截图之前就这么做了,然后在截图之后再做一次。然后循环第二个列表,对照第一个列表检查名称。当您找到不在第一个列表中的名称时。。。那是你的新档案。和你的想法相似。