1

Тема: AHK: GUI_Shell.Explorer

Добрый день! Подскажите, пож-та, как отобразить в GUI только определённый ( document.getElementsByClassName("r-covid-19 js-covid inited")[0] )  элемент?

https://s8.hostingkartinok.com/uploads/thumbs/2020/04/296451c51824bb50f129bd15b4d4a874.png



#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
#Persistent

URL := "https://www.rbc.ru/society/03/04/2020/5e2fe9459a79479d102bada6"

Gui,Add, ActiveX, w1080 h840 vWB, Shell.Explorer
Gui, Show

WB.Navigate(URL)

while (wb.busy || wb.readyState <> 4)
     sleep 500

return

GuiClose:
WB := ""
ExitApp

2 (изменено: teadrinker, 2020-04-03 19:28:43)

Re: AHK: GUI_Shell.Explorer

Примерно так:

URL := "https://www.rbc.ru/society/03/04/2020/5e2fe9459a79479d102bada6"

Gui,Add, ActiveX, w600 h500 vWB, about:<meta http-equiv="X-UA-Compatible" content="IE=edge">
ComObjConnect(WB, new wbEvent)
WB.silent := true
WB.Navigate(URL)
return

GuiClose:
WB := ""
ExitApp 

class wbEvent
{
   __Call(Name, Params*) {
      static cloned
      WB := Params[Params.MaxIndex()]
      if node := WB.document.querySelector(".r-covid-19") {
         WB.Stop()
         ComObjConnect(WB)
         if !cloned {
            cloned := true
            coll := WB.document.body.children
            Loop % coll.length {
               elem := coll[A_Index - 1]
               elem.style.visibility := "hidden"
            }
            style := node.style
            style.position := "fixed"
            style.left := style.top := 0
            style.width := "600px"
            style.height := "500px"
            style.visibility := "visible"
            Gui, Show
         }
      }         
   }
}

У меня, правда, этот сайт иногда просто не загружается в ActiveX.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

3

Re: AHK: GUI_Shell.Explorer

teadrinker

Ооо, спасибо!

4

Re: AHK: GUI_Shell.Explorer

Лучше так, по-моему, без WB.Stop()

URL := "https://www.rbc.ru/society/03/04/2020/5e2fe9459a79479d102bada6"

Gui,Add, ActiveX, w600 h500 vWB, about:<meta http-equiv="X-UA-Compatible" content="IE=edge">
ComObjConnect(WB, new wbEvent)
WB.silent := true
WB.Navigate(URL)
return

GuiClose:
WB := ""
ExitApp 

class wbEvent
{
   __Call(Name, Params*) {
      static processed
      WB := Params.Pop()
      if node := WB.document.querySelector(".r-covid-19") {
         ComObjConnect(WB)
         if !processed {
            processed := true
            coll := WB.document.body.children
            Loop % coll.length {
               elem := coll[A_Index - 1]
               elem.style.visibility := "hidden"
            }
            style := node.style
            style.position := "fixed"
            style.left := style.top := 0
            style.width := "600px"
            style.height := "500px"
            style.visibility := "visible"
            Gui, Show
         }
      }         
   }
}
Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

5 (изменено: inseption86, 2020-04-03 22:44:29)

Re: AHK: GUI_Shell.Explorer

А как фон на белый, как на сайте? и убрать дату и время

6

Re: AHK: GUI_Shell.Explorer

У меня и так белый. Вот так у меня выглядит более похоже на то, что на сайте:

URL := "https://www.rbc.ru/society/03/04/2020/5e2fe9459a79479d102bada6"

Gui,Add, ActiveX, w750 h450 vWB, about:<meta http-equiv="X-UA-Compatible" content="IE=edge">
ComObjConnect(WB, new wbEvent)
WB.silent := true
WB.Navigate(URL)
return

GuiClose:
WB := ""
ExitApp 

class wbEvent
{
   __Call(Name, Params*) {
      static processed
      WB := Params.Pop()
      if node := WB.document.querySelector(".r-covid-19") {
         ComObjConnect(WB)
         ; WB.Stop()
         if !processed {
            processed := true
            coll := WB.document.body.children
            Loop % coll.length {
               elem := coll[A_Index - 1]
               elem.style.visibility := "hidden"
            }
            WB.document.body.style.background := "white"
            style := node.style
            style.position := "fixed"
            style.left := style.top := 0
            style.width := "750px"
            style.height := "450px"
            style.visibility := "visible"
            style.background := "url(https://s.rbk.ru/files_static/edd/2020/covid-19/15/images/bg_2x.png) no-repeat top right"
            style.backgroundSize := "240px 240px"
            Gui, Show
         }
      }         
   }
}
inseption86 пишет:

убрать дату и время

Это вам задача для самостоятельного изучения.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

7

Re: AHK: GUI_Shell.Explorer

teadrinker

Спасибо!!

WB.document.getElementsByClassName("r-covid-19__date js-covid-date")[0].hidden := 1