Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###########################################################
- -->> ABOUT
- ###########################################################
- (*
- Phil Stokes -- 2017
- applehelpwriter.com
- sqwarq.com
- *)
- ###########################################################
- -->> DESCRIPTION
- ###########################################################
- (*
- Tells you what iCloud daemon is doing. If files are pending update or being updated, it will tell you which ones. It will also tell you if the iCloud daemon is either idle or busy / not responding.
- *)
- ###########################################################
- -->> USAGE
- ###########################################################
- (*
- Click 'Run' to execute
- *)
- ###########################################################
- -->> IMPORT STATEMENTS
- ###########################################################
- use AppleScript version "2.4" -- Yosemite (10.10) or later
- use scripting additions
- ###########################################################
- -->> VARIABLES
- ###########################################################
- set d to (current date) as text
- set tempList to {}
- set busyMessage to d & return & "iCloud daemon is busy. Try again in a few moments."
- ###########################################################
- -->> HANDLERS
- ###########################################################
- on iCloudFileNameFor:anItem
- set anItem to anItem as text
- set o to offset of "sz:" in anItem
- set anItem to text o thru -1 of anItem
- set o to offset of " n:" in anItem
- set anItem to text (o + 4) thru -1 of anItem
- set o to offset of "\"" in anItem
- set anItem to text 1 thru (o - 1) of anItem
- return anItem
- end iCloudFileNameFor:
- on errorTrap1()
- try
- set r to do shell script "brctl status | wc -l"
- set ro to r as integer
- if r > 49 then
- return "iCloud is uploading..."
- else
- return "iCloud is not updating."
- end if
- on error
- return my busyMessage
- end try
- end errorTrap1
- ###########################################################
- -->> COMMANDS
- ###########################################################
- set e to 1
- try
- set f to do shell script "brctl status | grep needs-upload"
- set e to 2
- on error
- set e to 3
- end try
- if e = 1 then
- set f to my busyMessage
- else if e = 2 then
- set f to paragraphs of f
- repeat with i from 1 to count of f
- set this_item to item i of f
- set itemName to (my iCloudFileNameFor:this_item)
- set end of tempList to itemName
- end repeat
- set f to tempList
- else
- set f to my errorTrap1()
- end if
- if e = 2 then
- set n to (count of f) as text
- if n > 1 then
- set i to " items "
- else
- set i to " item "
- end if
- set aPrompt to n & i & "pending update:"
- choose from list f with title "iCloud Status" with prompt aPrompt OK button name "Done" with empty selection allowed
- else
- display dialog f with title "iCloud Status" buttons {"OK"} default button "OK"
- end if
- ###########################################################
- #EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement