Tomar texto de una web

Esta sección es para preguntas sobre programación/scripting usando AutoHotkey.

Moderator: Flipeador

Alepaff
Posts: 28
Joined: 17 Feb 2016, 21:03

Tomar texto de una web

17 Mar 2018, 20:09

Alguno sabe como se puede hacer un script para mostrar en una gui, o en un msgbox cierto texto de una web.
Mi idea es hacer una especie de diccionario, pero solo tomando las definiciones de Google

Esta definicion por ejemplo
Image


Para eso escribes en una caja de texto y dentro de la misma te da la definicion que dá Google, similar a este script...
Spoiler



De esa manera, u otra idea es que muestre solo una parte de la web

Code: Select all

Gui, Add, ActiveX, xm w580 h540 vWB, Shell.Explorer
WB.Navigate("https://www.google.com.ar/search?q=define+programar") 
Gui, Show
return

GuiClose:
ExitApp
Aunque en este ultimo es muy incomodo de ver...


Y este otro un texto en especifico de una web html

Code: Select all

#SingleInstance, Force

; Creates an Internet Explore COM object
ie  := ComObjCreate("InternetExplorer.Application")

; Navigate to a website
; In this example, I've used this post's address
ie.navigate("https://redd.it/652noa")

; This ensures the webpage completely loads before doing anything else
while ie.ReadyState != 4
    Sleep, 100

; Shows the actual internet explorer window
ie.visible  := true

; By looking up the element that contains your votes in the html, I see it's in a span with a class name of "number".
; getElementByClassName() returns a node list. It's like an array.
; [0] is the first item in the node list.
; innertext is the actual value of the span tag.
; This is saved to the numVotes variable
numVotes    := ie.document.getElementsByClassName("number")[0].innerText

MsgBox, % "Your post has " numVotes " points."

; Quits out of the application.
; Always inclue a quit or you'll have leftover executables running in the background.
; See picture attached to bottom of this post.
ie.quit

ExitApp


Gracias de antemano

Return to “Pedir Ayuda”

Who is online

Users browsing this forum: No registered users and 18 guests