Script Not Working As Expected for Google Search

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
crown

Script Not Working As Expected for Google Search

22 Sep 2021, 14:27

AutoHotkey Version [1.1.33.10]

Hi Guys. I'll start by saying I know only what I have read in help, (AutoHotkey help), concerning scripting. I found a script I thought would work with AutoHotkey. It does not work as expected. I'm on Windows 10 Pro and Version 1.1.33.10 of AutoHotkey.

I was hoping the script would place highlighted text, I assume from my clipboard, into a Google search engine, then return the results from Google onscreen, (when I press the windows key plus the letter "s" as noted in the first line of the script). I had some screen shots. I do not see a place to attach them here. I'll try and explain what the script ACTUALLY does.

When pressing the windows+s keys, IF my highlighted text is on a page that is open in a web browser, or say notepad, the windows+s key will open a Google search page using my default Chrome browser. I wanted it to simply return the search results of the highlighted text. In this example, it only opens a google search page but no results. The intended use for the win+s key is NOT to be used in the above stated manor. I was just testing the script.

Here is where I need the rubber to meet the road. I use a windows based file management software called "KJ File Manager". When I double click an entry in the data base, I need to be able to highlight any editable field, press the win+s keys, and have the result returned in Google, onscreen. What is happening here is when pressing the win+s keys on any said highlighted field, all I get is some windows cortina apps etc screen.

Here is the script:

Code: Select all

#s::
MyClip := ClipboardAll
clipboard = ; empty the clipboard
Send, ^c
ClipWait 
Run http://www.google.com/#hl=en&q=%clipboard%
Clipboard := MyClip
[Mod edit: [code][/code] tags added.]

I am trying something very new to me here. I am OBVIUSLY NOT a programmer. Please be kind. Any helpful solution to my desired outcome would be appreciated. If one has a script that would work, as I have described, please feel free to share it with me and perhaps others that may need this functionality.

Thank you all, in advance, for your time and consideration. I look forward to your response(s).

Kind Regards,

crown37087
Last edited by gregster on 22 Sep 2021, 14:56, edited 1 time in total.
Reason: Topic moved from 'Offtopic'.
User avatar
mikeyww
Posts: 26880
Joined: 09 Sep 2014, 18:38

Re: Script Not Working As Expected for Google Search

22 Sep 2021, 15:03

Code: Select all

#s::
Clipboard =
Send ^c
ClipWait, 0
If ErrorLevel
 MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Else Run, https://www.google.com/search?q=%Clipboard%
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, dipahk, Nerafius, RandomBoy, Stpham and 110 guests