Jump to content

Show Music lyrics


Recommended Posts

I have two Shortcuts that I frequently use to see the lyrics of the current playing track. The first one toggles the Music miniplayer showing the lyrics and the other one shows up the lyrics on the main Music window. I'm trying to convert these shortcuts to alfred workflows but I don't know what am I missing. The workflow structure is Keyword as Input and then Run Script. The codes I'm using are:

 

1) Show Lyrics on Music miniplayer 

on run {input, parameters}
	tell application "System Events"
		delay 0.5
		keystroke "m" using {command down, shift down}
	end tell
	return input
end run

 

2) Show Lyrics on main Music window

on run {input, parameters}
	tell application "System Events"
		delay 0.5
		keystroke "u" using {command down, control down}
	end tell
	return input
end run

 

As Shortcuts these codes are working fine, but not as workflows. What am I missing? Can anyone help?

 

Edited by Danilo
Link to comment
  • Danilo changed the title to Show Music lyrics
On 7/5/2022 at 2:17 PM, vitor said:

I don’t use Music and you’re faking key presses, so I don’t know what the result is supposed to be to test. Without you sharing the Workflow I can’t even tell what input is supposed to be or why there’s parameters.


Doesn’t seem like you need any code for it. Try making the same with a Delay Utility and Dispatch Key Combo Output.

 

Take a look ate these two shortcuts:

https://www.icloud.com/shortcuts/20a3dd5a728041ea85ba93de399d9f04

https://www.icloud.com/shortcuts/05e5d4172cbe47c586de77c5b2c14a46

 

Since Alfred runs AppleScripts much master than Shortcuts.app, I just wanted to "convert" these shortcuts into workflows. I tried to create the Workflow using Keyword as Input than I used the Run Script action. 

https://www.dropbox.com/s/tnue4ex4zmx6rxo/Apple Music.alfredworkflow?dl=0

 

 

Link to comment

Again, it doesn’t seem like you need AppleScript at all. You’re just waiting then sending a keypress, use the objects linked above. The code is doing to much given the inputs and outputs. Looks like you could just be:

 

delay 0.5
tell application "System Events" to keystroke "u" using {command down, control down}

 

Link to comment
1 hour ago, vitor said:

Again, it doesn’t seem like you need AppleScript at all. You’re just waiting then sending a keypress, use the objects linked above. The code is doing to much given the inputs and outputs. Looks like you could just be:

 

delay 0.5
tell application "System Events" to keystroke "u" using {command down, control down}

 

 

Just got it to work. Thank you again @vitor and sorry for asking again and again, I'm a newby to coding and just started using Alfred.

 

Here's the Workflow if it interest to anyone. 

 

https://www.dropbox.com/s/nkq0ini27slp5o7/Apple Music Lyrics.alfredworkflow?dl=0

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...