NEWS_Reader

Veröffentliche deine funktionierenden Skripte und Funktionen

Moderator: jNizM

garry
Posts: 1724
Joined: 22 Dec 2013, 12:50

NEWS_Reader

31 Dec 2018, 09:46

... zur Jahresende ... wünsche euch einen guten Rutsch ins Neue Jahr

MAD in Germany ...
Die Autoindustrie weist jede Schuld von sich. Autofahrer dürfen Fahrverbote einfach „umfahren“. Und intakte Diesel-Wagen werden zu Tausenden verschrottet.
https://www.faz.net/aktuell/wirtschaft/ ... 13430.html
https://www.faz.net/aktuell/technik-mot ... 59978.html

Code: Select all

;- ListView-READ-News
;--------------------
;modified = 20181231
;created  = 20181219
;--------------------

#NoEnv
#Warn
SendMode Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
FileEncoding, UTF-8
MainWindowTitle=ListView_NEWS
vlcx        =%A_programfiles%\VideoLAN\VLC\vlc.exe
dlm = `;
total:=3    ;- rows
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")

wa:=A_screenwidth
ha:=A_screenHeight

Gui,2:default
Gui,2: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,2:Font,s12 cGray,Lucida Console
Gui,2:Color,Black,Black

cx:=""
ck:=""
sect2=
(Ltrim Join`r`n
Basel;https://bazonline.ch/rss.html
TagesAnzeiger;https://www.tagesanzeiger.ch/rss_ticker.html
DE_NTV;https://www.n-tv.de/rss
DE_TV;http://www.tagesschau.de/xml/atom/
DLF_Computer;http://www.deutschlandfunk.de/podcast-computer-und-kommunikation-komplette-sendung.416.de.podcast.xml
$$_FEED;https://news.feed-reader.net/rubriken/ueberblick/top/
DE_Koeln;https://www.ksta.de/blueprint/servlet/xml/ksta/23699416-asYahooFeed.xml
DE_FAZ;https://www.faz.net/rss/aktuell/
DE_Faz_Reg;https://www.faz.net/rss/aktuell/rhein-main/
DE_Faz_Digi;https://www.faz.net/rss/aktuell/technik-motor/digital/
)

loop,parse,sect2,`n,`r
  {
  x:=a_loopfield
  if x=
     break
  stringsplit,k,x,`;
  cx .= k1 . "|"
  ck .= k2 . "|"
  }

stringsplit,m,ck,`|
stringsplit,h,cx,`|
totx:=(h0-1)

x :=(wa*.3  )/100
y :=(ha*2   )/100
w :=(wa*6   )/100
hx:=(ha*2.5 )/100
v :=(ha*0.3 )/100
Gui,2:add,text,section x%x% y%y% w0 h0,
I=0

 Loop,%totx%
    {
	BTName:= h%a_index%
    Gui,2: Add, Button, xs   y+%v% w%w%  h%hx% gStart v%btname%_%a_index% ,%btname%
    }
		sect1=Title,Url,Date
        stringsplit,h,sect1,`,
        ch1:=""	   
        loop,%total%
            ch1 .= h%a_index% . "|"

        x :=(wa*7  )/100
        w :=(wa*55 )/100
        h :=(ha*80 )/100
        y :=(ha*1  )/100
        gui,2:add, listview,x%x% y%y% w%w% h%h% grid cWhite backgroundteal hwndLV1 vLVC1 gLVEvents +altsubmit -multi, %ch1%
        T1:=(wa*40  )/100
        T2:=0
        T3:=(wa*12.5)/100
        LV_ModifyCol(1,T1)
        LV_ModifyCol(2,T2)
	    LV_ModifyCol(3,T3)

;----------------------
x :=(wa*10  )/100
y :=(ha*85  )/100
w :=(wa*5   )/100
h :=(ha*2.5 )/100
Gui,2: Add,Edit,cWhite x%x%  y%y%  w%w%  h%h% gSearchA vsearchx
x :=(wa*16  )/100
Gui,2: add,button,     x%x%  y%y%  w%w%  h%h% gClearsearch ,<Clear
x :=(wa*22  )/100
Gui,2: Add,Edit,cWhite x%x%  y%y%  w%w%  h%h%  readonly vCountFile1   right,
x :=(wa*28  )/100
Gui,2: Add,Edit,cWhite x%x%  y%y%  w%w%  h%h%  readonly vSearchYN     center
;----------------------
w :=(wa*64 )/100
h :=(ha*90 )/100
gui,2: show,x1 y1 w%w% h%h%,%MainWindowTitle%
Guicontrol,2:,searchYN,Search-NO
gosub,fillx
RETURN
;--------------------------
2Guiclose:
exitapp
;--------------------------


start:
gui,2:submit,nohide
Mousegetpos,,,,Ctrl       ;- Button1
r:= a_guicontrol          ;- vVar ( Buttonname )
stringtrimleft,ct,ctrl,6  ;- Button-(1)
url:= % m%ct%
stringmid,nw,r,1,3
if (nw="$$_")
  run,%url%
else
  gosub,fill
return

;----------------------- FILL ---------------------------------------
fillx:
url=https://www.tagesanzeiger.ch/rss_ticker.html
Fill:
Gui,2:default
Gui,2:submit,nohide
LV_Delete()
whr.Open("GET",url, true)
whr.Send()
whr.WaitForResponse()
aab := whr.ResponseText
;------------------------------
xc=&#034;
xd=&#039;
stringreplace,aab,aab,%xc%,,all
stringreplace,aab,aab,%xd%,,all
;------------------------------

e:=""
a:=0
Loop,parse,aab,`n,`r
  {
  x=%a_loopfield%
  if x=
    continue
  if x contains </item>,</entry>
    a=0
  if x contains <item>,<entry>
    a=1
  if (a=1)
    {
    if x contains <title>,<itunes:title>
      {
      stringreplace,x,x,<title>,,
      stringreplace,x,x,</title>,,
      e .= x . ";"
      }
    if x contains <link>,<id>
      {
      stringreplace,x,x,<link>,,
      stringreplace,x,x,</link>,,
      stringreplace,x,x,<id>,,
      stringreplace,x,x,</id>,,
      e .= x . ";"
      }
    if x contains <pubDate>,<updated>
      {
      stringreplace,x,x,<pubDate>,,
      stringreplace,x,x,</pubDate>,,
      stringreplace,x,x,<updated>,,
      stringreplace,x,x,</updated>,,

      e .= x . "`r`n"
      }

    }
  }
aab=
i=0
for each, Line in StrSplit(e, "`n", "`r")
{
if line=
  continue
i++
Columns := StrSplit(Line,dlm)
LV_Add("",Columns*)
}
Guicontrol,2:,CountFile1,%I%
GuiControl,2:Focus,searchx
return
;------------------------------------------------




;------------------------------------------------
LVevents:
Gui,2:default
Gui,2:submit,nohide
rcon:=a_guicontrol
Gui,2:ListView,%rcon%
  RN:=LV_GetNext("C")
  RF:=LV_GetNext("F")
  GC:=LV_GetCount()
  if (rn=0)
    return
;-----------------  
if A_GuiEvent = Normal
  {
  LV_GetText(C2,a_eventinfo,2)
  SplitPath,C2, name, dir, ext, name_no_ext, drive
  stringmid,urlx ,C2,1,4
  stringmid,pathx,C2,2,2
  if (urlx="http" || pathx=":\")
     {
     try
        {
        if (ext="mp3")
          {
          run,%vlcx% "%c2%"
          ;run,%vlcx% --one-instance --qt-start-minimized "%c2%",,hide,pid1
          }
        else if (ext="mp4")
          {
           run,%c2%
          ;run,%vlcx% "%c2%"
          }
        else
	      run,%C2%
        }
 	 catch e 
    	{
        xxx:=e.Message
        msgbox, 262208,ERROR,Error=`n%xxx%`n------------------------------------------`n%C2%
        }
	 return
	 }
  }

  if A_GuiEvent = Rightclick
  {
  LV_GetText(urlc2,a_eventinfo,2)
  msgbox, 262208,URL-C2 ,C2=`n%urlc2%
  return
  }
return
;----------------------------------------------

;================== SEARCH ====================
SearchA:
Gui,2:default
Gui,2:submit,nohide
Gui,2:ListView, LVC1
if (searchx="")
   return
settimer,checkempty,1000
LV_Delete()
Guicontrol,2:,searchYN,Search-YES
I2=0
GuiControl,2: -Redraw,LVC1
Loop,parse,e,`n,`r
{
loop,%total%
  z%a_index%:=""
zx= 
stringsplit,z,a_loopfield,%dlm%
loop,%total%
    zx .= z%a_index% . dlm
stringtrimright,zx,zx,1

ifinstring,zX,%searchx%
  {
    i2++
	Cns := StrSplit(zx,dlm)
	LV_Add("", cns*)
  }
}
GuiControl,2: +Redraw,LVC1
Guicontrol,2:,CountFile1,%I2%
return
;--------------
checkempty:
Gui,2:submit,nohide
if (searchx="")
   {
   settimer,checkempty,off
   gosub,fill                      ;- <<< 
   Guicontrol,2:,searchYN,Search-NO
   return
   }
return

;--------------------------
clearsearch:
guicontrol,2:,searchx
return
;================== END script ==========================================================
Ahk_fan
Posts: 50
Joined: 31 Aug 2018, 14:34

Re: NEWS_Reader

07 Feb 2019, 14:27

Schönes Prog!
Danke!
regards,
AHK_fan :)

Return to “Skripte und Funktionen”

Who is online

Users browsing this forum: No registered users and 1 guest