Sunday, January 29, 2023

Play Video with FFPLAY using ahk

Video file path in SD.txt


 #NoEnv

#Warn

#SingleInstance, Force

#KeyHistory 10


#IfWinActive ahk_class CabinetWClass

7::I("!4") ;[via][Explorer] Copy Path of the Selected File/Folder(s) ;7::Clipboard:=GFx("c")

;7::I("{Appskey}a") ;[Win 11]


#IfWinActive SD - Notepad

Numpad1::pv("bl")


pv(c="", x=1){

global gv_p

I("{End}") (x ? Clipboard:=GFx(c) : Iw("bl"))

f=

(c join

"%gv_p%\Media Toolz\

;mpv\mpv

;mplayer-38119\mplayer

ffmpeg-2022-04-28-essentials\bin\ffplay

"

;"%gv_p%\Autz\AHK_Express\Lib\MCI Example - Standard Example.ahk"

)

Run % f (x ? " -fs """ : " ""D:\Deux\Downloads\Music\opus\BGM\") Clipboard """"

}


GFx(c="", m="", e="", v=""){ ;[1] x, [2] n, [3] p, [4] d, [5] nx, [D] dpnx

if c in c,bl

Iw(c="c" ? "" : "bl")

else {

ClipB(1)

Clipboard:=c

}

Loop, parse, % RQ(), `n, `r

{

Transform, t, Deref, %A_Loopfield%

dpnx:=RegexReplace(t, ".*(.:[/\\])", "$1")

if !(dpnx~=":[/\\]")

Continue

if e

dpnx:=Rlnk(dpnx)

if m {

SplitPath, dpnx,, p, x, n,d

dpnx:=m=5 ? n "." x : m=4 ? d : m=3 ? p : m=2 ? n : m= ? x

}

v .= dpnx "`n"

}

ClipB(0)

return Trim(v, "`n")

}


Rlnk(f){

SplitPath, f,,, x

clnk:

if x="lnk"

Goto xlnk

Return a

xlnk:

FileGetShortcut, %f%, a

Goto clnk

}


ClipB(x:=""){ ;Default: No Backup, 0 Restore, 1 Backup & Clear Clipboard

global TClipB

if x

TClipB := ClipboardAll

Clipboard := x=0 ? TClipB : ""

}


RQ(x=0){

Return StrReplace(Cx(x), """")

}


Cx(x=0){

Return x ? x : Clipboard

}


Iw(s="", xc="c"){ ;Iw()=Ix(, "c", 1)

Ix(s, xc, 1)

}


Ix(s:="", cx:="", w=0){ ;Ix(, "s")=I("^s")

w ? ClipB(1) : ""

SendInput, % (s="l" ? "{Home}" : "") "+" (s="bl" ? "{Home" : s="el" ? "{End" : s="l" ? "{End" : s="u" ? "{Up" : s="d" ? "{Down" : "^{" (s="b" ? "Home" : s="e" ? "End" : s="wl" ? "Left" : s="wr" ? "Right" : "Sleep 50")) "}" "{Ctrl Down}" cx "{Ctrl Up}"

if w

Clipwait

}


I(x:="", m=0){

SendInput, % m ? "{Click r}{Sleep 10}" x : x

;SendInput, % (!m ? "" : m="t" ? "{Text}" : m="p" ? "{Raw}" : "{Click r}{Sleep 10}") x

}


Iz(x){

Sleep % x

}


Tuesday, September 27, 2022

yt-dlp, youtube-dl...

gv_d := StrReplace(A_Desktop, "\Desktop") ;Dynamic UserProfile

gv_p=%gv_d%\cdx


<!Del::ydl() ;opus

<^Del::ydl(1) ;mp3

<+Del::ydl(2) ;Video


ydl(m=0){

global gv_d, gv_p

vDe=%gv_p%\Media Toolz\ffmpeg-2022-04-28-essentials\bin

vDi=%gv_d%\Desktop\LTz\Inz

vDo=%gv_d%/Downloads/Videos/

Tx=playlist,playlist_title,uploader,upload_date,chapter_number,chapter,playlist_index

Loop, parse, Tx, `,

vDo.="%(" A_Loopfield ")s/"

SendInput{Click r}

x:=RegexReplace(Clipboard, "^.*yout.*(?:be/|v=|shorts/)(.*)[?&.]*", "$1")

;x=-a "y-i.txt"

vCB=%comspec% /c cd /d "%vDi%"&"%vDe%\yt-dlp.exe" -qckw --console-title --geo-bypass

vCE=--user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15" -o "%vDo%`%(title)s-`%(id)s-`%(format_id)s.`%(ext)s" --download-archive "y-h.txt" %x%>>%gv_d%\xoxo.log 2>&1

Runwait, % vCB (m=2 ? " -f ""(best[width>=1920][ext=mp4]/best[ext=mp4]/best)[protocol^=https]"" --no-playlist " : " -x -f ""bestaudio[protocol^=https]"" --audio-format " (m ? "mp3" : "opus") " --audio-quality 0 --ffmpeg-location """ vDe """ ") vCE,, Hide

;Run, %comspec% /c cd /d "%vDi%"&yt-a.txt,, Hide

Traytip, % x, Done!, 1500

}

Just Copy the link on right click. Create LTz\Inz directory in Desktop.

Click Down & Hold Mouse Button (Toggle)

 6::SendInput, % "{Click " (GetKeyState("LButton") ? "u" : "d") "}"


Click left mouse key up if down and up if down...

Sunday, September 25, 2022

Title & Class (autohotkey)

NumpadDot::Clipboard:=GTC()


GTC(){

WinGetTitle, vT, A

WinGetClass, vC, A

Return vT.="`n ahk_class " vC

}


Title and Class will be stored in clipboard when Numpaddot is pressed.


Play Video with FFPLAY using ahk

Video file path in SD.txt  #NoEnv #Warn #SingleInstance, Force #KeyHistory 10 #IfWinActive ahk_class CabinetWClass 7::I("!4") ;[vi...