AppleScript - Safari 帮助
我被指定创建一个应用程序,该应用程序必须
- 在网页完成加载时
显示一个对话框,内容为“网页已完成加载。”
确定当前有多少项目正在下载
对于数字 1 ,我尝试过如果前面的URL文档是“http://applescript.weebly.com”then
,但是即使网页未加载,then
部分也始终运行!
对于第二个,我已经尝试过这个...
tell application "Safari" to get every item of window "Downloads"
但这会返回对每个项目的引用,甚至是那些已经下载的项目!
结论:我需要帮助。 :S
I've been appointed the task of creating an applicaton that must
Display a dialog saying
"The webpage has finished loading."
when a webpage finishes loadingDetermine how many items are currently in the process of downloading
For number 1, I've tried doing if the URL of the front document is "http://applescript.weebly.com" then
, but the then
part always runs even if the webpage doesn't load!
For number 2, I've tried this...
tell application "Safari" to get every item of window "Downloads"
But this returns references to every item, even the ones that havae already been downloaded!
Conclusion: I need help. :S
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
仅使用纯 AppleScript 是无法做到这一点的。但是,您可以结合使用 AppleScript 和 javascript...
警告:如果网页由于某种原因无法加载,脚本将永远陷入无限重复循环中。
当您下载文件时,它们会暂时被赋予名称扩展名
download
,因此 AppleScript 可以告诉 Finder 获取具有该扩展名的文件并创建警报/对话框:P.S. Thanks for honoring my web site!
There is no way to do this with just pure AppleScript. However, you can use a combination of AppleScript and javascript...
WARNING: If the webpage doesn't load for some reason, the script will be stuck forever in an infinite repeat loop.
When you download files, they are temporarily given the name extension
download
, so AppleScript can tell the Finder to get the files with that extension and create an alert/dialog:P.S. Thanks for honoring my web site!
我在 AppleScript 编辑器中编写了下面的脚本来打开浏览器,在 URL 中显示我的 ISP,完成登录过程并连接到互联网。工作完美。我想添加或修改它以每小时左右 ping “www.google.com”,如果我的连接断开,则再次重复下面的过程,这会将我的计算机连接回互联网。
我刚刚学习这个脚本编写的东西,还没有很好地理解它是如何工作的,所以如果有人可以帮助,请用简单的术语为我解释它。非常感谢。
告诉应用程序“Safari”
结束告诉
I wrote the script below in AppleScript Editor to open my browser, display my ISP in the URL, go through the login process and connect to the internet. Is working perfectly. I want to add or modify it to ping "www.google.com" every hour or so, and if my connection has dropped to repeat the process below again, which will connect my computer back to the internet.
I'm just learning this script writing thing and don't have a very good undersatnding of how it works yet, so if anyone can help please expalin it in simple terms for me. Very much appreciated.
tell application "Safari"
end tell