远程 AppleScript 事件

发布于 2024-10-10 22:08:49 字数 947 浏览 3 评论 0原文

我正在尝试在远程计算机上打开 QuickTime 视频,但遇到一些问题。

有人可以帮忙吗?

这是我到目前为止得到的代码,它能够打开视频,但不知道如何让它播放......

set TheView2 to "eppc://username:[email protected]"
set remoteFinder to application "Finder" of machine TheView2
using terms from application "Finder"
    tell remoteFinder
        open application file id "com.apple.QuickTimePlayer"
        try
            using terms from application "QuickTime Player"
                tell application "QuickTime Player" of machine TheView2
                    open "Macintosh HD:Users:mini:Desktop:cache.mov"
                end tell
            end using terms from
        on error errText number errNum
            display dialog "Some other error: " & errNum & return & errText
        end try
    end tell
end using terms from

I'm trying to open a QuickTime video on a remote computer but running into some issue.

Can someone help?

This is the code I've got so far, it's able to open the video but don't know how to get it to play...

set TheView2 to "eppc://username:[email protected]"
set remoteFinder to application "Finder" of machine TheView2
using terms from application "Finder"
    tell remoteFinder
        open application file id "com.apple.QuickTimePlayer"
        try
            using terms from application "QuickTime Player"
                tell application "QuickTime Player" of machine TheView2
                    open "Macintosh HD:Users:mini:Desktop:cache.mov"
                end tell
            end using terms from
        on error errText number errNum
            display dialog "Some other error: " & errNum & return & errText
        end try
    end tell
end using terms from

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纸伞微斜 2024-10-17 22:08:49

使用远程版本的 Quicktime 打开电影后,只需在同一代码块中发出“播放”命令即可。顺便说一句,嵌套告诉块是一个坏主意。具体来说,在您的情况下,您在 Finder 告诉块内有 Quicktime 告诉块。基本上,您是在告诉 Finder 告诉 Quicktime 做某事。为什么? Finder 不需要向 Quicktime 发出任何命令,因为 applescript 自己可以做到这一点。因此,将 2 个告诉块彼此分开。这样你们的冲突就会少一些。

After you open the movie using the remote version of Quicktime just issue the "play" command in the same block of code. By the way, it is a bad idea to have nested tell blocks. Specifically in your case you have the Quicktime tell block inside the Finder tell block. Basically you're telling the Finder to tell Quicktime to do something. Why? The Finder doesn't need to issue any commands to Quicktime because applescript can do that itself. So separate the 2 tell blocks from each other. You'll have less conflicts that way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文