Отображение диалогового окна с сообщением "The webpage has finished loading."
, когда веб-страница завершает загрузку.
Нет способа сделать это только с помощью чистого AppleScript.Однако вы можете использовать комбинацию AppleScript и javascript ...
tell application "Safari"
repeat until (do JavaScript "document.readyState" in document 1) is "complete"
end repeat
display dialog "The webpage has finished loading."
end tell
ПРЕДУПРЕЖДЕНИЕ: Если веб-страница по какой-либо причине не загружается, сценарий навсегда застрянет вбесконечный цикл повтора.
Определите, сколько элементов в данный момент находится в процессе загрузки.
При загрузке файлов им временно присваивается расширение имени download
, поэтому AppleScript может сказать Finder, чтобы он получил файлы с этим расширением и создал предупреждение / диалог:
set the download_count to 0
set the download_folder to (path to downloads folder) as alias --or wherever the items are being downloaded
tell application "Finder" to set the download_count to the count of (every item of the download_folder whose name extension is "download")
if the download_count is 0 then
display dialog "There are currently no downloads in progress."
else if the download_count is 1 then
display dialog "There is currently one download in progress."
else
display dialog "There are currently " & the download_count & " downloads in progress."
end if
PS Спасибо за честь моего веб-сайта!