Trying to get current Catalina music album cover into a KM variable with applescript...possible?

Hi guys

i used my close to zero apple script knowledge to create this Frankenstein of a script

tell application "Music"
	set myArtwork to every artwork of track 1 of playlist "Music"
end tell

tell application "Keyboard Maestro Engine"
	set variable "myArtworkkm" to myArtwork
end tell

im trying to basically to get the current Catalina music album cover into a KM variable

  1. is this possible at all

  2. if so im getting error in my script, which is of course since i don't know what im doing.. :slight_smile: any tips on the script?

best

Z

KM variables only handle text, so they can't be used for images, but you could use named clipboards. In my testing, this macro that uses this script from Stack Overflow seems to work:

Read Current Music Track's Artwork into Clipboard.kmmacros (3.9 KB)

1 Like

amazing @gglick (..i might add as always :))

last question , im trying to get keyboard maestro to show the output of this in a window (text). I have this setup but it keeps saying no text in clipboard (even though im referring %NamedClipboard%Image Clipboard%)

any clue if its possible to show images in one of the keyboard maestro display text/notifications etc windows?

thx so much again

Z

Yes, but not in the same window. It may not be elegant, but the easiest way to go about this is to use two windows: one for the tokens, and another for the clipboard.

Music.app Now Playing Info.kmmacros (5.5 KB)

1 Like

thx @gglick!!

@peternlewis, is this worth a feature request or technically not possible?

thx guys

Z

For styled text, it is presumably possible to have an image in the text. I'm not sure how practical it is to do, but it is probably not technically impossible.