Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacNoob444

macrumors newbie
Original poster
Sep 16, 2014
9
0
I would like to do this with one short command is it possible? Or have i misunderstood automator?

In chrome: highlight a text on a web site > pressing a hotkey e.g. cmd+shift+d > copy to clipboard > open spotify > focus on search with cmd+l (real spotify hotkey) > paste from clipboard> enter press.
(this will search for the text that is highlighted)

Then, not in the same command.

Hoover or clicking on the song: pressing hotkey e.g cmd+shift+d> right click> arrow down> arrow down> enter press.
(this will save the song to "my songs")


If possible, will there be a conflict between using the same hotkeys? Or can you set it not to be global, so it only affects the active window?

I´ve tried Better touch tool but it do NOT work well with spotify. It works sometimes, like 1/5, the other 4 something completely different happens. The thing is that there is a thread in a forum with really good music on it and i would like to have it on spotify. The link is mostly links to youtube, either dead links or the quality is bad. But the text is like this Adam Beyer - Lovecraft so it is copyable.

Or is there another way of doing this, another program or so? Anything that will help me would be really appreciated.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,559
6,059
An alternative to your first idea:

Write a Chrome plugin that adds in a new keyboard shortcut and/or context menu item. When Your plugin is triggered through either means, it somehow converts it to a Spotify URI and uses that to open Spotify.

I don't know all the details because I've never made a Chrome plugin or looked into Spotify's developer stuff, but I'm pretty sure it's possible.

Chrome Plugins would be written in JavaScript, I think.
 

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
Here's an example that uses Safari for the first part of your request.

Create a Service in Automator.

  1. Service receives selected text in Chrome in your case.
  2. Run AppleScript action with the following :

    Code:
    on run {input, parameters}
    	
    	set the clipboard to first item of input
    	
    	tell application "Spotify"
    		reopen
    		activate
    	end tell
    	
    	delay 0.5
    	
    	if frontmost of application "Spotify" is true then
    		tell application "System Events"
    			tell process "Spotify"
    				keystroke "f" using {option down, command down}
    				keystroke "v" using command down
    				delay 1
    				key code 36
    			end tell
    		end tell
    	end if
    	--return input
    end run
  3. Save your Service
  4. Assign a shortcut e.g. cmd+shift+d to your Service
 

Attachments

  • Screen Shot 2014-09-30 at 05.35.35.png
    Screen Shot 2014-09-30 at 05.35.35.png
    143.6 KB · Views: 221
  • Screen Shot 2014-09-30 at 05.46.03.png
    Screen Shot 2014-09-30 at 05.46.03.png
    51.4 KB · Views: 185
  • SpotifySearch.zip
    1.6 MB · Views: 85

MacNoob444

macrumors newbie
Original poster
Sep 16, 2014
9
0
Here's an example that uses Safari for the first part of your request.

Create a Service in Automator.

  1. Service receives selected text in Chrome in your case.
  2. Run AppleScript action with the following :

    Code:
    on run {input, parameters}
    	
    	set the clipboard to first item of input
    	
    	tell application "Spotify"
    		reopen
    		activate
    	end tell
    	
    	delay 0.5
    	
    	if frontmost of application "Spotify" is true then
    		tell application "System Events"
    			tell process "Spotify"
    				keystroke "f" using {option down, command down}
    				keystroke "v" using command down
    				delay 1
    				key code 36
    			end tell
    		end tell
    	end if
    	--return input
    end run
  3. Save your Service
  4. Assign a shortcut e.g. cmd+shift+d to your Service


WOW thanks ALOT! Worked really good! Do you know if its possible to do the other thing I asked in automator or something similar. I don´t ask you to do it, only if its possible, you done enough for me:D Thanks again!
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.