Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* INFO
- VLC VIDEOS PLAYER
- Written by: Najeeb Shah Khan (najeebshahkhan@gmail.com)
- Last Modified: 3-20-2023
- ESC to STOP/PLAY > minimize / maximize
- */
- ;#warn
- #NoEnv
- #SingleInstance, Force
- Process, Priority, , A
- SendMode, Input
- SetTitleMatchMode,2
- SetBatchLines, -1
- ;#NoTrayIcon
- SetWorkingDir %A_ScriptDir%
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- FileCreateDir, %A_ScriptDir%\DATA
- FileSetAttrib +HS, %A_ScriptDir%\DATA, 2
- FileInstall , VLC-PLAYER2.ahk, %A_ScriptDir%\DATA\VLC-PLAYER2.ahk, 1
- FileSetAttrib +HS, %A_ScriptDir%\DATA\VLC-PLAYER2.ahk, 2
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- wa:=A_screenwidth,ha:=A_screenHeight,xx:=100
- fontsize1=12
- Gui,2:default
- Gui,2: +HwndAId +0x2000000 ; +WS_CLIPCHILDREN Fixes drawing problems with child.
- Gui,2: -DPIScale hwndUID
- SS_REALSIZECONTROL := 0x40
- Gui,2:Color,Black,Black
- ;Gui,2:Font,s%fontsize1% cGray,Lucida Console
- Gui,2: Font, s9, Lucida Console
- stringmid,datex,a_now,1,10
- global C2,T2
- ;-
- Name1=NAJEEB PLAY_VLC_ACTIVE-X_MP3_MP4_PICTURE
- ;-
- ;======================================================
- hotkey, IfWinActive,%name1% ahk_class AutoHotkeyGUI
- Hotkey,SPACE,pause1,ON
- hotkey, IfWinExist,%name1% ahk_class AutoHotkeyGUI
- hotkey,ESC,aabb
- ;======================================================
- ;-------------------------------------------
- editorx1=C:\Program Files\Notepad++\notepad++.exe
- ifnotexist,%editorx1%
- editorx1:=""
- vlc1 =%A_programfiles%\VideoLAN\VLC\vlc.exe ;- VLC should be installed for ActiveX
- dlm:=";"
- ;-
- FDMusic :="D:\VIDEOS\MP3" ;- Folder Music
- FDVideo :="D:\VIDEOS\SONGS" ;- Folder Video
- FDPictures :="D:\TOOLS\WALLP" ;- Folder Pictures for random pictures used for audio-file which not contains thumbnail-picture
- ;-
- videoextensions :="flv,vob,mp4,mpg,wmv,avi,webm,m4a,mp3,wma,ogg,m3u,m3u8"
- musicextensions :="mp3,wav,aac,flac,aif,ogg"
- picturesextensions:="jpg,bmp,png"
- ;-
- ;---------------------
- RSSINI=%A_scriptdir%\%name1%_RSSINI.txt
- ifnotexist,%rssini%
- {
- xxca:="https://mediandr-a.akamaihd.net/download/podcasts/extradrei196/TV-20210108-1424-4800.hi.mp4"
- IniWrite,%xxca% , %rssini% ,A1 , KEY1
- Iniwrite,00:00:10, %rssini% ,A2 , KEY1
- }
- LastPlayedTEXT:=a_scriptdir . "\" . name1 . "_LastPlayed.txt"
- ;--------------------------------------------------
- ;------- PICTURES for RANDOM-read ---------------------------
- countP:=0
- Loop, %FDPictures%\*.*,,1
- {
- if A_LoopFileExt in %picturesextensions%
- {
- countP++
- list_%countp% = %A_LoopFileShortPath%
- name_%countp% = %A_LoopFileName%
- }
- }
- gosub,randomtest1
- ;------------------------------------------------
- whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
- ComObjError(false)
- whr.Silent := True ;- script failure = off
- whr.SetTimeouts(500,500,500,500)
- ;-------------------------------------------------
- x:=(wa*.1)/xx,y:=(ha*3.1)/xx,w:=(wa*15.7)/xx,h:=(ha*74)/xx
- Gui,2:Add, ListView,backgroundTeal cWhite x%x% y%y% h%h% w%w% +hscroll +altsubmit gLW1 vLV1 , NAME|PATH|TIME
- T1:=(wa*14.7)/xx,T2:=(wa*0)/xx,T3:=(wa*0)/xx
- LV_ModifyCol(1,T1),LV_ModifyCol(2,T2),LV_ModifyCol(3,T3)
- ;-
- x:=(wa*16)/xx ,y:=(ha*1)/xx,w:=(wa*82)/xx,h:=(ha*76)/xx
- Gui,2:Add,ActiveX, x%x% y%y% w%w% h%h% vVlcx, VideoLAN.VLCPlugin.2
- ;------------------------------------------------------------
- ;--- lines down ---
- x:=(wa*8)/xx ,y:=(ha*80)/xx,w:=(wa*80)/xx,h:=(ha*2)/xx
- Gui,2:Add, Progress, x%x% y%y% w%w% h%h% vPRBAR backgroundGray range0-100 Disabled
- Gui,2:Add, Text, x%x% y%y% w%w% h%h% gPrBar1 ,
- x:=(wa*.2)/xx ,y:=(ha*80)/xx,w:=(wa*2)/xx,
- Gui,2:Add,Text, x%x% y%y% w%w% vT1 cYellow ;- procent
- x:=(wa*3)/xx ,y:=(ha*80)/xx,w:=(wa*4.2)/xx,
- Gui,2:Add,Edit, x%x% y%y% w%w% vT2 cYellow ;- played time actual
- x:=(wa*88.5)/xx ,y:=(ha*80)/xx,w:=(wa*4.2)/xx,
- Gui,2:Add,Edit, x%x% y%y% w%w% vT3 cYellow ;- total lenght from video
- x:=(wa*93)/xx ,y:=(ha*80)/xx,w:=(wa*6)/xx,
- Gui,2:Add,Text, x%x% y%y% w%w% vT5 cYellow ;- vlc state playing paused
- ;------------
- ;--- buttons left top ----
- ;--------------------------
- x:=(wa*.1)/xx ,y:=(ha*.5)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:add, Button , x%x% y%y% w%w% h%h% gMUSIC,MUSIC
- x:=(wa*5.2)/xx ,y:=(ha*.5)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:add, Button , x%x% y%y% w%w% h%h% gVIDEO,VIDEO
- x:=(wa*10.4)/xx ,y:=(ha*.5)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:add, Button , x%x% y%y% w%w% h%h% gExtra_3,Extra3
- ;-------- 2nd lines down ------------
- x:=(wa*.1)/xx ,y:=(ha*83.2)/xx,w:=(wa*7)/xx,h:=(ha*2.3)/xx
- Gui,2:add, Button , x%x% y%y% w%w% h%h% gSnapshot vSnapshot1, SNAPSHOT
- ;------------------------------------
- x:=(wa*13)/xx,y:=(ha*83.2)/xx,w:=(wa*7.5)/xx,h:=(ha*2.3)/xx
- Gui,2:add,Button , x%x% y%y% w%w% h%h% vLastPLAY gLastini,PLAY_NEW
- ;----------------------------
- x:=(wa*21)/xx,y:=(ha*83.2)/xx,w:=(wa*3.5)/xx,h:=(ha*2.3)/xx
- Gui,2:add,Button , x%x% y%y% w%w% h%h% vSTOP11 gSTOP,STOP
- ;----------------------------
- a5xx=00:00:10 ;- Jump Back
- a6xx=00:00:20 ;- Jump Forward
- a7xx=00:02:25 ;- GoTo Seek
- ;----------------------------
- Gui,2: Font, s9, Lucida Console
- x:=(wa*40)/xx,y:=(ha*83.2)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:Add,Edit,cYellow right x%x% y%y% w%w% h%h% vJumpB,%a5xx% ;-- Jump backward
- ;----------------------------
- x:=(wa*40)/xx,y:=(ha*87)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:Add,Button, x%x% y%y% w%w% h%h% gGoto1B vGoto1B2 ,<SKIP
- ;----------------------------
- x:=(wa*46)/xx,y:=(ha*83.2)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:Add,Edit,cYellow right x%x% y%y% w%w% h%h% vJumpF,%a6xx% ;-- Jump forward
- ;----------------------------
- x:=(wa*46)/xx,y:=(ha*87)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:Add,Button, x%x% y%y% w%w% h%h% gGoto1F vGoto1F2 ,SKIP>
- ;----------------------------
- x:=(wa*52)/xx,y:=(ha*83.2)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:Add,Edit,cYellow right x%x% y%y% w%w% h%h% vGotox,%a7xx% ;-- GotoX
- ;----------------------------
- x:=(wa*52)/xx,y:=(ha*87)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
- Gui,2:Add,Button, x%x% y%y% w%w% h%h% gGoto1X vGoto1X2 ,GotoX
- ;----------------------------
- Gui,2: Font, s9, Lucida Console
- x:=(wa*.1)/xx,y:=(ha*87)/xx,w:=(wa*39)/xx
- Gui,2:add, Edit , x%x% y%y% w%w% cYellow readonly vTxt1 ;- show URL
- ;----------------------------
- Gui,2:Add,Text,x0 y0 w0 h0 vEmptyText,
- ;----------------------------------------
- w:=(wa*99.9)/xx,h:=(ha*90)/xx
- 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%
- ;------------------------------------
- settimer,aas1,500
- settimer,aas1,off
- GuiControl,2:Disable,Snapshot1
- GuiControl,2: Focus,EmptyText
- sleep,500
- return
- ;-----------------------------------------------------------------------------------------------------
- 2Guiclose:
- Gui,2:submit,nohide
- sleep,200
- IniWrite,%T2%, %rssini% , A2 , Key1
- ;IniRead, C2a, %rssini% , A1 , Key1
- ;Fileappend,%c2a%`;%t2%`r`n,%LastPlayedTEXT%,utf-8
- sleep,200
- exitapp
- ;----------------------------------------
- ;-- used ESCAPE -------------------------
- aabb:
- Gui,2:submit,nohide
- ay:=vlcx.input.state
- WinGet, IsMin, MinMax, % "ahk_id " uid
- if (IsMin = -1)
- {
- WinRestore, % "ahk_id " uid
- if winexist(name1)
- Hotkey,SPACE,pause1,ON
- Guicontrolget,T5
- if (ay=4)
- gosub,pause1
- }
- else
- {
- Winminimize
- if winexist(name1)
- Hotkey,SPACE,pause1,OFF
- if (ay=3)
- gosub,pause1
- }
- return
- ;-----------------------------------------
- LASTINI:
- Gui,2:submit,nohide
- if winactive(name1)
- Hotkey,SPACE,pause1,ON
- IniRead, C2, %rssini% , A1 , Key1
- if C2<>
- {
- Guicontrol,2:,txt1,%C2%
- gosub,VideoAudioPLAY
- }
- else
- msgbox, 262208, ,Error C2=%c2%
- return
- ;======================================
- VideoAudioPLAY:
- Gui,2:submit,nohide
- gosub,checkc2
- if (checkvar="OK")
- {
- vlcx.playlist.stop()
- vlcx.playlist.items.clear()
- vlcx.playlist.add(C2,"","""""")
- vlcx.playlist.next()
- settimer,aas1,on
- }
- else
- msgbox, 262144, ,Not exist =`n%c2%
- return
- ;======================================
- ;-----------------------------------------
- Playfile:
- Gui,4:destroy
- Gui,2:submit,nohide
- gosub,checkc2
- if (checkvar="OK")
- {
- vlcx.playlist.stop()
- vlcx.playlist.items.clear()
- vlcx.playlist.add(C2,"","""""")
- vlcx.playlist.next()
- settimer,aas1,on
- gosub,clearall
- if ext in %musicextensions%
- gosub,ChildPicture
- }
- else
- msgbox, 262144,NOT FOUND ,Not exist=`n%c2%
- return
- ;----------------------------------------
- ;============= CHECK C2 =============================
- CheckC2:
- if C2 contains file:///
- {
- stringreplace,c2a,c2,file:///,,all
- Guicontrol,2:,txt1,%C2%
- ifexist,%c2a%
- checkvar=OK
- else
- checkvar=NOK
- }
- if C2 contains http
- {
- checkvar=OK
- Guicontrol,2:,txt1,%C2%
- }
- return
- ;----------------------------------------------------
- ;------------------- CHILDNEW for picture -----------
- ChildPicture:
- Gui,4:destroy
- Gui,2:submit,nohide
- Gui,4:Default
- Gui,4: -DPIScale
- Gui,4: Color,Black,black
- Gui,4: +Parent2 -Sysmenu -caption
- imgw:=0,imgh:=0
- if hBitmap := GetThumbnailOrIcon(C2,0,0)
- {
- aa:="HBITMAP:" . GetThumbnailOrIcon(C2,300,300)
- }
- else
- {
- gosub,randomtest2
- imgSize(ShowPic,imgw,imgh)
- aa:=ShowPic
- sleep,100
- }
- ;----------------------------
- px:=(wa*4)/xx,x:=(wa*0)/xx,y:=(ha*0)/xx,w:=(wa*60)/xx,h:=(ha*80)/xx
- if (imgw>imgh)
- Gui,4: Add, Pic,x%x% y%y% w%w% h-1, %aa%
- else if (imgh>imgw)
- Gui,4: Add, Pic,x%px% y%y% h%h% w-1, %aa%
- else
- Gui,4: Add, Pic,x%x% y%y% w%w% h-1, %aa%
- x:=(wa*17)/xx,y:=(ha*1)/xx,w:=(wa*80)/xx,h:=(ha*80)/xx
- Gui,4: Show,x%x% y%y% w%w% h%h% , Child_2
- return
- ;---------------------------------------
- ;--------------- LISTVIEW -------------
- LW1:
- Gui,2:Submit,nohide
- Gui,2:ListView, LV1
- LV_GetText(C1,A_EventInfo,1)
- LV_GetText(C2,A_EventInfo,2)
- LV_GetText(C3,A_EventInfo,3)
- RN:=LV_GetNext("C")
- RF:=LV_GetNext("F")
- GC:=LV_GetCount()
- if (A_GuiEvent = "Normal")
- {
- if (rn=0)
- return
- ;msgbox, 262208,,C1=%c1%`nC2=%c2%
- Guicontrol,2:,txt1,%C2%
- SplitPath,C2, name, dir, ext, name_no_ext, drive
- C2=file:///%c2%
- IniWrite,%C2%, %rssini% ,A1 , KEY1
- gosub,playfile
- return
- }
- ;-------------------------------------------------------------------
- if A_GuiEvent = Rightclick
- {
- ;msgbox, 262208,,C1=%c1%`nC2=%c2%
- gosub,stop
- try
- run,%c2%
- }
- Return
- ;================== END LISTVIEW ===============================================
- MUSIC:
- Gui,2:submit,nohide
- elf:="",lastfiles:=0
- LV_Delete()
- ;---
- I:=0
- Loop, Files,%FDMusic%\*.*,FDR
- {
- SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext, drive
- if ext in %musicextensions%
- elf .= name . " " . dlm . a_loopfilefullpath . "`r`n"
- }
- for each, Line in StrSplit(elf, "`n", "`r")
- {
- if line=
- continue
- Columns := StrSplit(Line,dlm)
- LV_Add("",Columns*)
- }
- if elf=
- msgbox, 262144, ,PATH NOT FOUND =`n %fdmusic%
- elf:="",I:=0
- return
- ;----------------------------------------------
- ;---------- VIDEO -----------------------------
- VIDEO:
- Gui,2:submit,nohide
- elf:="",lastfiles:=0
- LV_Delete()
- ;---
- I:=0
- Loop, Files,%FDVideo%\*.*,FDR
- {
- SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext, drive
- if ext in %videoextensions%
- elf .= name . " " . dlm . a_loopfilefullpath . "`r`n"
- }
- for each, Line in StrSplit(elf, "`n", "`r")
- {
- if line=
- continue
- Columns := StrSplit(Line,dlm)
- LV_Add("",Columns*)
- }
- if elf=
- msgbox, 262144, ,PATH NOT FOUND =`n %FDVideo%
- elf:="",I:=0
- return
- ;----------------------------------------------
- ;=============================================================================
- ;----------- STOP ----------------------
- STOP:
- Gui,2:submit,nohide
- if winexist(name1)
- Hotkey,SPACE,pause1,OFF
- Guicontrolget,T2
- settimer,aas1,off
- GuiControl,2:Disable,Snapshot1
- vlcx.playlist.stop()
- vlcx.playlist.items.clear()
- GuiControl,2:Text,T5,Stopped
- IniWrite,%T2%, %rssini% , A2 , Key1
- gosub,clearall
- 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
- ;-------------------------------------
- ;-------------------------------------
- Prbar1:
- gui,2:submit,nohide
- vlcx.playlist.items.clear()
- gosub,checkx
- if (acc=0 or bcx=0)
- return
- MouseGetPos,xpos
- x100:=(wa*80)/xx
- afc:=(wa*.2734375)/xx
- procent :=round((100*xpos)/x100)-afc
- calctime :=((bc*procent)/100)
- ;msgbox,CALC=%calctime%`nLenght=%bcx%`nNow=%acc%
- vlcx.input.time :=(calctime)
- return
- ;---------------------------------
- ;------------------
- #IfWinActive ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exe
- ~left::
- Goto1B:
- vlcx.playlist.items.clear() ;--(?)
- acx:=vlcx.input.time
- guicontrolget,jumpb
- varxx=%jumpb%
- gosub,gosubtimecalc
- vlcx.input.time :=(-total+acx)
- return
- ;------------------
- ~right::
- Goto1F:
- vlcx.playlist.items.clear() ;--(?)
- acx:=vlcx.input.time
- guicontrolget,jumpf
- varxx=%jumpf%
- gosub,gosubtimecalc
- endtotal:=(total+acx)
- if (endtotal>=bc)
- endtotal:=(bc-10000) ;- goto endtotal minus 10 sec
- vlcx.input.time :=(endtotal)
- return
- #IfWinActive
- ;------------------
- Goto1X:
- gui,2:submit,nohide
- vlcx.playlist.items.clear() ;--(?)
- gosub,checkx
- if (acc=0 or bcx=0)
- return
- guicontrolget,gotoX
- varxx=%gotox%
- total:=0
- gosub,gosubtimecalc
- endtotal:=(total)
- if (endtotal>bc)
- endtotal:=(bc-10000) ;- goto endtotal minus 10 sec
- vlcx.input.time :=(endtotal)
- return
- ;========== VLC functions ============================
- ;-------- pause / PLAY --------------
- pause1:
- gui,2:submit,nohide
- vlcx.playlist.items.clear() ;--(?)
- vlcx.playlist.togglePause()
- return
- ;------- check ----------
- checkx:
- bc:=vlcx.input.length
- ac:=vlcx.input.time
- acc:=(ac//1000)
- bcx:=(bc//1000)
- return
- ;------------------
- SNAPSHOT:
- ;- rename saved picture bmp to png ( is in a_scriptdir )
- ifexist,%vlc1%
- vlcx.video.takeSnapshot()
- return
- ;---------------------------------------------
- ;=============================================
- ;------------------------------- EXTRA-3 german satire ----------------------------------------
- Extra_3:
- Gui,2:submit,nohide
- gosub,clearall
- GuiControl,2:Disable,download1
- GuiControl,2:Disable,Snapshot1
- C2:=""
- url:="https://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.xml"
- whr.Open("GET",URL, true)
- whr.Send() ; Using 'true' above and the call below allows the script to remain responsive.
- whr.WaitForResponse()
- H := whr.ResponseText ; haystack
- ;------------------------
- B=<enclosure url="
- E="
- C2:=xStr(H,,B,E)
- Guicontrol,2:,txt1,%C2%
- Gui,4:destroy
- if C2<>
- {
- Guicontrol,2:,txt1,%C2%
- IniWrite,%C2%, %rssini% ,A1 , KEY1
- gosub,VideoAudioPLAY
- }
- else
- msgbox, 262208, ,Error read URL
- return
- ;=========== settimer progressbar ==================
- aas1:
- gui,2:submit,nohide
- ay:=vlcx.input.state
- if (ay=6)
- {
- GuiControl,2:,PRBAR,100
- GuiControl,2:Text,Procentx ,100`%
- GuiControl,2:Text,T5,ENDed
- settimer,aas1,off
- if winexist(name1)
- Hotkey,SPACE,pause1,OFF
- return
- }
- 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 winactive(name1)
- Hotkey,SPACE,pause1,ON
- 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 ----------------
- 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
- if (CY="Paused") or (CY="Playing")
- GuiControl,2:Enable,Snapshot1
- return
- ;=============== timecalc ===========
- gosubtimecalc:
- total:=0
- y1=
- y2=
- y3=
- stringsplit,Y,varxx,`:
- if y3<>
- {
- hours:=(y1*60*60)*1000
- minutes:=(y2*60)*1000
- seconds:=(y3*1000)
- total:=(hours+minutes+seconds)
- }
- if (y3="" and y2<>"")
- {
- minutes:=(y1*60)*1000
- seconds:=(y2*1000)
- total:=(minutes+seconds)
- }
- if (y3="" and y2="")
- total:=(varxx*1000)
- return
- ;======================================
- ;----------- for picture -------------------------------------
- Randomtest1: ;- run once a list from random numbers
- ;- Lotto / from user Laszlo
- MIN:= 1
- MAX:= countp ;- Total pictures
- N := countp
- i:=0, ex11:=""
- Loop %N%
- {
- i := A_Index
- loop
- {
- Random R, %MIN%, %MAX% ; R = random number
- j := Index_%R% ; get value from Indexes
- If j is number
- If j between 1 and % i - 1
- If (R_%j% = R)
- continue ; repetition found, try again
- Index_%R% := i ; store index
- R_%i% := R ; store in R_1, R_2...
- ff:=R_%i%
- ex11 .= ff . ","
- break ; different number
- }
- }
- return
- ;----------------------------------------------------------------
- Randomtest2:
- ck += 1
- loop,parse,ex11,`,
- {
- x:=a_loopfield
- if (ck=a_index)
- {
- ShowPic := list_%x%
- NamePic := name_%x%
- break
- }
- }
- ;msgbox,Total-Pictures=%countp%`nLoop=%ck%`nRandom-Number=%x%
- if (ck=countp)
- ck:=0
- return
- ;----------------------------------------------------------------
- ;----------------------------------------------------------------
- imgSize(img, ByRef width , ByRef height) { ; Get image's dimensions
- If FileExist(img) {
- GUI,3: Add, Picture, hwndpic, %img%
- ControlGetPos,,, width, height,, ahk_id %pic%
- Gui,3: Destroy
- } Else height := width := 0
- }
- ;------------------------------------------------------------------
- ;=============== get MP3 Picture thumbnail/ICO ============================================
- ;-------------
- GetThumbnailOrIcon(filePath, width, height := 0, iconOnly := false) {
- static IID_IShellItemImageFactory := "{BCC18B79-BA16-442F-80C4-8A59C30C463B}"
- , SIIGBF_BIGGERSIZEOK := 0x00000001
- , SIIGBF_ICONONLY := 0x00000004
- VarSetCapacity(GUID, 16, 0)
- DllCall("Ole32\IIDFromString", "WStr", IID_IShellItemImageFactory, "Ptr", &GUID)
- hr := DllCall("Shell32\SHCreateItemFromParsingName", "WStr", filePath, "Ptr", 0, "Ptr", &GUID, "PtrP", IShellItemImageFactory)
- if (hr != 0)
- Return 0
- flag := SIIGBF_BIGGERSIZEOK, (iconOnly && flag |= SIIGBF_ICONONLY)
- ; IShellItemImageFactory::GetImage
- DllCall(NumGet(NumGet(IShellItemImageFactory+0) + A_PtrSize*3), "Ptr", IShellItemImageFactory, "Int64", height << 32 | width
- , "Int", flag, "PtrP", hBitmap, "Int")
- ObjRelease(IShellItemImageFactory)
- Return hBitmap
- }
- ;==========================================================================================
- ;-------- saved at Dienstag, 7. April 2020 16:34:11 SKAN --------------
- ;- xStr for general text extraction and parsing XML HTML
- ;- https://www.autohotkey.com/boards/viewtopic.php?f=6&t=74050
- xStr(ByRef H, C:=0, B:="", E:="",ByRef BO:=1, EO:="", BI:=1, EI:=1, BT:="", ET:="") {
- Local L, LB, LE, P1, P2, Q, N:="", F:=0 ; xStr v0.97 by SKAN on D1AL/D343 @ tiny.cc/xstr
- Return SubStr(H,!(ErrorLevel:=!((P1:=(L:=StrLen(H))?(LB:=StrLen(B))?(F:=InStr(H,B,C&1,BO,BI))?F+(BT=N?LB
- :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
- ?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)
- }
- ;------------------------------------------------------------------
- ;======== END SCRIPT =======================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement