모든 애플리케이션에서 강조 표시된 텍스트에 대한 Google 검색의 첫 번째 URL을 받으세요.

모든 애플리케이션에서 강조 표시된 텍스트에 대한 Google 검색의 첫 번째 URL을 받으세요.

Google에서 강조 표시된 텍스트의 첫 번째 URL을 얻는 방법이 있습니까? 모바일에는 키보드 통합 검색이 있지만 데스크톱에는 없는 것과 같습니다.

이는 Wikipedia 주제나 stackoverflow 등의 소프트웨어 웹사이트에 연결하고 싶을 때 특히 유용합니다.

답변1

방금 간단한 방법을 만들었습니다. 최고는 아니지만 지금은 나에게 충분히 잘 작동합니다. 지금은 유연성을 원했기 때문에 stackoverflow의 형식과 일치하도록 사용자 정의하지 않았습니다. 나중에 github에 올릴 예정입니다. 아마도 실제로 작동하려면 더 나아질 필요가 있을 것입니다.

다음을 Googlesearch.ahk로 저장하고 다음을 사용하여 실행합니다.자동핫키

; Search google for the highlighted word
; then get the first link address and put it on the Clipboard

^!r:: Reload

#+g::
    bak = %clipboard%
    Send, ^c
    ;clipboard = %bak%`r`n%clipboard%
    Query = %clipboard%
    wb := ComObjCreate("InternetExplorer.Application")
    ;wb := IEGet()
    wb.Visible := false
    wb.Navigate("www.google.com/search?q=" Query)
    While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy ; wait for the page to load
      sleep 100
    ; loop % (Nodes := wb.document.getElementById("rso").childNodes).length
    ;     Links_urls .= (A_index = 1) ? Nodes[A_index-1].getElementsByTagName("a")[0].href : "`n" . Nodes[A_index-1].getElementsByTagName("a")[0].href
    ; Msgbox %Links_urls%

    Nodes := wb.document.getElementById("rso").childNodes
    First_link := Nodes[0].getElementsByTagName("a")[0].href
    Clipboard = %First_link%
    TrayTip, First Link on Google Search, %First_link% `r`n Ctrl+V to paste the link
return

관련 정보