Advertisement
Najeebsk

VLC-PLAYER1.ahk

Mar 22nd, 2023 (edited)
1,773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*   INFO
  2.    VLC VIDEOS PLAYER
  3.    Written by: Najeeb Shah Khan (najeebshahkhan@gmail.com)
  4.    Last Modified: 3-20-2023
  5. */
  6. ;#warn
  7. #NoEnv
  8. #SingleInstance, Force
  9. Process, Priority, , A
  10. SendMode, Input
  11. SetBatchLines, -1
  12. ;#NoTrayIcon
  13. SetWorkingDir %A_ScriptDir%  
  14. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  15. FileCreateDir, %A_ScriptDir%\DATA
  16. FileSetAttrib +HS, %A_ScriptDir%\DATA, 2
  17. FileInstall , VLC-PLAYER1.ahk, %A_ScriptDir%\DATA\VLC-PLAYER1.ahk, 1
  18. FileSetAttrib +HS, %A_ScriptDir%\DATA\VLC-PLAYER1.ahk, 2
  19. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  20. wa:=A_screenwidth,ha:=A_screenHeight,xx:=100
  21. if (wa=3840)
  22.    fontsize1=14
  23. else if (wa=1920)
  24.    fontsize1=11
  25. else
  26.    fontsize1=9
  27. Gui,2:default
  28. Gui,2: +HwndAId  +0x2000000  ; +WS_CLIPCHILDREN Fixes drawing problems with child.
  29. Gui,2: -DPIScale
  30. SS_REALSIZECONTROL := 0x40
  31. Gui,2:Color,Black,Black
  32. Gui,2:Font,s%fontsize1% cGray,Lucida Console
  33. ;-------------------------------------------
  34. editorx1=F:\PORTABLE\Notepad++\notepad++.exe
  35. ifnotexist,%editorx1%
  36.   editorx1:=""
  37. ;---------------------
  38. Name1=NAJEEB-MEDIATHEK
  39. RSSINI=%A_scriptdir%\%name1%_RSSINI.txt
  40. ifnotexist,%rssini%
  41.     {
  42.     xxca:="https://mediandr-a.akamaihd.net/download/podcasts/extradrei196/TV-20210108-1424-4800.hi.mp4"
  43.     IniWrite,%xxca%, %rssini% ,A1   , KEY1
  44.     }
  45. IniRead, C2, %rssini% , A1 , Key1
  46.  
  47. ;--------------------------------------------------
  48. ;======================================================
  49. ;filename1=FILE_URL_YOUTUBE
  50. vlc1     =%a_programfiles%\videolan\vlc\vlc.exe  ;-  works with vlc.exe ( check path )
  51. ;------- download here : -------
  52. folderx2=C:\users\%a_username%\downloads         ;- check if this is your default DOWNLOAD-folder
  53. ;folderx2=D:\M_Downloads
  54. ;ifnotexist,%folderx2%
  55. ;  filecreatedir,%folderx2%
  56. folderx=%a_scriptdir%
  57. ;======================================================
  58. stringmid,datex,a_now,1,10
  59. HK1=Esc
  60.   Hotkey,%hk1%,pause1,ON
  61. ;================ MENU =========================
  62. Menu,S1 ,add,NOS-live                ,NOS_Live
  63. Menu,S1a,add,NOS-gisteren            ,NOS_gisteren
  64. Menu,S2 ,add,Podcast-de              ,Podcast-de
  65. Menu,S2 ,add,Podcast-NDR             ,EXTRA3_Podcast
  66. Menu,S7,add,EDIT_ThisScript          ,MH7
  67. Menu,S8,add,OPEN_ThisFolder          ,MH8
  68. Menu,S9,add,RELOAD                   ,MH9
  69. ;-----------------------------------------------
  70. menu,myMenuBar,Add,NOS               ,:S1
  71. menu,myMenuBar,Add,NOS_Yesterday     ,:S1a
  72. menu,myMenuBar,Add,EXTRA-3           ,:S2
  73. menu,myMenuBar,Add,ThisScript        ,:S7
  74. menu,myMenuBar,Add,ThisFolder        ,:S8
  75. menu,myMenuBar,Add,RELOAD            ,:S9
  76. ;--------------------
  77. gui,2:menu,MyMenuBar
  78. ;------------------------------------------------
  79. whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
  80. ComObjError(false)
  81. whr.Silent := True    ;- script failure = off
  82. whr.SetTimeouts(500,500,500,500)
  83. xxa=Shell.Explorer    ;- IExplorer
  84. ;xxa=Mozilla.Browser    ;- Mozilla Firefox
  85. x:=(wa*10)/xx ,y:=(ha*.1)/xx,w:=(wa*88)/xx,h:=(ha*65)/xx
  86. ifexist,%vlc1%
  87.    Gui,2:Add,ActiveX, x%x% y%y% w%w% h%h% vVlcx, VideoLAN.VLCPlugin.2
  88. else
  89.    {
  90.    Gui,2:Add,ActiveX, x%x% y%y% w%w% h%h% vWB1 ,%xxa%
  91.    WB1.Silent := True
  92.    ComObjError(false)
  93.    }
  94.  
  95. ;------------- VOLUME slider -------------------------------
  96. ;------------------------------------------------------------
  97. soundset,0,WAVE,mute             ; WAVE ON
  98. SM5=80                           ; set volume level
  99. soundset,0,master,mute           ; master ON
  100. SoundSet,%SM5%,master            ; master
  101. x:=(wa*70)/xx ,y:=(ha*80)/xx,w:=(wa*20)/xx,h:=(ha*3)/xx
  102. Gui,2:Add, Slider  , x%x%  y%y%  w%w%  h%h%      altsubmit    vVOL12a gVOL12 backgroundGray Range0-100  center page0 tooltip thick55 left line10,%sm5%
  103. ;------------------------------------------------------------
  104.  
  105.  
  106. ;--- lines down ---
  107. x:=(wa*8)/xx ,y:=(ha*68)/xx,w:=(wa*80)/xx,h:=(ha*2)/xx
  108. Gui,2:Add, Progress,  x%x%  y%y% w%w% h%h% vPRBAR backgroundGray range0-100 Disabled
  109. Gui,2:Add, Text, x%x% y%y% w%w% h%h% gPrBar1 ,
  110. x:=(wa*.2)/xx ,y:=(ha*68)/xx,w:=(wa*2)/xx,
  111. Gui,2:Add,Text,       x%x%    y%y% w%w%    vT1 cYellow   ;- procent
  112. x:=(wa*3)/xx ,y:=(ha*68)/xx,w:=(wa*4.2)/xx,
  113. Gui,2:Add,Text,       x%x%   y%y% w%w%     vT2 cYellow   ;- played time actual
  114. x:=(wa*88.5)/xx ,y:=(ha*68)/xx,w:=(wa*4.2)/xx,
  115. Gui,2:Add,Text,       x%x% y%y% w%w%       vT3 cYellow   ;- total lenght from video
  116. x:=(wa*93)/xx ,y:=(ha*68)/xx,w:=(wa*6)/xx,
  117. Gui,2:Add,Text,       x%x% y%y% w%w%       vT5 cYellow   ;- vlc state playing paused
  118. ;------------
  119. ;--- buttons left ----
  120. x:=(wa*.1)/xx ,y:=(ha*.5)/xx,w:=(wa*7)/xx,h:=(ha*2.3)/xx
  121. Gui,2:add, Button  , x%x%    y%y%  w%w% h%h%   gFileX  ,File
  122. ;----------------------------
  123. y:=(ha*3.5)/xx
  124. Gui,2:add, Button  , x%x%   y%y%  w%w% h%h%   gExtra_3,Extra-3
  125. ;----------------------------
  126. y:=(ha*6.5)/xx
  127. Gui,2:add, Button  , x%x%   y%y%  w%w% h%h%   gYoutubeX   ,Youtube
  128. ;----------------------------
  129. y:=(ha*9.5)/xx
  130. Gui,2:add, Button  , x%x%   y%y%  w%w% h%h%   gLastINI   ,LAST_ini
  131. ;--------------------------
  132. ;-------- 2nd lines down ------------
  133. y:=(ha*72)/xx
  134. ifexist,%vlc1%
  135.   {
  136.   x:=(ha*.1)/xx
  137.   Gui,2:add, Button  , x%x%   y%y%  w%w% h%h%   gSnapshot vSnapshot1, SNAPSHOT
  138.   }
  139. ;------------------------------------
  140. x:=(wa*7.8)/xx
  141. Gui,2:add,Text,x%x% y%y% cYellow,[ESC=PAUSE/PLAY]
  142. ;------------------------------------
  143. x:=(wa*20)/xx,w:=(wa*3.5)/xx
  144. Gui,2:add,Button   , x%x%   y%y%  w%w% h%h%  vPLAY11 gPLAY1,PLAY
  145. ;----------------------------
  146. x:=(wa*24)/xx,w:=(wa*3.5)/xx
  147. Gui,2:add,Button   , x%x%   y%y%  w%w% h%h%  vSTOP11 gSTOP,STOP
  148. ;----------------------------
  149. x:=(wa*28)/xx,w:=(wa*7)/xx
  150. Gui,2:add,Button   , x%x%   y%y%  w%w% h%h%  vDownload1 gDownload, DOWNLOAD
  151. ;----------------------------
  152. x:=(wa*35.5)/xx
  153. Gui,2:add,Button   , x%x%   y%y%  w%w% h%h%  gFolder,Folder
  154. ;----------------------------
  155. x:=(wa*43)/xx,w:=(wa*5)/xx
  156. Gui,2:add, Button  , x%x%    y%y%  w%w% h%h%   g2nd_GUI,Full
  157. ;----------------------------
  158. a5xx=00:00:10   ;- Jump Back
  159. a6xx=00:00:20   ;- Jump Forward
  160. a7xx=00:02:25   ;- GoTo Seek
  161. ;----------------------------
  162. Gui,2:Font,  S14 cGray ,Lucida Console
  163. x:=(wa*40)/xx,y:=(ha*76)/xx,w:=(wa*6)/xx,h:=(ha*2.3)/xx
  164. Gui,2:Add,Edit,cGray right  x%x%  y%y%    w%w%   h%h%   vJumpB,%a5xx%        ;-- Jump backward
  165. ;----------------------------
  166. y:=(ha*80)/xx
  167. Gui,2:Add,Button,           x%x%  y%y%    w%w%   h%h%   gGoto1B   vGoto1B2   ,<SKIP
  168. ;----------------------------
  169. x:=(wa*47)/xx,y:=(ha*76)/xx
  170. Gui,2:Add,Edit,cGray right  x%x%  y%y%    w%w%   h%h%   vJumpF,%a6xx%        ;-- Jump forward
  171. ;----------------------------
  172. y:=(ha*80)/xx
  173. Gui,2:Add,Button,           x%x%  y%y%    w%w%   h%h%   gGoto1F   vGoto1F2   ,SKIP>
  174. ;----------------------------
  175. x:=(wa*54)/xx,y:=(ha*76)/xx
  176. Gui,2:Add,Edit,cGray right  x%x%  y%y%    w%w%   h%h%   vGotox,%a7xx%        ;-- GotoX
  177. ;----------------------------
  178. y:=(ha*80)/xx
  179. Gui,2:Add,Button,           x%x%  y%y%    w%w%   h%h%   gGoto1X   vGoto1X2   ,GotoX
  180. ;----------------------------
  181. x:=(wa*62)/xx,y:=(ha*76)/xx,w:=(wa*10)/xx
  182. Gui,2:Add,Text     , x%x%  y%y%  w%w%      vMemoryX   cYellow                ;- Memory_used
  183. ;----------------------------
  184. y:=(ha*76)/xx,w:=(wa*40)/xx
  185. Gui,2:Add,Text     , x%x%    y%y% w%w%      vDownloadx cRed                  ;- show when Download
  186. ;----------------------------
  187. Gui,2:Font,  S11 cGray ,Lucida Console
  188. x:=(wa*.1)/xx,y:=(ha*76)/xx,w:=(wa*39)/xx
  189. Gui,2:add, Edit    , x%x%    y%y% w%w% cGray readonly vTxt1                  ;- show URL
  190. ;----------------------------
  191. Gui,2:Add,Text,x0 y0 w0 h0 vEmptyText,
  192. ;----------------------------------------
  193. ;SysGet, wa1, MonitorWorkArea, 1
  194. ;h:=ha-(2.11*(ha-wa1Bottom))              ; 4K H=2160 , hier neu =2090  denn auf 2010
  195. ;w:=(wa*99.9)/xx,
  196. w:=(wa*99.9)/xx,h:=(ha*88)/xx
  197. Gui,2: Show,x0 y0 w%w% h%h%,%name1%   OS=%a_osversion% | AHK=%a_ahkversion% | %a_ostype% | 64bit=%a_is64bitos% | %wa%*%ha% | %a_username%=%a_isadmin% | %a_computername%
  198. ;------------------------------------
  199. ifexist,%vlc1%
  200.   {
  201.   settimer,aas1,1000
  202.   settimer,aas1,off
  203.   }
  204. settimer,memorycheck,1000
  205. GuiControl,2:Disable,download1
  206. GuiControl,2: Focus,EmptyText
  207. gosub,testx
  208. return
  209. ;-------------------------
  210. 2Guiescape:
  211. 2Guiclose:
  212. ;IniWrite,LEER, %rssini% ,A1   , KEY1
  213. exitapp
  214. ;----------------------------------------
  215. PLAY1:
  216. Gui,2:submit,nohide
  217. GuiControl,2:Enable,download1
  218. vlcx.playlist.stop()
  219. vlcx.playlist.items.clear()
  220. vlcx.playlist.add(C2,"","""""")
  221. vlcx.playlist.next()
  222. settimer,aas1,on
  223. gosub,clearall
  224. GuiControl,2:Text,T5,PLAY
  225. ;gosub,play
  226. return
  227. ;-------------------------------------------
  228. TESTx:
  229. ;msgbox, 262208, ,EMPTY
  230. ;urlx=https://www.npostart.nl/nos-journaal/15-01-2021/POW_04817228
  231. ;WB1.Navigate(urlx)
  232. if C2<>
  233.   {
  234.   Guicontrol,2:,txt1,%C2%
  235.   GuiControl,2:Enable,download1
  236.   gosub,Play
  237.   }
  238. else
  239.   msgbox, 262208, ,Error C2=%c2%
  240. return
  241. ;----------------------------------------
  242. LASTINI:
  243. IniRead, C2, %rssini% , A1 , Key1
  244. if C2<>
  245.   {
  246.   Guicontrol,2:,txt1,%C2%
  247.   GuiControl,2:Enable,download1
  248.   gosub,Play
  249.   }
  250. else
  251.   msgbox, 262208, ,Error C2=%c2%
  252. return
  253. ;-----------  STOP ----------------------
  254. STOP:
  255. settimer,aas1,off
  256. GuiControl,2:Disable,download1
  257. settimer,aas1,off
  258. vlcx.playlist.stop()
  259. vlcx.playlist.items.clear()
  260. GuiControl,2:Text,T5,Stopped
  261. gosub,clearall
  262. return
  263. ;------------------------------------------------------
  264. ;========== CLEAR ===================
  265. clearall:
  266.  GuiControl,2:Text,T1,
  267.   GuiControl,2:Text,T2,
  268.   GuiControl,2:Text,T3,
  269.   Guicontrol,2:text,T5
  270.   Guicontrol,2:text,Txt1
  271.   Guicontrol,2:text,prbar
  272.   GuiControl,2:,PRBAR,0
  273.   GuiControl,2:Text,Procentx   ,0`%
  274. return
  275. ;-------------------------------------
  276.  
  277. ;--------------------------
  278. ;--------------------- 2-nd GUI example ------------
  279. 2nd_GUI:   ;- example
  280. wa:=A_screenwidth,ha:=A_screenHeight,xx:=101
  281. filename2=TEST 2nd-GUI
  282. Gui,3: -DPIScale
  283. Gui,3: +HwndBId  -Caption -Border
  284. Gui,3:Color,Black,Gray
  285. Gui,3:Font,s13 cGray,Lucida Console
  286. Gui,3:default
  287. settimer,aas1,off
  288.  vlcx.playlist.stop()
  289.  vlcx.playlist.items.clear()
  290. gosub,clearall
  291. GuiControl,2:Disable,download1
  292. x:=(wa*2)/xx ,y:=(ha*1)/xx,w:=(wa*92)/xx,h:=(ha*89)/xx
  293. ifexist,%vlc1%
  294.    Gui,3:Add,ActiveX, x%x% y%y% w%w% h%h% vVlcy, VideoLAN.VLCPlugin.2
  295. else
  296.    {
  297.    Gui,3:Add,ActiveX, x%x% y%y% w%w% h%h% vWB1 ,%xxa%
  298.    WB1.Silent := True
  299.    ComObjError(false)
  300.    }
  301. idx=iCKMzrPy4t4
  302. ;idx=nJhNUE2tbS8  ; nicht verfügbar / privat
  303.    c2=https://www.youtube.com/watch?v=%idx%
  304.    ;c2=https://youtu.be/%idx%
  305.    vlcy.playlist.stop()
  306.    vlcy.playlist.items.clear()
  307.    vlcy.playlist.add(C2,"","""""")
  308.    vlcy.playlist.next()
  309.    ;settimer,aas1,on
  310. x:=(wa*90)/xx,y:=(ha*92)/xx,w:=(wa*5)/xx,h:=(ha*2.5)/xx
  311. Gui,3: add,button,     x%x%  y%y%  w%w%  h%h% gChildDestroyall ,Close
  312. w:=(wa*99.9)/xx,h:=(ha*97)/xx
  313. Gui,3:Show,x0 y0 w%w% h%h%,%filename2%
  314. return
  315. ;----------------
  316. ;------------------------------------------------------
  317. childdestroyall:
  318. vlcy.playlist.stop()
  319. vlcy.playlist.items.clear()
  320. Gui,3:destroy
  321. gosub,stop
  322. return
  323. ;---------------------------
  324. ;==================== END 2nd-GUI example =========
  325. ;-------------------------
  326. Prbar1:
  327. gui,2:submit,nohide
  328. vlcx.playlist.items.clear()
  329. gosub,checkx
  330. if (acc=0 or bcx=0)
  331.    return
  332. MouseGetPos,xpos
  333. ;---
  334. ;GuiControlGet,prbar, Pos
  335. ;msgbox, 262208, ,X-Mouse=%xpos%`nX=%prbarX%`nY=%prbarY%`nHeight=%prbarH%`nWidth=%prbarW%,9
  336. ;return
  337. ;x000:=(wa*15)/xx
  338. x100:=(wa*80)/xx
  339. ;procent  :=round((100*xpos)/x100)-10.5
  340. afc:=(wa*.2734375)/xx
  341. procent  :=round((100*xpos)/x100)-afc
  342. calctime :=((bc*procent)/100)
  343. ;msgbox,CALC=%calctime%`nLenght=%bcx%`nNow=%acc%
  344. vlcx.input.time :=(calctime)
  345. return
  346. ;---------------------------------
  347. ;================== MENU ==================
  348. mh7:
  349. ifexist,%editorx1%
  350.     run,%editorx1% "%a_scriptfullpath%"
  351. else
  352.   run, notepad "%a_scriptfullpath%"
  353. return
  354. ;------------------
  355. mh8:
  356. run,%a_scriptdir%
  357. return
  358. ;------------------
  359. mh9:
  360. reload
  361. return
  362. ;------------------
  363. podcast-de:
  364. run,https://www.podcast.de/podcast/615938/
  365. return
  366. ;------------------
  367. EXTRA3_Podcast:
  368. run,http://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html
  369. return
  370. ;------------------
  371. nos_live:
  372. run,https://nos.nl/livestream/npo-nieuws.html
  373. return
  374. ;------------------
  375. nos_gisteren:
  376. run,https://www.npostart.nl/nos-journaal/NOSJournaal/episode
  377. return
  378. ;------------------
  379. folder:
  380. run,%folderx2%
  381. return
  382. ;------------------
  383. ;========= END MENU =========================================
  384. ;------------------
  385. #IfWinActive ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exe
  386. ~left::
  387. Goto1B:
  388. vlcx.playlist.items.clear()   ;--(?)
  389. acx:=vlcx.input.time
  390. guicontrolget,jumpb
  391. varxx=%jumpb%
  392. gosub,gosubtimecalc
  393. vlcx.input.time :=(-total+acx)
  394. return
  395. ;------------------
  396. ~right::
  397. Goto1F:
  398. vlcx.playlist.items.clear()   ;--(?)
  399. acx:=vlcx.input.time
  400. guicontrolget,jumpf
  401. varxx=%jumpf%
  402. gosub,gosubtimecalc
  403. endtotal:=(total+acx)
  404. if (endtotal>=bc)
  405.    endtotal:=(bc-10000)        ;- goto endtotal minus 10 sec
  406. vlcx.input.time :=(endtotal)
  407. return
  408. #IfWinActive
  409. ;------------------
  410. Goto1X:
  411. gui,2:submit,nohide
  412. vlcx.playlist.items.clear()   ;--(?)
  413. gosub,checkx
  414. if (acc=0 or bcx=0)
  415.    return
  416. guicontrolget,gotoX
  417. varxx=%gotox%
  418. total:=0
  419. gosub,gosubtimecalc
  420. endtotal:=(total)
  421. if (endtotal>bc)
  422.    endtotal:=(bc-10000)       ;- goto endtotal minus 10 sec
  423. vlcx.input.time :=(endtotal)
  424. return
  425. ;========== VLC functions ============================
  426. ;-------- pause / PLAY --------------
  427. pause1:
  428. gui,2:submit,nohide
  429. vlcx.playlist.items.clear()   ;--(?)
  430. vlcx.playlist.togglePause()
  431. return
  432. ;------- check ----------
  433. checkx:
  434. bc:=vlcx.input.length
  435. ac:=vlcx.input.time
  436. acc:=(ac//1000)
  437. bcx:=(bc//1000)
  438. return
  439. ;------------------
  440. SNAPSHOT:
  441. ;- rename saved picture bmp to png ( is in a_scriptdir )
  442. ifexist,%vlc1%
  443.   vlcx.video.takeSnapshot()
  444. return
  445. ;---------------------------------------------
  446. ;=============================================
  447.  
  448.  
  449. ;------------------------------- EXTRA-3 german satire ----------------------------------------
  450. Extra_3:
  451. Gui,2:submit,nohide
  452. gosub,clearall
  453. GuiControl,2:Disable,download1
  454. GuiControl,2:Disable,Snapshot1
  455. ;fx       =%folderx%\DE_NDR_TV_Logfile.txt
  456. C2:=""
  457. url:="https://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.xml"
  458. whr.Open("GET",URL, true)
  459. whr.Send()    ; Using 'true' above and the call below allows the script to remain responsive.
  460. whr.WaitForResponse()
  461. H := whr.ResponseText  ; haystack
  462. ;------------------------
  463. B=<enclosure url="
  464. E="
  465. C2:=xStr(H,,B,E)
  466. Guicontrol,2:,txt1,%C2%
  467. ;C2:="https://mediandr-a.akamaihd.net/download/podcasts/extradrei196/TV-20210108-1424-4800.hi.mp4"
  468. if C2<>
  469.   {
  470.   Guicontrol,2:,txt1,%C2%
  471.   ;fileappend,%C2%`r`n,%fx%
  472.   GuiControl,2:Enable,download1
  473.   gosub,Play
  474.   }
  475. else
  476.   msgbox, 262208, ,Error read URL
  477. return
  478. ;======================================
  479. FileX:
  480. Gui,2:submit,nohide
  481. gosub,clearall
  482. GuiControl,2:Disable,download1
  483. GuiControl,2:Disable,Snapshot1
  484. ;msgbox, 262208, ,Nothing YET
  485. GuiControl,2:Disable,download1
  486. C2=D:\VIDEOS\FOOD.m3u    
  487. ifexist,%c2%
  488. {
  489. SplitPath,C2, name, dir, ext, name_no_ext, drive
  490. Guicontrol,2:text,Txt1,%name%
  491. stringreplace,C2,C2,\,/,all
  492. C2:="file:///" . C2
  493. gosub,Play
  494. }
  495. else
  496.  msgbox, 262208, ,File %c2%`nNot exists
  497. return
  498. ;======================================
  499. YoutubeX:
  500. Gui,2:submit,nohide
  501. gosub,clearall
  502. GuiControl,2:Disable,download1
  503. GuiControl,2:Disable,Snapshot1
  504. ;F1=pt_Zanguei-me com o meu amor$nKKBmnIfQxg
  505. F1=Rotterdam2Amsterdam$https://www.youtube.com/watch?v=HfPCdJapIXA
  506. stringsplit,k,F1,`$
  507. Guicontrol,2:text,Txt1,%k1%
  508. ;c2=https://www.youtube.com/watch?v=%k2%
  509. ;c2=https://youtu.be/%k2%
  510. c2=%k2%
  511. gosub,play
  512. return
  513. ;======================================
  514. Play:
  515. Gui,2:submit,nohide
  516. ifexist,%vlc1%
  517.    {
  518.    vlcx.playlist.stop()
  519.    vlcx.playlist.items.clear()
  520.    vlcx.playlist.add(C2,"","""""")
  521.    vlcx.playlist.next()
  522.    settimer,aas1,on
  523.    }
  524. else
  525.    WB1.Navigate(C2)
  526. return
  527. ;======================================
  528.  
  529. ;-------------- DOWNLOAD -----------------------
  530. download:
  531. Gui,2:submit,nohide
  532. GuiControl,2:Disable,download1
  533. stringmid,datex,a_now,1,10
  534. SplitPath,C2, name, dir, ext, name_no_ext, drive
  535. stringreplace,name,name,`%20,%A_space%,all            ;replace `%20 with space
  536. new=%folderx2%\%datex%_%name%
  537. new2=%folderx2%
  538. ;--------------------------------
  539. if (ext="m3u8")
  540.   {
  541.   GuiControl,2:Text,downloadx,Download_m3u8...%C2%
  542.   youtubedl:=a_scriptdir . "\youtube-dl.exe"       ;<<< youtube-dl.exe in a_scriptdir
  543.   ifexist,%youtubedl%
  544.      {
  545.      loop,%youtubedl%        
  546.          SP1:=A_loopFileShortPath
  547.      ;RunWait, %comspec% /k %sp1% %C2% --verbose --youtube-skip-dash-manifest -o "%new2%\`%(title)s$`%(uploader)s$`%(id)s.`%(ext)s"
  548.      RunWait, %comspec% /c %sp1% %C2% --verbose --youtube-skip-dash-manifest -o "%new2%\`%(title)s$`%(uploader)s$`%(id)s.`%(ext)s",,hide
  549.      GuiControl,2:Text,downloadx,
  550.      ;msgbox, 262208,END ,DOWNLOAD %c2% Finished
  551.      ifexist,%new2%
  552.          run,%new2%
  553.      }
  554.   }
  555. ;--------------------------------
  556. else
  557.   {
  558.   GuiControl,2:Text,downloadx,Download...%C2%
  559.   ;runwait,%comspec% /c wget %C2% -nc -O "%new%",,hide,PID3
  560.   urldownloadtofile,%C2%,%new%
  561.   GuiControl,2:Text,downloadx,
  562.   ifexist,%new%
  563.       run,%new%
  564.   }
  565. return
  566. ;----------------------------------------------
  567. ;----- volumex -------------------------------
  568. VOL11:
  569. GuiControlGet, VOL11a
  570. SoundSet,%vol11a%,WAVE
  571. return
  572. ;----- volumex ----------
  573. VOL12:
  574. GuiControlGet, VOL12a
  575. ;Guicontrol,2:,T1,%VOL12a%
  576. SoundSet,%vol12a%,master
  577. return
  578. ;------------------------
  579. ;=========== settimer progressbar ==================
  580. aas1:
  581. gui,2:submit,nohide
  582. bc:=vlcx.input.length
  583. ac:=vlcx.input.time
  584. acc:=(ac//1000)
  585. bcx:=(bc//1000)
  586. if (acc=0 or bcx=0)
  587.    return
  588. ;msgbox, 262208, ,acc=%acc%`nbcx=%bcx% , 1
  589. SetFormat, float, 02
  590. hours1   := (acc//3600)
  591. minutes1 := (acc - hours1 * 3600)// 60
  592. seconds1 := (acc - hours1 * 3600 - minutes1 * 60)
  593. hours1  +=0.00
  594. minutes1+=0.00
  595. seconds1+=0.00
  596. acc=%hours1%:%minutes1%:%seconds1%
  597. ;------- played-time ---------------
  598. hours   := (bcx//3600)
  599. minutes := (bcx - hours * 3600)// 60
  600. seconds := (bcx - hours * 3600 - minutes * 60)
  601. hours  +=0.00
  602. minutes+=0.00
  603. seconds+=0.00
  604. bcx=%hours%:%minutes%:%seconds%
  605. ;----- total-time ----------------
  606. ay:=vlcx.input.state
  607. if (ay=0)
  608.    cy=Idle
  609. if (ay=1)
  610.    cy=Opening
  611. if (ay=2)
  612.    cy=Buffering
  613. if (ay=3)
  614.    cy=Playing
  615. if (ay=4)
  616.    cy=Paused
  617. if (ay=5)
  618.    cy=Stopped
  619. if (ay=7)
  620.    cy=Error
  621. if (ay=6)
  622.    {
  623.    cy=Ended
  624.    GuiControl,2:Text,T5,%cy%
  625.    settimer,aas1,off
  626.    GuiControl,2:,PRBAR,100
  627.    GuiControl,2:Text,Procentx   ,100`%
  628.    return
  629.    }
  630. GuiControl,2:Text,T5,%cy%
  631.     RES1:=Round((100*AC)/BC)
  632.     GuiControl,2:,PRBAR ,%res1%
  633. GuiControl,2:Text,T1    ,%res1%`%   ;- procent
  634. GuiControl,2:Text,T2    ,%acc%      ;- PlayedTime
  635. GuiControl,2:Text,T3    ,%bcx%      ;- Lenght
  636. if (CY="Paused") or (CY="Playing")
  637.   GuiControl,2:Enable,Snapshot1
  638. return
  639. ;===============  timecalc ===========
  640. gosubtimecalc:
  641. total:=0
  642. y1=
  643. y2=
  644. y3=
  645.   stringsplit,Y,varxx,`:
  646.   if y3<>
  647.   {
  648.   hours:=(y1*60*60)*1000
  649.   minutes:=(y2*60)*1000
  650.   seconds:=(y3*1000)
  651.   total:=(hours+minutes+seconds)
  652.   }
  653.   if (y3="" and y2<>"")
  654.   {
  655.   minutes:=(y1*60)*1000
  656.   seconds:=(y2*1000)
  657.   total:=(minutes+seconds)
  658.   }
  659.   if (y3="" and y2="")
  660.      total:=(varxx*1000)
  661. return
  662. ;======================================
  663. ;-------- saved at Samstag, 3. Februar 2018 12:08:11 --------------
  664. ;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=43654 ---
  665. memorycheck:
  666. memx:=checkWorkingset()//1024 . "-kB-RAM"
  667. GuiControl,2:Text,MemoryX,%memx%
  668. return
  669. checkWorkingset(pid:=""){
  670.     static wmi:=comObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . a_computerName . "\root\cimv2")
  671.     pid:=pid?pid:dllCall("GetCurrentProcessId")
  672.     processInfo:=wmi.execQuery("select WorkingSetSize,ProcessId from Win32_Process")._NewEnum
  673.     while(processInfo[item]){
  674.         if(item.processId=pid){
  675.             workingSet:=item.WorkingSetSize
  676.             break
  677.         }
  678.     }
  679.     return workingSet
  680. }
  681. ;-----------------------------------------------------------------
  682. ;-------- saved at Dienstag, 7. April 2020 16:34:11 SKAN --------------
  683. ;- xStr  for general text extraction and parsing XML  HTML
  684. ;- https://www.autohotkey.com/boards/viewtopic.php?f=6&t=74050
  685. xStr(ByRef H, C:=0, B:="", E:="",ByRef BO:=1, EO:="", BI:=1, EI:=1, BT:="", ET:="") {                          
  686. Local L, LB, LE, P1, P2, Q, N:="", F:=0                 ; xStr v0.97 by SKAN on D1AL/D343 @ tiny.cc/xstr  
  687. Return SubStr(H,!(ErrorLevel:=!((P1:=(L:=StrLen(H))?(LB:=StrLen(B))?(F:=InStr(H,B,C&1,BO,BI))?F+(BT=N?LB
  688. :BT):0:(Q:=(BO=1&&BT>0?BT+1:BO>0?BO:L+BO))>1?Q:1:0)&&(P2:=P1?(LE:=StrLen(E))?(F:=InStr(H,E,C>>1,EO=N?(F
  689. ?F+LB:P1):EO,EI))?F+LE-(ET=N?LE:ET):0:EO=N?(ET>0?L-ET+1:L+1):P1+EO:0)>=P1))?P1:L+1,(BO:=Min(P2,L+1))-P1)  
  690. }
  691. ;=-=-=-=-=-=- END Script VideoPlay ActiveX-=-=-=-=-=-=-=-=-
  692. #S::Suspend
  693. #P::Pause
  694. #R::Reload
  695. ESC::ExitApp
  696.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement