为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

applescript can't get name of front window

  • 12 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 emelin

more options

The AppleScript support seems broken or unreliable (at least on OSX 10.10.1).

For example, this little, very basic script worked in Firefox 33 but now (34?, 35 or 36) NOT anymore:

tell application "Firefox" name of front window end tell

==> error "plugin-container got an error: Can’t get name of window 1." number -1728 from name of window 1


Hint: If you check the output of the next applescript snippet, you see that the 'windows' don't even get a correct id.

tell application "Firefox" windows end tell

The AppleScript support seems broken or unreliable (at least on OSX 10.10.1). For example, this little, very basic script worked in Firefox 33 but now (34?, 35 or 36) NOT anymore: tell application "Firefox" name of front window end tell ==> error "plugin-container got an error: Can’t get name of window 1." number -1728 from name of window 1 Hint: If you check the output of the next applescript snippet, you see that the 'windows' don't even get a correct id. tell application "Firefox" windows end tell

所有回复 (12)

more options

A further hint (tested on firefox version 35 and 36):

In the script, application 'Firefox' gets replaced by 'plugin-container' when compiling the script !!!

more options

Have you contacted the real AppleScript support people ?

more options

Hello Fred,

Where, at Apple or at Firefox?

This is clearly a Firefox issue.

Thank you, Emelin

more options

You are having problems with AppleScript. Are you having problems with anything else? If not, then you should speek to AppleScript support. If you are having other issues, tell us what they are.

more options

Ok Fred, I try again.

1.) Firefox supports AppleScript, at least the very basic functionality. 2.) In Firefox 33 everything works as expected. 3.) I want to get the name of the frontmost window that is open in Firefox. 4.) However, the current Firefox 35 (and devel 36) do not return the name anymore but the error reported above. 5.) This means it should be considered a problem of the newer Firefox versions. 6.) I hinted at the problem by providing my observations that a) the list returned by the 2nd little code snippet I posted would not have ID assigned to the windows as all other OSX applications supporting applescript do; b) the application string "Firefox" in the script is changed to "plugin-container" when the script is compiled by the Apple Script Editor. This replacement did not happen with Firefox 33.

I hope this explains my issue that I cannot get the name of the frontmost window anymore.

By the way, have you ever tried the posted code snippets? Thank you!

Cheers, Emelin

由emelin于修改

more options

I don't know code snippets, but there are others who do.

I've called the big guys to help you. Good luck.

more options

"code snippets" is not an application or editor or the like but should have simply refered to the 'little bits of code' I have posted in my 1st mail.

Please excuse my English.

Thank you Fred, for listening and forwarding! Emelin

more options

Hello again, any hope to get an answer on that issue?

Furhter tests (now on the most recent firefox 35.0.1) show, that as soon as the flash plugin get's activated the firefox applescript interface addresses an application named "plugin-container" instead of the supposed application "Firefox"!

As soon as you deactivate the flash plugin permanently and restart firefox, the above posted scripts do behave normally again and as expected.

Yes, I know, Flash proved many times to be the worst plague ever. Still, I am afraid, this issue has to be solved by firefox.

more options

All that is out of my element. But I can give you this;

Update your Flash Player v16.0.0.296
https://www.adobe.com/products/flashplayer/distribution3.html

This just came out.

more options

Sorry Fred, that has no effect.

I can only repeat that this is a problem of firefox.

Can't anybody react to this quite specific and easily reproduced bug-report of mine whose "element" it actually is?

Thank you!

more options

You may be able to find some insight here, however if they are different bugs, then use these bugs as reference for where/what category to file a new one. (also who to cc ;-))

more options

Thanks for this more helpful reply.

The bugs hinted at are age-old, but still open. Yet, what's reported there is not my problem.

The name of the app is Firefox as one can gather from https://wiki.mozilla.org/Mac:AppleScript and the recent bugs there. However mine is not covered. So, finally, I will file a bug report.