什么是“退出”?处理程序用于?

发布于 2024-11-19 01:01:17 字数 125 浏览 1 评论 0原文

我知道所有基本处理程序,即运行打开重新打开。但是这个处理程序,on quit,让我感到困惑。我的问题是,它有什么用以及如何触发?

I know all of the basic handlers, i.e. on run, on open, and on reopen. But this handler, on quit, confuses me. My questions are, what is it used for and how is it triggered?

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

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

发布评论

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

评论(2

眼波传意 2024-11-26 01:01:17

on quit 用于已保存为独立应用程序的脚本。用户可以使用其菜单退出此类脚本。当用户退出脚本时,quit 处理程序就会运行,并且可以弹出一个确认对话框,询问他们是否确定确实要退出,或者清理它创建的任何临时文件等。脚本在结束之前需要做的事情。当您完成想做的事情后,继续退出以实际允许脚本退出。

通常与空闲处理程序一起使用,因为具有此类处理程序的脚本可以长时间保持打开状态,并且用户可能需要某种方式退出它们。

on quit is used in scripts that have been saved as a standalone application. The user can quit such a script using its menus. A quit handler runs when the user quits the script, and can put up a confirmation dialog asking if they are sure they really want to quit, or clean up any temporary files it created, etc. -- anything the script needs to do before it ends. When you have finished doing whatever it is you want to do, continue quit to actually allow the script to exit.

Often used with an on idle handler, as scripts with such a handler can stay open for long periods of time and the user may need some way to exit them.

骑趴 2024-11-26 01:01:17

on quit 是一个允许您在退出时执行某些操作的函数。要触发它,只需使用quit即可。例如,如果我想对用户说“感谢您尝试这个!”然后我会这样做:

--lots of code, blah blah
quit

on quit
display dialog "Thanks for trying this!" buttons {"Continue"}
continue quit
end

这会显示一个对话框,然后它会继续退出。但是,如果我想取消退出,我会删除 continue quit 行。

希望这应该是有道理的。

on quit is a function that allows you to do something on quit. To trigger it, simply use quit. For example, if I wanted to say to the user "Thanks for trying this!" then I'd do this:

--lots of code, blah blah
quit

on quit
display dialog "Thanks for trying this!" buttons {"Continue"}
continue quit
end

Which would display a dialog, then it would continue quitting. But, if I wanted to cancel quit, I'd remove the continue quit line.

Hopefully this should make sense.

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