I have a script that shows “Sync Folder Local Backups Completed” and then times out after 3 seconds, but, is there any way to completely do away with the Cancel and OK buttons? And if possible, how would I center the text?
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
display dialog "Sync Folder Local Backups Completed" giving up after 3
All dialogs have to have at least one button.
Try this…
display alert "Sync Folder Local Backups Completed" giving up after 3
Here are some alternatives I’ve used…
set theMessage to "Sync Folder Local Backups Completed"
--display dialog
set buttonList to {""}
set DialogReply to display dialog theMessage ¬
with title theMessage ¬
buttons buttonList ¬
giving up after 3
--display alert
set buttonList to {" "}
set resultAlertreply to display alert theMessage ¬
message theMessage ¬
buttons buttonList ¬
giving up after 3
--display notification
display notification theMessage ¬
with title theMessage
--Display Progress
repeat with x from 1 to 3
set progress total steps to 3
set progress completed steps to x
set progress description to theMessage
delay 1
end repeat
You would have more control with DialogToolKit Plus, but still need at least one button.
[post removed by alastor933]
Do you know “display notification” command?
display notification "Sync Folder Local Backups Completed"
After posting last night, my thought was that possibly I should have also said that I’m looking to basically duplicate a Notifications type of dialog. You read my mind, thank you, works just like I envisioned it.
A display notification dialog seems the best solution.
FWIW, the swiftDialog app will also do what Homer712 wants and is highly configurable including the location of the text message. Because no buttons are active, you have to wait the specified number of seconds for the dialog to disappear. If there is no timer argument, a force-quit and possibly a reboot is required.
--this script requires the free swiftDialog app
--https://github.com/swiftDialog/swiftDialog
do shell script "/usr/local/bin/dialog --title 'Test Title' --titlefont 'size=15' --message 'This dialog will close after 3 seconds' --messagefont 'size=14' --button1text none --width 350 --height 130 --hideicon --timer 3 --hidetimerbar; echo $?"
Seem to have run into an issue I can’t figure out. Although the script runs fine from Script Debugger, I can’t get it to run when included in the AppleScript that’s included in Automator (see below screenshot).
The Run Shell Script does all the rsync routines that do the actual backup. The Run AppleScript does the pruning of files in the Archive folders that are over 90 days old. The entire script, including the Notification display part is posted below. I also tried putting the Notification display in its own separate Run AppleScript, but that didn’t work either. Any help would be appreciated. Thank you.
tell application "Finder"
try
set theFolderAlias to alias "Volumes:Mac Mini Local Backups:Sync Folders Local Backups:Local Documents Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
set theFolderAlias to alias "Volumes:Mac Mini Local Backups:Sync Folders Local Backups:Local Dropbox Folders Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
set theFolderAlias to alias "Volumes:Mac Mini Local Backups:Sync Folders Local Backups:Local Installs Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
set theFolderAlias to alias "Volumes:Mac Mini Local Backups:Sync Folders Local Backups:Local Movies Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
set theFolderAlias to alias "Volumes:Mac Mini Local Backups:Sync Folders Local Backups:Local Music Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
set theFolderAlias to alias "Volumes:Mac Mini Local Backups:Sync Folders Local Backups:Local Photos Archive Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
set theFolderAlias to alias "Volumes:Mac Mini Local Backups:Sync Folders Local Backups:Local Pictures Archive:"
delete (get items of theFolderAlias whose creation date < ((current date) - 90 * days))
end try
end tell
delay 3
tell application "Finder"
empty trash
end tell
display notification "Sync Folders Local Backups Completed"
No sooner did I post the issue, and I’ve figured it out. Changed the display Notification part at the very end to the below, and now it works.
tell application "Finder"
display notification "Sync Folders Local Backups Completed"
end tell
Nope:
display dialog " Are you OK?" buttons {"I'm OK"} default button 1