Hi there,
would it be possible to have a progress bar on the Dock icon of an Enhanced Applet/Droplet?
Hi there,
would it be possible to have a progress bar on the Dock icon of an Enhanced Applet/Droplet?
Yes, it is possible. Can you read this?
http://piyocast.com/as/archives/15530
docIconProgress.app.zip (4.0 MB)
Thanks alot for the link. I can read it. But the script give’s me an error. There is no |size| for myRect:
|size| of {{4.0, 8.0}, {120.0, 12.8}}
Your download works well, but I can’t open it in ScriptDebugger, because the applet is run-only.
I could change the script so that it works for me.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
on run
set max to 100
repeat with num from 1 to max
my progresOnDockIcon(max, num)
delay 0.1
end repeat
-- Reset Dock icon
current application's NSApp's setApplicationIconImage:(current application's NSImage's imageNamed:"NSApplicationIcon")
end run
on progresOnDockIcon(max, current)
set appIcon to current application's NSImage's imageNamed:"NSApplicationIcon"
set iconSize to appIcon's |size|()
tell (current application's NSImage's alloc()'s initWithSize:iconSize)
lockFocus()
appIcon's dissolveToPoint:(current application's NSZeroPoint) fraction:1.0
set n to (iconSize's width) / 16
set myRect to current application's NSMakeRect(n / 2, n, n * 15, n * 2.6)
set myRectWidth to item 1 of item 2 of myRect
set myRectHeight to item 2 of item 2 of myRect
tell (current application's NSBezierPath's ¬
bezierPathWithRoundedRect:myRect ¬
xRadius:(myRectHeight) / 2 ¬
yRadius:(myRectHeight) / 2)
current application's (NSColor's colorWithWhite:1.0 alpha:0.4)'s |set|()
fill()
current application's NSColor's whiteColor()'s |set|()
stroke()
end tell
if current is greater than 0 then
if current is greater than max then set current to max
set item 1 of item 2 of myRect to (myRectWidth) / max * current
tell (current application's NSBezierPath's ¬
bezierPathWithRoundedRect:myRect ¬
xRadius:(myRectHeight) / 2 ¬
yRadius:(myRectHeight) / 2)
set strartColor to current application's NSColor's colorWithRed:0.15 green:0.55 blue:1 alpha:0.8
set endColor to strartColor's shadowWithLevel:0.7
set grad to current application's NSGradient's alloc()'s initWithStartingColor:strartColor endingColor:endColor
grad's drawInBezierPath:it angle:270.0
end tell
end if
unlockFocus()
current application's NSApp's setApplicationIconImage:it
end tell
return (current + 1)
end progresOnDockIcon
The link I wrote was rewritten for macOS Ventura. The current linked article is version 3.
Thanks for the update.