Time 在Applescript中的一个脚本/应用程序中同时重复脚本

Time 在Applescript中的一个脚本/应用程序中同时重复脚本,time,applescript,repeat,Time,Applescript,Repeat,在Applescript中的一个脚本/应用程序中同时重复脚本 我在编写这个巨魔程序时遇到了一个问题 我想做的是在受害者无法关闭音量的情况下打开音量,同时运行脚本(在一个脚本/应用程序中)。我不知道如何将这些脚本组合成一个脚本,并让它们同时运行。这是剧本 on run {input, parameters} tell application "Google Chrome" activate open location "https://youtu

在Applescript中的一个脚本/应用程序中同时重复脚本

我在编写这个巨魔程序时遇到了一个问题

我想做的是在受害者无法关闭音量的情况下打开音量,同时运行脚本(在一个脚本/应用程序中)。我不知道如何将这些脚本组合成一个脚本,并让它们同时运行。这是剧本

on run {input, parameters}


tell application "Google Chrome"
            activate
            open location "https://youtu.be/sZFOwzEFYRA"


            repeat

                delay 0.1

                display dialog "Looooooolz" buttons {"Looooool", "Looolzz"}
                if result = {button returned:"Looooool"} then

                    if exists window "https://youtu.be/sZFOwzEFYRA" then
                        open location "https://youtu.be/sZFOwzEFYRA"
                    end if
                else

                    if exists window "https://www.youtube.com/watch?v=igfJIZayiy8" then
                        open location "https://www.youtube.com/watch?v=igfJIZayiy8"
                    end if
                end if  
            end repeat
        end tell
        return input
    end run
第二个脚本:

on run {input, parameters}

    repeat
    set volume output volume 100
    end repeat

    return input
end run

我认为用纯AppleScript是做不到的。但是,使用AppleScript和shell脚本的组合可以获得类似的效果。下面是一个示例AppleScript,它将在独立的重复循环中显示两个对话框。第一个osascript命令末尾的“&”是使它们并发运行的关键

do shell script "#!/bin/bash
osascript -e 'repeat
display dialog 1
end repeat' &
osascript -e 'repeat
display dialog 2
end repeat'"

你应该能够扩展这个想法,让你的两个脚本做任何你想做的可怕的事情。

你能编辑你的问题来解释你遇到了什么问题吗?分享更多技术细节:它是什么语言?你需要指定你的问题。。。这仅仅是如何让一个脚本调用另一个脚本?搜索“运行脚本”。是别的吗?不清楚您正在对t_1变量执行什么操作。如果问题不清楚,很抱歉。我改了,希望现在一切都清楚了。