AppleScript - 在 Opera 上执行 JavaScript [英] AppleScript - JavaScript execution on Opera

查看:25
本文介绍了AppleScript - 在 Opera 上执行 JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Safari 和 Chrome 可以通过 AppleScript 执行 JavaScript

Safari and Chrome can execute JavaScript via AppleScript

Safari:

tell application "Safari"
    open location "http://example.com"
    activate
    do JavaScript "alert('example');" in current tab of first window
end tell

Chrome:

tell application "Google Chrome"
    open location "http://example.com"
    activate
    execute front window's active tab javascript "alert('example');"
end tell

在 Opera 中有没有办法做到这一点?

注意:Firefox 的相同问题在这里:AppleScript - Firefox 上的 JavaScript 执行

我想过一起问他们,但我决定问两个不同的问题,以便能够分别接受答案.

推荐答案

不,Opera 似乎没有 AppleScript 字典

No, it would seem that Opera does not have an AppleScript dictionary

根据本网站:

Opera (www.opera.com/download/) 是一种快速、强大且昂贵(40 美元)的网络浏览器.如果您正在寻找 AppleScript 支持,请远离;Opera 也没有.

Opera (www.opera.com/download/) is a speedy, powerful, and expensive ($40) Web browser. If you're looking for AppleScript support, stay far away; Opera has none either.

此处的讨论似乎支持这一事实.

That fact seems to be supported by the discussion here.

话虽如此,您可能能够绕过该限制(但它会非常难看).

That being said, you might be able to hack around that restriction (but it will be very ugly).

根据此处:

要间接访问 Opera 中的控制台(已在 v9.6 上检查),快捷方式是 CTRL + SHIFT + I

To indirectly reach the Console in Opera (checked on v9.6) the shortcut is CTRL + SHIFT + I

我认为这是 Windows 的方式,但 Mac 可能只是 command + shift + i.

I think that is the Windows way, but Mac is probably just command + shift + i.

您让 Opera 成为前窗口,然后您使用系统事件开始输入.例如:

You get Opera to be the front window, then you use System Events to start typing. For example:

tell application "System Events"
    keystroke "l" using command down
    keystroke "c" using command down
end tell

(换句话说,您应该使用其他浏览器.)

(In other words, you should just use another browser.)

这篇关于AppleScript - 在 Opera 上执行 JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆