Code: Select all
/*
------------------------------------
script =Foto_SlideShow
modified =20230330
created =20190809
define your variable-folder > MF
use ESC to quit
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
*/
#Requires AutoHotkey v1.1
#Warn
setworkingdir,%a_scriptdir%
SetBatchLines, -1
WinGetPos,,,, TaskBarHeight, ahk_class Shell_TrayWnd
hx:=a_screenheight-TaskBarHeight
;------ your variables -------------
mf=D:\m_media\m_foto ;- <<<< your PATH here
extensions :="jpg,bmp,png"
seconds := 1
;-----------------------------------
wa:=A_screenwidth,ha:=A_screenHeight,xx:=100
y:=(ha*0)/xx, w:=(wa*67)/xx,h:=hx ;- height = y0 -- until taskbar
e:="" , seconds:=(seconds*1000)
loop,%mf%\*.*,0,1
{
SplitPath,a_loopfilefullpath, name, dir, ext, name_no_ext, drive
if ext in %extensions%
e .= a_loopfilefullpath . "`r`n"
}
if e=
{
msgbox, 262208,FILES ,No pictures found`nDefine your pictures-folder in this script
exitapp
}
;---------------------
Loop,parse,e,`n,`r
{
xc:=a_loopfield
if xc=
continue
imgSize(xc,imgw,imgh)
sleep,100
Gui,2:new
Gui,2: -dpiscale +AlwaysOnTop -Caption
Gui,2: Margin, 0, 0
Gui,2:Color,Black,Black
if (imgw>imgh)
gui,2:add, Picture, x0 y0 h-1 w%w%,%xc%
else if (imgh>imgw)
gui,2:add, Picture, x0 y0 h%h% w-1 ,%xc%
Gui,2: Show,y%y% h%h% ,Test2
sleep,%seconds%
;keywait,space,D ;- <<< or instead sleep seconds use SPACE-key to continue
}
return
;---------------------
esc::exitapp
;---------------------
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
}
;================================================================