Code: Select all
;-----------------------------------
;- MPC-BE x64 , select video , show picture with same name as video
;-----------------------------------
#warn
setworkingdir,%a_scriptdir%
SetBatchLines, -1
wa:=A_screenwidth,ha:=A_screenHeight,xx:=100
x:=(wa*.1)/xx,y:=(ha*.1)/xx,w:=(wa*25)/xx,h:=(ha*25)/xx ;- picture x y w h
folder=C:\Test\M_VIDEO ;- here are videos and picture with the same name
;- - Maitetxu mia.mp4 > Maitetxu mia.jpg
Gui,2:default
Gui,2: +HwndAId +0x2000000 +AlwaysOnTop -Caption -DPIScale
Gui,2: Margin, 0, 0
Gui,2:Color,Black,Black
Gui,2: show ,x%x% y%y% w%w%,Test1
before:=""
settimer,revisar,1000
return
;------
esc:: ;- close with ESC
2Guiclose:
Gui,3:destroy
sleep,1000
exitapp
;---------------------
revisar:
WinGetTitle, Titulo, ahk_class MPC-BE
new:=titulo
if !(before=new) ;- if MPC change title
{
aa:= " - MPC-BE x64 1.5.6" ;- remove this from title
stringreplace,title,new,%aa%,,all
SplitPath,Title, name1, dir1, ext1, name_no_ext1, drive1
xc:= Folder . "\" . name_no_ext1 . ".jpg" ;- C:\Test\M_VIDEO\Maitetxu mia.jpg
;GuiControl,2: ,Pic,%xc%
;msgbox, 262208, ,NAME=%xc% ,
before:=new
gosub,childnew1 ;- show picture
}
return
;----------------------
childnew1:
Gui,2:submit,nohide
Gui,3:destroy
Gui,3:default
imgSize(xc,imgw,imgh)
Gui,3: +HwndBId
Gui,3: -Caption -Border +AlwaysOnTop -DPIScale
Gui,3: Margin, 0, 0
Gui,3: Color,Black,Black
if (imgw>imgh)
{
;msgbox, 262208, ,width,2
gui,3:add, Picture, x0 y0 h-1 w%w%,%xc%
}
else if (imgh>imgw)
{
;msgbox, 262208, , height,2
gui,3:add, Picture, x0 y0 h%h% w-1 ,%xc%
}
Gui,3:Show,x0 y0 ,Test2
WinGetPos,,,Width2,Height2,Test2
Gui,3:+Parent%AId%
Winmove,,Test2,,,,%height2%
return
;------------------------------------
;- user mikeyww
;- Get the height / width of an image - to an array (object)
;- https://www.autohotkey.com/boards/viewtopic.php?t=81665
;--
imgSize(img, ByRef width , ByRef height) { ; Get image's dimensions
If FileExist(img) {
GUI, Add, Picture, hwndpic, %img%
ControlGetPos,,, width, height,, ahk_id %pic%
Gui, Destroy
} Else height := width := 0
}
;====================================