我的系统拒绝使用 NSAppleScript 类关闭/重新启动

发布于 2025-01-03 21:03:06 字数 942 浏览 4 评论 0原文

我在 10.5 上使用 CFPlugin 作为上下文菜单和图标覆盖(与 scplugin 相同)。对于我的应用程序和 finder 之间的通信,我使用分布式对象。在上下文菜单项文件夹中安装我的插件后,我的系统拒绝重新启动/关闭/注销。在活动监视器中,我无法退出查找器,只有强制退出才可以查找查找器。 在控制台上,我进入 10.5.8

ERROR | -[ApplicationManager(AppleEventHandling) _tryQuitAllForRequestor:replyEvent:] | _tryQuitAllForRequestor - _vproc_set_global_on_demand returned error -1805620379  

如果 Finder 和我的应用程序之间没有通信,系统重新启动/关闭/注销工作正常。
关于 10.5.4

loginwindow[41]: ERROR | WSActivateApp | SetFrontProcess({0, 7980956}) returned error -600. Unable to activate process.

loginwindow[41]: ERROR | -[ApplicationManager(AppleEventHandling) _tryQuitAllForRequestor:replyEvent:] | _tryQuitAllForRequestor - _vproc_set_global_on_demand returned error -1780878507

有人能帮我吗?

编辑

我的问题已经解决了。我使用 NSAppleScript 来执行苹果脚本。现在我正在使用 NSTask 并且我的系统重新启动/关闭/注销工作正常。谁能解释一下原因吗?

I am using CFPlugin for contextual menu and icon overlay on 10.5(same as scplugin). For communication between my application and finder , i am using distributed object. After installing my plugin inside Contextual menu items folder , my system refuse to restart/shutdow/Logout. In activity monitor i am unable to quit finder , only force quit is woking for finder.
On console I am getting on 10.5.8

ERROR | -[ApplicationManager(AppleEventHandling) _tryQuitAllForRequestor:replyEvent:] | _tryQuitAllForRequestor - _vproc_set_global_on_demand returned error -1805620379  

Without communication between Finder and my application, system restart/shutdow/Logout are working fine.
On 10.5.4

loginwindow[41]: ERROR | WSActivateApp | SetFrontProcess({0, 7980956}) returned error -600. Unable to activate process.

loginwindow[41]: ERROR | -[ApplicationManager(AppleEventHandling) _tryQuitAllForRequestor:replyEvent:] | _tryQuitAllForRequestor - _vproc_set_global_on_demand returned error -1780878507

Can anyone please help me out?

EDIT

My problem is solved. I was using NSAppleScript for executing apple script. Now i am using NSTask and my system restart/shutdow/Logout are working fine. can anyone please explain me reason for this?

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

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

发布评论

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

评论(2

挽清梦 2025-01-10 21:03:06

NSAppleScript 只能从主线程运行,因此主线程在运行时将被阻塞。

不太确定该消息的根本原因是什么,但我假设脚本无法找到或正常运行,然后主线程被阻塞或超时,并且所有关闭序列都被卡住。

另一方面,NSTask 是正确的多线程,因此序列不会被阻止,并且您的计算机将正确关闭。

以下是一些相关链接:

NSAppleScript can only be run from the main thread, so the main thread is going to be blocked while it is running.

Not too sure what is the root cause of the message, but I am supposing the script can not be found or run properly, and then the main thread is blocked or timed out, and all your shutdown sequence gets stuck.

On the opposite side, NSTask is properly multithreaded so the sequence won't be blocked, and your computer will properly shutdown.

Here are a few relevant links gathered around:

锦上情书 2025-01-10 21:03:06

我的问题解决了。我使用 NSAppleScript 来执行苹果脚本。现在我正在使用 NSTask 并且我的系统重新启动/关闭/注销工作正常

My problem is solved. I was using NSAppleScript for executing apple script. Now i am using NSTask and my system restart/shutdow/Logout are working fine

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