AutoHotkey Community

It is currently May 26th, 2012, 11:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: November 3rd, 2009, 3:49 am 
Offline

Joined: November 3rd, 2009, 3:44 am
Posts: 2
Hi all - this is probably a total noob question, but I cannot figure it out from reading the tutorial. Can someone please review this very simple script and advise how it can be altered such that items in quotes (i.e. "test search text") will pass the quotation marks as well as the search text?

Right now any time I submit an entire search query in quotes or a query that includes a partial items in quotes, nothing is returned.

Quote:
~LControl::
if (A_PriorHotkey <> "~LControl" or A_TimeSincePriorHotkey > 200)
{
; Too much time between presses, so this isn't a double-press.
KeyWait, LControl
return
}
InputBox, UserInput, GoogleSearch, Enter Google Query., , 640, 130
if ErrorLevel
return
else
Run, http://www.google.com/search?q=%UserInput%
return


Thank you!

Jason


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 4:28 am 
Post example of what you are trying to enter in Google.
We can't read you mind.

I entered"string" in the input box and it sent exactly what I typed.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 4:50 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6067
Location: San Diego, California
Anonymous wrote:
Post example of what you are trying to enter in Google.
We can't read you mind.
You obviously can't read his post either. :twisted:
myrison wrote:
Can someone please review this very simple script and advise how it can be altered such that
items in quotes (i.e. "test search text") will pass the quotation marks as well as the search text?

:arrow: myrison, try this script
the hardest part was putting spaces between words;
I found that without "StringReplace" command, the spaces disappear
Code:
InputBox, UserInput, GoogleSearch, Enter Google Query., , 640, 130
if ErrorLevel
return
else
{
msgbox user %UserInput%
StringReplace, OutputVar, UserInput, %a_space% , `%20, 1

msgbox out %OutputVar%
Run, http://www.google.com/search?q= `"%OutputVar%`"
}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 7:47 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Another possibility (untested):

Code:
if InStr(UserInput,Chr(34)) ; Chr(34) is quotation mark
  StringReplace, UserInput, UserInput, % Chr(34), `%22

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 10:54 am 
Offline

Joined: February 8th, 2009, 5:52 pm
Posts: 47
here's my take (i've been using this script for months and it works just fine for me):

Win+G activates the input box.


#g::
send {Ctrl}
inputbox, st,Google Search,,,,95,,,,,weather miami
if ErrorLevel
return
StringReplace, st, st, `", `%22, all
run http://www.google.com/search?q=%st%
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 1:45 pm 
Offline

Joined: November 3rd, 2009, 3:44 am
Posts: 2
Thank you all for the quick replies. (even the one complaining that I was not asking my question clearly) :twisted:

I tested all of them and sinkfaze & lazygeek, yours both work flawlessly. Leef_me - thank you for the response as well, but strangely, your code exhibits the same problems my current code does.

Test query is this:
Quote:
"test search" text outside of quotes

Leef - the first ouput box returns
Quote:
user "test search" outside of quotes
and then the second output box returns
Quote:
out "test%20search"%20outside%20of%20quotes


However, when posted to Google, the variable passed is
Quote:
"test search outside of quotes
It is missing the second quote for some reason.

In any case, please don't feel the need to troubleshoot further as I do have a working solution now.

Thanks again guys for the help. I used to install Google Desktop solely for the ability to use the "double control" keyboard shortcut that would pop up a Google search box. That program comes with a a lot of clutter though just to get the keyboard shortcut. This is MUCH more lightweight and efficient.

Thanks again!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], JSLover, Kirtman, Leef_me, Miguel, XstatyK and 57 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group