Advertisement
uknwwho

Selected text search

Feb 2nd, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;-------------------------------------------------------------------------------
  2. ; SEARCH SELECTED TEXT IN GOOGLE
  3. ;-------------------------------------------------------------------------------
  4.  
  5. Capslock & g::          ; <-- Google Web Search Using Highlighted Text
  6.    Search := 1
  7.    Gosub Google
  8. return
  9.  
  10. Capslock & y::          ; <-- Youtube Search Using Highlighted TexT
  11.    Search := 2
  12.    Gosub Google
  13. return
  14.  
  15. Capslock & t::          ; <-- Translate Using Highlighted Text
  16.    Search := 3
  17.    Gosub Google
  18. return
  19.  
  20. Capslock & m::          ; <-- Maps Search Using Highlighted Text
  21.    Search := 4
  22.    Gosub Google
  23. return
  24.  
  25. Google:
  26.   Save_Clipboard := ClipboardAll
  27.    Clipboard := ""
  28.    Send ^c
  29.    ClipWait, .5
  30.    if !ErrorLevel
  31.       Query := Clipboard
  32.    else
  33.       InputBox, Query, Google Search, , , 200, 100, , , , , %Query%
  34.    Query := UriEncode(Trim(Query))
  35.    if (Search = 1)
  36.       Address := "http://www.google.com/search?hl=en&q=" Query          ; Web Search
  37.    else if (Search = 2)
  38.       Address := "https://www.youtube.com/results?search_query=" Query      ; YT Search
  39.    else if (Search = 3)
  40.       Address := "https://translate.google.com/#auto/en/" Query         ; Translate
  41.    else
  42.       Address := "https://www.google.com/maps/search/" Query            ; Maps Search
  43.      
  44.       Run, chrome.exe %Address%  ; Change this if require different browser search
  45.    Clipboard := Save_Clipboard
  46.    Save_Clipboard := ""
  47. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement