Jump to content

Copy string, url and keyword to clipboard


Recommended Posts

Posted (edited)

Hi :)

 

So I've been trying to work this out for a while, but I think I might have to admit defeat and ask for help :D

 

Essentially, what I'd like to do is the following:

 

Enter a search term (let's say James Cameron for example)

Have Alfred open IMDB in Chrome using the following to get to Cameron's page:  

http://www.google.com/search?q=imdb.com/{query}&btnI=745

The above I can already do, what I'd then like is:

 

Copy the above url and the initial keyword to the clipboard with the following formatting:

<a href="URL">KEYWORD</a>

Essentially I do a lot of posting daily in the above format, and am always looking for ways to make my life easier :)

 

 

The best I've been able to manage to do is generate the following:   <a href="">KEYWORD</a>, so basically everything aside from the url.   I can't work out how to pass multiple [query]'s I guess.

 

Any help would be awesome!

 

Thanks

Edited by simonk83
Posted

Hi :)

 

So I've been trying to work this out for a while, but I think I might have to admit defeat and ask for help :D

 

Essentially, what I'd like to do is the following:

 

Enter a search term (let's say James Cameron for example)

Have Alfred open IMDB in Chrome using the following to get to Cameron's page:  

http://www.google.com/search?q=imdb.com/{query}&btnI=745

The above I can already do, what I'd then like is:

 

Copy the above url and the initial keyword to the clipboard with the following formatting:

<a href="URL">KEYWORD</a>

Essentially I do a lot of posting daily in the above format, and am always looking for ways to make my life easier :)

 

 

Have you had a look at snippets?

 

If you're copying the URL to your clipboard, you could create a snippet with dynamic content (http://support.alfredapp.com/kb:using-dynamic-placeholders-in-snippets)

 

<a href="{clipboard}">KEYWORD</a>

 

Assuming your latest copied item is the URL, you would get everything filled in except the keyword, which you would then need to add manually.

 

Beyond this, you could also look at creating a workflow where a script parses your content and pastes to clipboard the format you need :)

Posted (edited)

Have you had a look at snippets?

 

If you're copying the URL to your clipboard, you could create a snippet with dynamic content (http://support.alfredapp.com/kb:using-dynamic-placeholders-in-snippets)

 

<a href="{clipboard}">KEYWORD</a>

 

Assuming your latest copied item is the URL, you would get everything filled in except the keyword, which you would then need to add manually.

 

Beyond this, you could also look at creating a workflow where a script parses your content and pastes to clipboard the format you need :)

 

 

 

 

Hmm, well as far as snippets go, that sounds good but it's probably going to be a pain, as I'll need several steps first to load the url, then another to grab the url, and then as you said I'm stuck with the missing keyword.

 

The workflow sounds better but I'm going to need an example if you don't mind, I'm a novice user it seems and am not great with scripts   :D

 

Thanks!

Edited by simonk83
Posted (edited)

Right, managed to get something working :)

 

I basically have:

 

Keyword --->  Open URL (using http://www.google.com/search?q=imdb.com/{query}&btnI=745, which gets the IMDB page of the guy you enter) ---> Run Script

 

The script (applescript) is:

delay 3
tell application "Google Chrome"
  activate
          set theURL to URL of active tab of first window
  set the clipboard to  "<a href=\"" & theURL & "\">{query}</a>" as string
end tell

I had to add the delay to give the url time to properly resolve.

 

Probably a terrible way to do it, but it works for now :D

Edited by simonk83

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...