远程 AppleScript 事件
我正在尝试在远程计算机上打开 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用远程版本的 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.