+ (Plus) sign separator instead %20

Sharing and discussing custom search templates for LaunchBar
dfarfan
Posts: 7
Joined: Tue Mar 29, 2011 5:03 pm

+ (Plus) sign separator instead %20

Postby dfarfan » Tue Mar 29, 2011 5:09 pm

Hi,

I want to implement search templates using the + (plus) sign to separate arguments instead of the default %20:

An example:

Code: Select all

http://www.metacritic.com/search/movie/black%20swan/results
This don't give the results i want

Code: Select all

http://www.metacritic.com/search/movie/black+swan/results
This gives the result i want

Both * and %s uses the %20 separator.

Any way to replace the %20 with a + sign?

Thanks in advance.
Last edited by dfarfan on Tue Mar 29, 2011 6:59 pm, edited 1 time in total.

manfred
Objective Development
Objective Development
Posts: 562
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: + (Plus) sign separator instead %20

Postby manfred » Tue Mar 29, 2011 6:08 pm

Unfortunately it is not possible to change the separator at the moment. I forwarded your suggestion to the responsible developer.

In the meanwhile, a possible workaround is to create an Apple Script and use InstantSend or the Enter Text functionality of LaunchBar.
An example how the Apple Script could look like:

Code: Select all

on handle_string(searchQuery)
   
   set _url to "http://www.metacritic.com/search/movie/" & ReplaceBlanks(searchQuery) & "/results"
   open location _url
   
end handle_string


on ReplaceBlanks(theString)
   set current_Delimiters to text item delimiters of AppleScript
   set AppleScript's text item delimiters to " "
   set sList to every text item of theString
   set AppleScript's text item delimiters to "+"
   set newString to sList as string
   set AppleScript's text item delimiters to current_Delimiters
   return newString
end ReplaceBlanks

dfarfan
Posts: 7
Joined: Tue Mar 29, 2011 5:03 pm

Re: + (Plus) sign separator instead %20

Postby dfarfan » Tue Mar 29, 2011 6:58 pm

Thank you very much for the quick response. I'll give a try to your script.

I hope this will get implemented soon (maybe * for %20, and %s for +)

manfred
Objective Development
Objective Development
Posts: 562
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: + (Plus) sign separator instead %20

Postby manfred » Wed Mar 30, 2011 11:32 am

After some research I found a better solution :)
It is a little bit tricky to create the search string, but you do not need the plus separator at all!

This search string works:

Code: Select all

post-http://www.metacritic.com/search?search_filter=movie&search_term=*

dfarfan
Posts: 7
Joined: Tue Mar 29, 2011 5:03 pm

Re: + (Plus) sign separator instead %20

Postby dfarfan » Wed Mar 30, 2011 6:30 pm

Thank you very much, it's works on Metacritic, but that was an example, there are many sites that uses + instead of %20, and not all sites support POSTing the request.

Anyway, great solution!

dashard
Posts: 1
Joined: Sat Jan 31, 2015 2:38 am

Re: + (Plus) sign separator instead %20

Postby dashard » Sat Jan 31, 2015 2:44 am

The last reply to this query was almost 4 years ago, and the solution of using "post-http://..." no longer seems to work:

LaunchBar can’t open “post-http://www.rottentomatoes.com/m/xxxxxxx” because Internet addresses starting with “post-http:” are not recognized by OS X.


Any other ideas? Seems like some sort of prefix or flag for the wildcard (as suggested in a previous comment) would do the trick nicely.

FWIW, ! would actually go for *+* as a wildcard indicating a + sign, and *-* indicating a dash, etc. Simple solitary * would behave as always, with the escaped space character.


Return to “LaunchBar Search Templates”

Who is online

Users browsing this forum: No registered users and 2 guests