die letzte Sendung anschauen in GUI ActiveX (firefox & vlc.exe )
EDIT-2 : 20180228 zweites Beispiel mit WGET ( urldownloadtofile funktioniert bei mir nicht mehr )
EDIT-1 : 20180209 bessere Bildqualität ( anderes URL )
https://www.podcast.de/podcast/615938/
http://www.ndr.de/fernsehen/sendungen/e ... index.html
Code: Select all
;-------- saved at Freitag, 9. Februar 2018 19:53:26 --------------
;-------- https://autohotkey.com/boards/viewtopic.php?f=10&t=43808 ---
;- modified = 20180209
;- created = 20180205
;- name = TV_Extra-3 see last emission
;- XP / Win10 with [vlc.exe & Mozilla Firefox]
;-------------------------------------------------
#warn
#NoEnv
SendMode,Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
;--------------------------------------------------
filename1=TV_EXTRA-3
vlc1 =%a_programfiles%\videolan\vlc\vlc.exe
logfile =%a_scriptdir%\TV_Extra3_Logfile.txt
;------- download here : -------
folderx2=%a_desktop%\Downloads
ifnotexist,%folderx2%
filecreatedir,%folderx2%
;-----------------------------------------------
Menu,S2,add,Podcast-de ,Podcast-de
Menu,S2,add,Podcast-NDR ,EXTRA3_Podcast
Menu,S3,add,Logfile ,Logfilex
menu,myMenuBar,Add,EXTRA-3 ,:S2
menu,myMenuBar,Add,Logfile ,:S3
gui,2:menu,MyMenuBar
;-----------------------------------------------
;Gui,2: +AlwaysOnTop
Gui,2: Color, 000000
Gui,2:Font, S10 CDefault , FixedSys
;xxa=Shell.Explorer ;- IExplorer
xxa=Mozilla.Browser ;- Mozilla Firefox
ifexist,%vlc1%
Gui,2:Add,ActiveX, x10 y10 w1460 h900 vVlcx, VideoLAN.VLCPlugin.2
else
{
Gui,2:Add,ActiveX, x10 y10 w1460 h880 vWB1 ,%xxa%
WB1.Silent := True
ComObjError(false)
}
SM4=8 ; set volume level wave ( XP )
soundset,0,WAVE,mute ; WAVE ON
SoundSet,%SM4%,WAVE ; WAVE
Gui,2:Add, Slider , x1490 y100 w40 h190 altsubmit vVOL11a gVOL11 Range0-100 Vertical invert thick25 cGray left line10,%sm4%
SM5=10 ; set volume level master
soundset,0,master,mute ; master ON
SoundSet,%SM5%,master ; master
Gui,2:Add, Slider , x1490 y310 w40 h190 altsubmit vVOL12a gVOL12 Range0-100 Vertical invert thick25 cGray left line10,%sm5%
;Gui,2:add, Button , x10 y940 w100 h25 gPLAY,PLAY
ifexist,%vlc1%
Gui,2:add, Button , x240 y940 w100 h25 gSnapshot vSnapshot1, SNAPSHOT
Gui,2:add,Button , x350 y940 w100 h25 vDownload1 gDownload, DOWNLOAD
Gui,2:add,Button , x470 y940 w100 h25 gFolder,Folder
Gui,2:Add,Text , x600 y940 w800 vDownloadx cRed ;- show when Download
Gui,2:Add,Text , x1470 y940 w80 vMemoryX cYellow ;- Memory_used
Gui,2:Add, Progress, x140 y914 w1200 h18 vPRBAR backgroundGray range0-100
Gui,2:Add,Text, x5 y914 w40 vT1 cYellow ;- procent
Gui,2:Add,Text, x50 y914 w80 vT2 cYellow ;- played time actual
Gui,2:Add,Text, x1370 y914 w80 vT3 cYellow ;- total lenght from video
Gui,2:Add,Text, x1470 y914 w80 vT5 cYellow ;- vlc state
Gui,2: Show,x0 y0 w1550 h970,%filename1%
ifexist,%vlc1%
{
settimer,aas1,1000
settimer,aas1,off
}
settimer,memorycheck,1000
GuiControl,2:Disable,download1
gosub,lastnews
gosub,play
return
;-------------------------
2Guiclose:
exitapp
;-------------------------
podcast-de:
run,https://www.podcast.de/podcast/615938/
return
EXTRA3_Podcast:
run,http://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html
return
folder:
run,%folderx2%
return
logfilex:
run,%logfile%
return
SNAPSHOT:
;- rename saved picture bmp to png
ifexist,%vlc1%
vlcx.video.takeSnapshot()
return
;---------------------------------------------
;============================= download and then cut text =========================================
LastNews:
gosub, clearall
folderx=%a_scriptdir%
stringmid,datex,a_now,1,10
f1=https://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html
;<span itemprop="contentUrl" content="https://mediandr-a.akamaihd.net/progressive/2018/0208/TV-20180208-2243-2400.hq.mp4" />
httpQuery(aaa,f1)
loop,parse,aaa,`n,`r
{
x=%A_loopfield%
if x contains <span itemprop="contentUrl" content=
{
y=%x%
break
}
}
Begin1 = <a href="
End1 := "mp3,m4a,wav,wma,flv,vob,mp4,mpg,wmv,avi" ;- end
stringlen,L1,Begin1
Loop Parse,Y,`" ;- split for `"
{
StringLeft,R1,A_LoopField,L1
SplitPath,A_LoopField, name, dir, ext, name_no_ext, drive
if ext in %End1%
{
x720 := a_loopfield
break
}
}
return
;------------------------------------
Play:
Gui,2:submit,nohide
stringmid,datex,a_now,1,10
if x720 contains mp4
{
fileappend,%datex%_%x720%`r`n,%logfile%
GuiControl,2:Enable,download1
ifexist,%vlc1%
{
vlcx.playlist.stop()
vlcx.playlist.items.clear()
vlcx.playlist.add(x720,"","""""")
vlcx.playlist.next()
settimer,aas1,on
}
else
WB1.Navigate(x720)
}
return
;-------------------------------------------------------------------
;-------------- DOWNLOAD -----------------------
download:
Gui,2:submit,nohide
stringmid,datex,a_now,1,10
SplitPath,x720, name, dir, ext, name_no_ext, drive
stringreplace,name,name,`%20,%A_space%,all ;replace `%20 with space
new=%folderx2%\EXTRA-3_%name%
GuiControl,2:Text,downloadx,Download...%x720%
;runwait,%comspec% /c wget %x720% -nc -O "%new%",,hide,PID3
urldownloadtofile,%x720%,%new%
GuiControl,2:Text,downloadx,
; ifexist,%new%
; run,%new%
return
;----------------------------------------------
;----- volumex -------------------------------
VOL11:
GuiControlGet, VOL11a
SoundSet,%vol11a%,WAVE
return
;----- volumex ----------
VOL12:
GuiControlGet, VOL12a
;Guicontrol,2:,T1,%VOL12a%
SoundSet,%vol12a%,master
return
;------------------------
;=========== settimer progressbar ==================
aas1:
gui,2:submit,nohide
bc:=vlcx.input.length
ac:=vlcx.input.time
acc:=(ac//1000)
bcx:=(bc//1000)
if (acc=0 or bcx=0)
return
;msgbox, 262208, ,acc=%acc%`nbcx=%bcx% , 1
SetFormat, float, 02
hours1 := (acc//3600)
minutes1 := (acc - hours1 * 3600)// 60
seconds1 := (acc - hours1 * 3600 - minutes1 * 60)
hours1 +=0.00
minutes1+=0.00
seconds1+=0.00
acc=%hours1%:%minutes1%:%seconds1%
;------- played-time ---------------
hours := (bcx//3600)
minutes := (bcx - hours * 3600)// 60
seconds := (bcx - hours * 3600 - minutes * 60)
hours +=0.00
minutes+=0.00
seconds+=0.00
bcx=%hours%:%minutes%:%seconds%
;----- total-time ----------------
ay:=vlcx.input.state
if (ay=0)
cy=Idle
if (ay=1)
cy=Opening
if (ay=2)
cy=Buffering
if (ay=3)
cy=Playing
if (ay=4)
cy=Paused
if (ay=5)
cy=Stopped
if (ay=7)
cy=Error
if (ay=6)
{
cy=Ended
GuiControl,2:Text,T5,%cy%
settimer,aas1,off
GuiControl,2:,PRBAR,100
GuiControl,2:Text,Procentx ,100`%
return
}
;GuiControl,2:Text,T4,AY=%ay%
GuiControl,2:Text,T5,%cy%
RES1:=Round((100*AC)/BC)
GuiControl,2:,PRBAR ,%res1%
GuiControl,2:Text,T1 ,%res1%`% ;- procent
GuiControl,2:Text,T2 ,%acc% ;- PlayedTime
GuiControl,2:Text,T3 ,%bcx% ;- Lenght
return
;========== CLEAR ===================
clearall:
GuiControl,2:Text,T1,
GuiControl,2:Text,T2,
GuiControl,2:Text,T3,
Guicontrol,2:text,T5
Guicontrol,2:text,prbar
GuiControl,2:,PRBAR,0
GuiControl,2:Text,Procentx ,0`%
return
;-------------------------------------
;-------- saved at Samstag, 3. Februar 2018 12:08:11 --------------
;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=43654 ---
memorycheck:
memx:=checkWorkingset()//1024 . "-kB"
GuiControl,2:Text,MemoryX,%memx%
return
checkWorkingset(pid:=""){
static wmi:=comObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . a_computerName . "\root\cimv2")
pid:=pid?pid:dllCall("GetCurrentProcessId")
processInfo:=wmi.execQuery("select WorkingSetSize,ProcessId from Win32_Process")._NewEnum
while(processInfo[item]){
if(item.processId=pid){
workingSet:=item.WorkingSetSize
break
}
}
return workingSet
}
;-----------------------------------------------------------------
;-----------------------------------------------------------------
httpQuery(byref Result, lpszUrl, POSTDATA="", HEADERS="")
{
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WebRequest.Open("GET", lpszUrl)
WebRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
WebRequest.Send(POSTDATA)
Result := WebRequest.ResponseText
WebRequest := ""
}
return
;=============================== END SCRIPT EXTRA-3 ================================
2nd Beispiel mit wget.exe ( urldownloadtofile funktioniert bei mir nicht mehr )
Code: Select all
;-------- saved at Freitag, 9. Februar 2018 19:53:26 --------------
;-------- https://autohotkey.com/boards/viewtopic.php?f=10&t=43808 ---
;-https://wiki.videolan.org/Documentation:WebPlugin/
;- modified = 20180228
;- created = 20180205
;- name = TV_Extra-3 see last emission
;- XP / Win10 with [vlc.exe & Mozilla Firefox]
;-------------------------------------------------
#warn
#NoEnv
SendMode,Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
;--------------------------------------------------
filename1=TV_EXTRA-3
logfile =%a_scriptdir%\TV_Extra3_Logfile.txt
vlc1 =%a_programfiles%\videolan\vlc\vlc.exe
;---------------- vlc test ------------------------
;run,%vlc1%
;exitapp
;https://wiki.videolan.org/Documentation:WebPlugin/
;--------------------------------------------------
;WGETX
wgeturl=https://eternallybored.org/misc/wget/
wget1 =%a_scriptdir%\wget.exe
ifnotexist,%wget1%
{
msgbox, 262180,WGET,NOT EXIST=`n%wget1%`n---------------------------`nWant you OPEN WGET URL to download wget.exe ?
ifmsgbox,no
exitapp
run,%wgeturl%
exitapp
}
;------- download here : -------
folderx2=%a_desktop%\Downloads
ifnotexist,%folderx2%
filecreatedir,%folderx2%
;-----------------------------------------------
Menu,S2,add,Podcast-de ,Podcast-de
Menu,S2,add,Podcast-NDR ,EXTRA3_Podcast
Menu,S3,add,Logfile ,Logfilex
menu,myMenuBar,Add,EXTRA-3 ,:S2
menu,myMenuBar,Add,Logfile ,:S3
gui,2:menu,MyMenuBar
;-----------------------------------------------
;Gui,2: +AlwaysOnTop
Gui,2: Color, 000000
Gui,2:Font, S10 CDefault , FixedSys
;xxa=Shell.Explorer ;- IExplorer
xxa=Mozilla.Browser ;- Mozilla Firefox
ifexist,%vlc1%
Gui,2:Add,ActiveX, x10 y10 w1460 h900 vVlcx, VideoLAN.VLCPlugin.2
else
{
Gui,2:Add,ActiveX, x10 y10 w1460 h880 vWB1 ,%xxa%
;WB1.Silent := True ; don't show failure
;ComObjError(false)
}
;SM4=100 ; wave (XP)
soundset,0,WAVE,mute ; WAVE ON
SoundGet,sm4,wave
SoundSet,%SM4%,WAVE ; WAVE
Gui,2:Add, Slider , x1490 y100 w40 h190 altsubmit vVOL11a gVOL11 Range0-100 Vertical invert thick25 cGray left line10,%sm4%
;SM5=10 ;- MASTER-VOLUME
soundset,0,master,mute ; master ON
SoundGet,sm5,master
SoundSet,%SM5%,master ; master
Gui,2:Add, Slider , x1490 y310 w40 h190 altsubmit vVOL12a gVOL12 Range0-100 Vertical invert thick25 cGray left line10,%sm5%
;Gui,2:add, Button , x10 y940 w100 h25 gPLAY,PLAY
ifexist,%vlc1%
Gui,2:add, Button , x240 y940 w100 h25 gSnapshot vSnapshot1, SNAPSHOT
Gui,2:add,Button , x350 y940 w100 h25 vDownload1 gDownload, DOWNLOAD
Gui,2:add,Button , x470 y940 w100 h25 gFolder,Folder
Gui,2:Add,Text , x600 y940 w800 vDownloadx cRed ;- show when Download
Gui,2:Add,Text , x1470 y940 w80 vMemoryX cYellow ;- Memory_used
Gui,2:Add, Progress, x140 y914 w1200 h18 vPRBAR backgroundGray range0-100
Gui,2:Add,Text, x5 y914 w40 vT1 cYellow ;- procent
Gui,2:Add,Text, x50 y914 w80 vT2 cYellow ;- played time actual
Gui,2:Add,Text, x1370 y914 w80 vT3 cYellow ;- total lenght from video
Gui,2:Add,Text, x1470 y914 w80 vT5 cYellow ;- vlc state
Gui,2: Show,x0 y0 w1550 h970,%filename1%
ifexist,%vlc1%
{
settimer,aas1,1000
settimer,aas1,off
}
settimer,memorycheck,1000
GuiControl,2:Disable,download1
gosub,lastnews
gosub,play
return
;-------------------------
2Guiclose:
exitapp
;-------------------------
podcast-de:
run,https://www.podcast.de/podcast/615938/
return
EXTRA3_Podcast:
run,http://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html
return
folder:
run,%folderx2%
return
logfilex:
run,%logfile%
return
SNAPSHOT:
;- rename saved picture bmp to png
;--snapshot-path =<Text>
;--snapshot-prefix=<Text>
;--snapshot-format={png,jpg,tiff}
ifexist,%vlc1%
{
vlcx.video.takeSnapshot()
}
return
;---------------------------------------------
;============================= download and then cut text =========================================
LastNews:
gosub, clearall
folderx=%a_scriptdir%
stringmid,datex,a_now,1,10
f1 :="https://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html"
;SplitPath,f1, name, ref, ext, name_no_ext, drive
;<span itemprop="contentUrl" content="https://mediandr-a.akamaihd.net/progressive/2018/0221/TV-20180221-2217-2800.hq.mp4" />
f2:= a_scriptdir . "\Extra3.txt"
ifexist,%wget1%
{
loop,%wget1% ;- create shortpath
SP1= %A_loopFileShortPath%
RunWait,%COMSPEC% /c %sp1% --output-document="%f2%" %f1% ,,hide
}
ifexist,%f2%
{
fileread,aaa,%f2%
Begin1 = content="https://
End1 := "mp3,m4a,wav,wma,flv,vob,mp4,mpg,wmv,avi" ;- end
stringlen,L1,Begin1
Loop Parse,aaa,`" ;- split for `"
{
StringLeft,R1,A_LoopField,L1
SplitPath,A_LoopField, name, dir, ext, name_no_ext, drive
if ext in %End1%
{
x720 := a_loopfield
break
}
}
;msgbox,X720=%x720%
return
}
else
msgbox,NOT FOUND %f2%
return
;------------------------------------
Play:
Gui,2:submit,nohide
stringmid,datex,a_now,1,10
if x720 contains mp4
{
fileappend,%datex%_%x720%`r`n,%logfile%
GuiControl,2:Enable,download1
ifexist,%vlc1%
{
vlcx.playlist.stop()
vlcx.playlist.items.clear()
vlcx.playlist.add(x720,"","""""")
vlcx.playlist.next()
settimer,aas1,on
}
else
{
try
WB1.Navigate(x720)
catch e ;- show failure
{
xxx:=e.Message
msgbox, 262208,ERROR,Error=`n%xxx%`n------------------------------------------`n
return
}
}
return
}
msgbox,CAN't PLAY
return
;-------------------------------------------------------------------
;-------------- DOWNLOAD -----------------------
download:
Gui,2:submit,nohide
stringmid,datex,a_now,1,10
SplitPath,x720, name, dir, ext, name_no_ext, drive
stringreplace,name,name,`%20,%A_space%,all ;replace `%20 with space
new=%folderx2%\EXTRA-3_%name%
GuiControl,2:Text,downloadx,Download...%x720%
;runwait,%comspec% /c wget %x720% -nc -O "%new%",,hide,PID3
urldownloadtofile,%x720%,%new%
GuiControl,2:Text,downloadx,
; ifexist,%new%
; run,%new%
return
;----------------------------------------------
;----- volumex -------------------------------
VOL11:
GuiControlGet, VOL11a
SoundSet,%vol11a%,WAVE
return
;----- volumex ----------
VOL12:
GuiControlGet, VOL12a
;Guicontrol,2:,T1,%VOL12a%
SoundSet,%vol12a%,master
return
;------------------------
;=========== settimer progressbar ==================
aas1:
gui,2:submit,nohide
bc:=vlcx.input.length
ac:=vlcx.input.time
acc:=(ac//1000)
bcx:=(bc//1000)
if (acc=0 or bcx=0)
return
;msgbox, 262208, ,acc=%acc%`nbcx=%bcx% , 1
SetFormat, float, 02
hours1 := (acc//3600)
minutes1 := (acc - hours1 * 3600)// 60
seconds1 := (acc - hours1 * 3600 - minutes1 * 60)
hours1 +=0.00
minutes1+=0.00
seconds1+=0.00
acc=%hours1%:%minutes1%:%seconds1%
;------- played-time ---------------
hours := (bcx//3600)
minutes := (bcx - hours * 3600)// 60
seconds := (bcx - hours * 3600 - minutes * 60)
hours +=0.00
minutes+=0.00
seconds+=0.00
bcx=%hours%:%minutes%:%seconds%
;----- total-time ----------------
ay:=vlcx.input.state
if (ay=0)
cy=Idle
if (ay=1)
cy=Opening
if (ay=2)
cy=Buffering
if (ay=3)
cy=Playing
if (ay=4)
cy=Paused
if (ay=5)
cy=Stopped
if (ay=7)
cy=Error
if (ay=6)
{
cy=Ended
GuiControl,2:Text,T5,%cy%
;settimer,aas1,off
GuiControl,2:,PRBAR,100
GuiControl,2:Text,T1 ,100`%
return
}
;GuiControl,2:Text,T4,AY=%ay%
GuiControl,2:Text,T5,%cy%
RES1:=Round((100*AC)/BC)
GuiControl,2:,PRBAR ,%res1%
GuiControl,2:Text,T1 ,%res1%`% ;- procent
GuiControl,2:Text,T2 ,%acc% ;- PlayedTime
GuiControl,2:Text,T3 ,%bcx% ;- Lenght
return
;========== CLEAR ===================
clearall:
GuiControl,2:Text,T1,
GuiControl,2:Text,T2,
GuiControl,2:Text,T3,
Guicontrol,2:text,T5
Guicontrol,2:text,prbar
GuiControl,2:,PRBAR,0
GuiControl,2:Text,T1 ,0`%
return
;-------------------------------------
;-------- saved at Samstag, 3. Februar 2018 12:08:11 --------------
;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=43654 ---
memorycheck:
memx:=checkWorkingset()//1024 . "-kB"
GuiControl,2:Text,MemoryX,%memx%
return
checkWorkingset(pid:=""){
static wmi:=comObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . a_computerName . "\root\cimv2")
pid:=pid?pid:dllCall("GetCurrentProcessId")
processInfo:=wmi.execQuery("select WorkingSetSize,ProcessId from Win32_Process")._NewEnum
while(processInfo[item]){
if(item.processId=pid){
workingSet:=item.WorkingSetSize
break
}
}
return workingSet
}
;-----------------------------------------------------------------
;================================== END ====================================