ahk V1 , откройте папку изображений и выберите несколько файлов изображений с помощью F3
CODE:
;- open image folder and select some picture-files user mikeyww
;- Как узнать размер изображения (Ширину и Высоту), если известен только путь к файлу?
;- откройте папку изображений и выберите несколько файлов изображений с помощью F3
;-------- saved at 星期日 十一月 2022-11-20 10:42 UTC --------------
;- Scan muliplte images to check dimensions against list.
;- https://www.autohotkey.com/boards/viewtopic.php?f=76&t=110694
;-
;w:=320,h:=240
ImagesGuiEscape:
Gui, Hide
#IfWinActive ahk_class CabinetWClass
;---------------------------------------
F3::
Gui, Images:New
Gui, Font, s10
Gui, Add, ListView, w600 r30, Width|Height|Name
For fileNum, file in sel := getSelected() {
ToolTip, % fileNum " / " sel.Count()
img := imgSize(file)
;If (img.w && (img.w != w || img.h != h))
{
SplitPath, file, fn
LV_Add("", img.w, img.h, fn)
}
}
ToolTip
LV_ModifyCol(3, 480), LV_ModifyCol(2, "50 Sort Integer Center"), LV_ModifyCol(1, "50 Sort Integer Center")
Gui, Show,, % "Images (" LV_GetCount() " of " sel.Count() ")"
Return
Guiclose:
Exitapp
;---------------------------------------
#IfWinActive
imgSize(img) { ; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=81665
; Returns an array indicating the image's width (w) and height (h), obtained from the file's properties
SplitPath, img, fn, dir
objShell := ComObjCreate("Shell.Application")
objFolder := objShell.NameSpace(dir), objFolderItem := objFolder.ParseName(fn)
scale := StrSplit(RegExReplace(objFolder.GetDetailsOf(objFolderItem, 31), ".(.+).", "$1"), " x ")
Return {w: scale.1, h: scale.2}
}
;------------
getSelected() { ; https://www.autohotkey.com/boards/viewtopic.php?style=17&t=60403#p255256 by teadrinker
hwnd := WinExist("A"), selection := []
WinGetClass, class
If (class ~= "(Cabinet|Explore)WClass")
For window in ComObjCreate("Shell.Application").Windows {
Try window.hwnd
Catch
Return
If (window.hwnd = hwnd)
For item in window.document.SelectedItems
selection.Push(item.Path)
}
Return selection
}
;------------
esc::exitapp
Statistics: Posted by garry — Today, 10:31