Google chrome Chrome、Youtube和AppleScript
我正在尝试使用applescript设置youtube视频播放点。例如,当您在此视频上按0-9键时,播放点会发生变化 我已经成功地告诉chrome使用这个命令来击键1Google chrome Chrome、Youtube和AppleScript,google-chrome,youtube,applescript,Google Chrome,Youtube,Applescript,我正在尝试使用applescript设置youtube视频播放点。例如,当您在此视频上按0-9键时,播放点会发生变化 我已经成功地告诉chrome使用这个命令来击键1 tell application "Google Chrome" activate tell application "System Events" to tell process "Google Chrome" to key code 83 end tell 返回1,但只有地址栏高亮显示。所以我的问题是,我如何把注意力
tell application "Google Chrome"
activate
tell application "System Events" to tell process "Google Chrome" to key code 83
end tell
返回1,但只有地址栏高亮显示。所以我的问题是,我如何把注意力集中到youtube视频上
我绝对不是程序员,这也是我第一次使用apple脚本 可能尝试使用击键选项卡而不是地址栏来标记其指向视频的方式,确保在页面加载后将其放在开头。可能尝试使用击键选项卡而不是地址栏来标记其指向视频的方式,确保在页面加载后将其放在开头。对于您来说,一个好的练习是验证输入。(在对话框接受答案并执行下一个命令之前,确保用户文本符合所需格式)
一个很好的练习是验证输入。(在对话框接受答案并执行下一个命令之前,确保用户文本符合所需格式)
我找到了我的答案,我的钥匙号码错了,是18而不是83。我觉得很傻,还是谢谢你的帮助!我找到了我的答案,我的钥匙号码错了,是18而不是83。我觉得很傻,还是谢谢你的帮助!我找到了我的答案,我的钥匙号码错了,是18而不是83。我觉得很傻,还是谢谢你的帮助!我找到了我的答案,我的钥匙号码错了,是18而不是83。我觉得很傻,还是谢谢你的帮助!
set videoUrl to "https://www.youtube.com/watch?v=o6xchtAsq4U"
set AppleScript's text item delimiters to ":"
set {min, sec} to text items of (text returned of (display dialog "Enter start time… minutes:seconds" default answer "1:15"))
set AppleScript's text item delimiters to {""}
tell application "Google Chrome"
if not (exists window 1) then reopen
set URL of active tab of window 1 to videoUrl & "&t=" & min & "m" & sec & "s"
end tell