garry
Anmeldedatum: 25.10.2005 Beiträge: 395 Wohnort: switzerland
|
Verfasst am: Sa Dez 24, 2005 4:45 pm Titel: RSS POD or President's weekly message |
|
|
Whitehouse president's weekly message
hören,lesen,record
column1:
einmalclick, Ueberschrift
doppelclick, hören,lesen (evtl auch view Knopf auf homepage vorhanden)
| Code: | /*
......name =WhiteHouse.ahk , garry
......date =2005-12-24
......modified =
......test beta listview
*/
;=======================================================
FC2=http://www.whitehouse.gov/rss/radioaddress.xml
REALPLAYER =%A_ProgramFiles%\REALPLAYER\realplay.exe
;REALPLAYER =%A_ProgramFiles%\REAL10-5GOLD\realplay.exe
;=======================================================
F1=DNL1.txt ;download
FT=DNL1T.txt ;download transformed
F2=title.txt ;title
F3=RSS.csv ;csv with all
transform,S,chr,32
transform,Z,chr,127
filedelete,%F1%
filedelete,%FT%
filedelete,%F2%
filedelete,%F3%
URLDownloadToFile,%FC2%,%F1%
sleep,100
SplashTextOn,400,60,%FC2%,%FC2% >> DOWNLOAD OK
Sleep,1000
SplashTextOff
if L<100
Goto,AG6
;----ascii creates -13(CR)/10(LF) when only 13(CR) --------
transform,ten,chr,10
transform,tre,chr,13
CF=%TRE%%TEN%
I=0
loop
{
I+=1
FileReadLine, line, %F1%, %i%
If Errorlevel <> 0
GoTo,AG5
stringreplace,A,line,%tre%,%CF%,all
fileappend,%A%`r`n,%FT%
}
AG5:
F1=%FT%
SplashTextOn,400,60,%F1%,%LINE% DOWNLOAD OK TRANSFORMED
Sleep,1000
SplashTextOff
;----------------------------------------------------------
AG6:
Loop,Read,%F1%
{
LRL=%A_LoopReadLine%
;1----------------------------
IfInString,LRL,<title>
{
StringGetPos,P1,LRL,<title>
P1:=P1+8
}
IfInString,LRL,</title>
{
StringGetPos,P2,LRL,</title>
P2:=P2+1
PA:=(P2-P1)
StringMid,title,LRL,P1,PA
}
;2------------------------------
IfInString,LRL,<LINK>
{
StringGetPos,P3,LRL,<LINK>
P3:=P3+7
}
IfInString,LRL,</LINK>
{
StringGetPos,P4,LRL,</LINK>
P4:=P4+1
PB:=(P4-P3)
StringMid,LINK,LRL,P3,PB
}
IfInString,LRL,<item>
{
K2++
StringReplace,title,title,;,,All
StringReplace,title,title,`,,.,All
StringReplace,TITLE,TITLE,ä,ae,All
StringReplace,TITLE,TITLE,ü,ue,All
StringReplace,TITLE,TITLE,ö,oe,All
StringReplace,TITLE,TITLE,&apos,',All
FILEAPPEND,_RSS-%TITLE%`,%C2%`,`,%LINK%`r`n,%F2%
TITLE=
C2=
LINK=
GoTo,AG3
}
}
AG3:
Loop,Read,%F1%
{
LRL=%A_LoopReadLine%
;1----------------------------
IfInString,LRL,<title>
{
StringGetPos,P1,LRL,<title>
P1:=P1+8
}
IfInString,LRL,</title>
{
StringGetPos,P2,LRL,</title>
P2:=P2+1
PA:=(P2-P1)
StringMid,title,LRL,P1,PA
}
;1a -------------------------
IfInString,LRL,subtitle>
{
{
StringGetPos,P1,LRL,subtitle>
P1:=P1+10
}
stringlen,L2,LRL
stringmid,A6,LRL,P1,L2-P1
I4=0
Loop,parse,A6,`
{
I4++
if A_LOOPFIELD=<
P2:=((P1+I4)-(P1+1))
StringMid,title,LRL,P1,P2
}
}
;2------------------------------
IfInString,LRL,<LINK>
{
StringGetPos,P3,LRL,<LINK>
P3:=P3+7
}
IfInString,LRL,</LINK>
{
StringGetPos,P4,LRL,</LINK>
P4:=P4+1
PB:=(P4-P3)
StringMid,LINK,LRL,P3,PB
}
;3------------------------------
IfInString,LRL,<DESCRIPTION>
{
StringGetPos,P5,LRL,<DESCRIPTION>
P5:=P5+14
}
IfInString,LRL,</DESCRIPTION>
{
StringGetPos,P6,LRL,</DESCRIPTION>
P6:=P6+1
PC:=(P6-P5)
StringMid,DESCR,LRL,P5,PC
}
;4a ------------------------------
IfInString,LRL,<enclosure
{
{
StringGetPos,P1,LRL,http://
P1:=P1+1
}
stringlen,L2,LRL
stringmid,A6,LRL,P1,L2-P1
I4=0
Loop,parse,A6,`
{
I4++
Transform,D2,ASC,%A_LOOPFIELD%
if D2=34 ;"
GOTO,GG4
if D2=32 ;space
GOTO,GG4
if D2=60 ;<
GOTO,GG4
if D2=62 ;>
GOTO,GG4
}
GG4:
P2:=((P1+I4)-(P1+1))
StringMid,url,LRL,P1,P2
}
;6------------------------------
IfInString,LRL,<source url="
{
StringGetPos,P11,LRL,<source url="
P11:=P11+14
stringlen,L2,LRL
stringmid,A7,LRL,P11,L2-P11
I=0
Loop,parse,A7,`
{
I++
Transform,D2,ASC,%A_LOOPFIELD%
if D2=34
GOTO,GG5
if D2=32
GOTO,GG5
if D2=60
GOTO,GG5
if D2=62
GOTO,GG5
}
GG5:
P12:=(P11+(I-1))
PF:=(P12-P11)
stringMid,url,LRL,P11,PF
}
;5--------------------------------------
IfInString,LRL,<pubDate>
{
StringGetPos,P9,LRL,<pubDate>
P9:=(P9+10)
}
IfInString,LRL,</pubDate>
{
StringGetPos,P10,LRL,</pubDate>
P10:=(P10+1)
PE:=(P10-P9)
StringMid,PDATE,LRL,P9,PE
}
;7--------------------------------------
IfInString,LRL,<dc:date>
{
StringGetPos,P9,LRL,<dc:date>
P9:=(P9+10)
}
IfInString,LRL,</dc:date>
{
StringGetPos,P10,LRL,</dc:date>
P10:=(P10+1)
PE:=(P10-P9)
StringMid,PDATE,LRL,P9,PE
}
;=========================================
IfInString,LRL,</item>
{
K++
StringReplace,pdate,pdate,`,,%S%,All
StringReplace,title,title,`,,%S%,All
StringReplace,title,title,;,,All
StringReplace,title,title,&quot,,All
StringReplace,title,title,",,All
StringReplace,title,title,szlig,ss,All
StringReplace,TITLE,TITLE,&apos,',All
StringReplace,title,title,&,,All
StringReplace,title,title,uml,,All
StringReplace,title,title,ä,ae,All
StringReplace,title,title,ü,ue,All
StringReplace,title,title,ö,oe,All
StringReplace,title,title,«,<<,All
StringReplace,title,title,»,>>,All
StringReplace,title,title,Ü,Ue,All
StringReplace,title,title,è,è,All
StringReplace,title,title,ä,ae,All
StringReplace,title,title,ü,ue,All
StringReplace,title,title,ö,oe,All
StringReplace,title,title,ß,ss,All
StringReplace,title,title,è,è,All
StringReplace,title,title,«,<<,All
StringReplace,title,title,»,>>,All
StringReplace,title,title,&#x,,All
StringReplace,title,title,&#,,All
StringReplace,DESCR,DESCR,`,,%S%,All
StringReplace,DESCR,DESCR,;,,All
StringReplace,DESCR,DESCR,&quot,,All
StringReplace,DESCR,DESCR,szlig,ss,All
StringReplace,DESCR,DESCR,&apos,',All
StringReplace,DESCR,DESCR,",,All
StringReplace,DESCR,DESCR,&,,All
StringReplace,DESCR,DESCR,uml,,All
StringReplace,DESCR,DESCR,ä,ae,All
StringReplace,DESCR,DESCR,ü,ue,All
StringReplace,DESCR,DESCR,ö,oe,All
StringReplace,DESCR,DESCR,«,<<,All
StringReplace,DESCR,DESCR,»,>>,All
StringReplace,DESCR,DESCR,Ü,Ue,All
StringReplace,DESCR,DESCR,è,è,All
StringReplace,DESCR,DESCR,ä,ae,All
StringReplace,DESCR,DESCR,ü,ue,All
StringReplace,DESCR,DESCR,ö,oe,All
StringReplace,DESCR,DESCR,ß,ss,All
StringReplace,DESCR,DESCR,è,è,All
StringReplace,DESCR,DESCR,«,<<,All
StringReplace,DESCR,DESCR,»,>>,All
StringReplace,DESCR,DESCR,&#x,,All
StringReplace,DESCR,DESCR,&#,,All
if URL=
Fileappend,*%title%`,%LINK%`,%DESCR%`,`,%PDATE%`r`n,%F3%
else
Fileappend,*%title%`,%url%`,%LINK%`,%DESCR%`,%PDATE%`r`n,%F3%
TITLE=
LINK=
DESCR=
URL=
PDATE=
}
}
;=================
CHK1:
if K>0
{
OK++
GoTo,EX
}
else
if K<1
{
SplashTextOn,400,60,TESTTEXT,FAILURE`r`n%C1% RSS not created
Sleep,5000
SplashTextOff
return
}
EX:
Gui,Color, 000000
Gui,1:Font,S13 CDefault,Lucida Console
XL:=10
Gui,1:Add, ListView,backgroundteal csilver grid r20 x%XL% y0 w780 +hscroll altsubmit gLW2, NAME|URL1|URL2|Description|Date|LISTEN|READ|RECORD
LV_ModifyCol()
Gui,1:Show,x0 y0 w800 h570,USA President's weekly message
Gui,Font, S8 cwhite, Verdana
Gui,Add,Edit, x10 y400 w780 h140 ReadOnly vH2,
LV_GetText(C4,A_EventInfo,4)
GuiControl,,H2,%C4%
;=============================================================================
Gui,1:Default
Gui,1:Submit,nohide
T1:=520
T2:=0
T3:=0
T4:=0
T5:=0
T6:=80
T7:=80
T8:=80
T1A:=(XL+T1)
T2A:=(T1A+T2)
T3A:=(T2A+T3)
T4A:=(T3A+T4)
T5A:=(T4A+T5)
T6A:=(T5A+T6)
T7A:=(T6A+T7)
T8A:=(T7A+T8)
LV_Delete()
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
LV_ModifyCol(4,T4)
LV_ModifyCol(5,T5)
LV_ModifyCol(6,T6)
LV_ModifyCol(7,T7)
LV_ModifyCol(8,T8)
loop,read,%F3%
{
BX1= ;name
BX2= ;listen UR1
BX3= ;read UR2
BX4= ;description
BX5= ;date
BX6= ;UR1
BX7= ;UR2
BX8= ;record
stringsplit,BX,A_LoopReadLine,`,,
stringright,E3,BX2,3
;if BX1=
;continue
BX2=%BX2%
BX3=%BX3%
BX6=%Z%
BX7=%Z%
if E3=MP3
BX8=%Z%
LV_Add("",BX1,BX2,BX3,BX4,BX5,BX6,BX7,BX8)
}
return
;==============================================================
LW2:
Gui, Submit,nohide
if A_GuiEvent=Normal
{
MouseGetPos,x,y
if x<%T1A%
{
LV_GetText(C4,A_EventInfo,4)
LV_GetText(C5,A_EventInfo,5)
RN:=LV_GetNext("C")
RF:=LV_GetNext("F")
GC:=LV_GetCount()
GuiControl,,H2,%C5%`r`n%C4%
}
if x>%T7A% ;8 record
{
LV_GetText(C2,A_EventInfo,2)
stringlen,L,C2
StringGetPos,C,C2,/,R1
C:=(L-C)
stringright,SR,C2,C-1
Splashimage,,b1 x40 y0 w500 h20 CWred zh0,START RECORD %C2%
Sleep,1500
Splashimage, off
goto,REC
}
if x>%T6A% ;7 URL2 htm
{
LV_GetText(C3,A_EventInfo,3)
Splashimage,,b1 x40 y0 w500 h20 CWred zh0,START READ %C3%
Sleep,1500
Splashimage, off
Run,%C3%
Goto,EX2
}
if x>%T5A% ;6 URL1 mp3
{
LV_GetText(C2,A_EventInfo,2)
Splashimage,,b1 x40 y0 w500 h20 CWred zh0,START PLAY %C2%
Sleep,1500
Splashimage, off
Run,%REALPLAYER% %C2%
Goto,EX2
}
}
if A_GuiEvent=DoubleClick
{
MouseGetPos,x,y
if x<%T1A%
{
LV_GetText(C2,A_EventInfo,2)
LV_GetText(C3,A_EventInfo,3)
LV_GetText(C4,A_EventInfo,4)
LV_GetText(C5,A_EventInfo,5)
GuiControl,,H2,%C5%`r`n%C4%
Splashimage,,b1 x40 y0 w500 h20 CWred zh0,START PLAY %C2%
Sleep,1500
Splashimage, off
Run,%C3%
sleep,1500
Run,%REALPLAYER% %C2%
Goto,EX2
}
}
return
REC:
{
Splashimage,,M2 x290 y330 w500 h70 CWred m9 fs10 zh0,%C2% ,START >> Download,Download %C2%
URLDownloadToFile,%C2%,WhiteHouse_%SR%
sleep,200
Splashimage,,b x290 y330 w500 h70 CWsilver m9 fs10 zh0,Loaded: WhiteHouse_%SR%,FINISHED = OK
Sleep,2000
Splashimage, off
return
}
EX2:
return
GuiClose:
ExitApp
|
|
|