Если знаете про библиотеку Gdip, то так при удержании f1 выводит 2 картинки из выделенных файлов.
#SingleInstance Force
#Persistent
#NoEnv
SetBatchLines -1
pToken := Gdip_Startup()
GuiWidth := A_ScreenWidth
GuiHeight := A_ScreenHeight
Width := GuiWidth // 2
Height := GuiHeight
OnExit, Exit
Gui, -Caption +E0x80000 +AlwaysOnTop +ToolWindow +OwnDialogs +HWNDhGui
Gui, Show, NA
hbm := CreateDIBSection(GuiWidth, GuiHeight)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
pGraphics := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(pGraphics, 4)
Return
Esc:: ExitApp
f1::
obj := StrSplit(Explorer_GetSelected(), "`n")
If (obj.Count() != 2)
Return
Gdip_GraphicsClear(pGraphics, 0xff000000)
Loop 2
{
pBitmap := Gdip_CreateBitmapFromFile(obj[A_Index])
Gdip_GetImageDimensions(pBitmap, PicWidth, PicHeight)
StretchToFit(Width, Height, PicHeight / PicWidth, ChildX, ChildY, ChildWidth, ChildHeight)
Gdip_DrawImage(pGraphics, pBitmap, ChildX + ((A_Index - 1) * Width), ChildY, ChildWidth, ChildHeight, 0, 0, PicWidth, PicHeight)
Gdip_DisposeImage(pBitmap)
}
UpdateLayeredWindow(hGui, hdc, 0, 0, GuiWidth, GuiHeight)
KeyWait, % A_ThisHotkey
Gui, Show, NA w0 h0
Return
Exit:
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(pGraphics)
Gdip_Shutdown(pToken)
ExitApp
StretchToFit(ParentWidth, ParentHeight, ChildRatioHW, ByRef ChildX, ByRef ChildY, ByRef ChildWidth, ByRef ChildHeight) {
If (ParentHeight / ParentWidth > ChildRatioHW)
ChildWidth := ParentWidth, ChildHeight := ChildWidth * ChildRatioHW, ChildX := 0, ChildY := (ParentHeight - ChildHeight) / 2
Else
ChildHeight := ParentHeight, ChildWidth := ChildHeight / ChildRatioHW, ChildX := (ParentWidth - ChildWidth) / 2, ChildY := 0
}
/*
Library for getting info from a specific explorer window (if window handle not specified, the currently active
window will be used). Requires AHK_L or similar. Works with the desktop. Does not currently work with save
dialogs and such.
Explorer_GetSelected(hwnd="") - paths of target window's selected items
Explorer_GetAll(hwnd="") - paths of all items in the target window's folder
Explorer_GetPath(hwnd="") - path of target window's folder
example:
F1::
path := Explorer_GetPath()
all := Explorer_GetAll()
sel := Explorer_GetSelected()
MsgBox % path
MsgBox % all
MsgBox % sel
return
Joshua A. Kinnison
2011-04-27, 16:12
http://www.autohotkey.com/board/topic/60985-get-paths-of-selected-items-in-an-explorer-window/
*/
Explorer_GetPath(hwnd="")
{
if !(window := Explorer_GetWindow(hwnd))
return ErrorLevel := "ERROR"
if (window="desktop")
return A_Desktop
path := window.LocationURL
path := RegExReplace(path, "ftp://.*@","ftp://")
StringReplace, path, path, file:///
StringReplace, path, path, /, \, All
; thanks to polyethene
Loop
If RegExMatch(path, "i)(?<=%)[\da-f]{1,2}", hex)
StringReplace, path, path, `%%hex%, % Chr("0x" . hex), All
Else Break
return path
}
Explorer_GetAll(hwnd="")
{
return Explorer_Get(hwnd)
}
Explorer_GetSelected(hwnd="")
{
return Explorer_Get(hwnd,true)
}
Explorer_GetWindow(hwnd="")
{
; thanks to jethrow for some pointers here
WinGet, process, processName, % "ahk_id" hwnd := hwnd? hwnd:WinExist("A")
WinGetClass class, ahk_id %hwnd%
if (process!="explorer.exe")
return
if (class ~= "(Cabinet|Explore)WClass")
{
for window in ComObjCreate("Shell.Application").Windows
if (window.hwnd==hwnd)
return window
}
else if (class ~= "Progman|WorkerW")
return "desktop" ; desktop found
}
Explorer_Get(hwnd="",selection=false)
{
if !(window := Explorer_GetWindow(hwnd))
return ErrorLevel := "ERROR"
if (window="desktop")
{
if selection
ret := Explorer_GetSelectedDesktop()
else
{
ControlGet, hwWindow, HWND,, SysListView321, ahk_class Progman
if !hwWindow ; #D mode
ControlGet, hwWindow, HWND,, SysListView321, A
ControlGet, files, List, % ( selection ? "Selected":"") "Col1",,ahk_id %hwWindow%
base := SubStr(A_Desktop,0,1)=="\" ? SubStr(A_Desktop,1,-1) : A_Desktop
Loop, Parse, files, `n, `r
{
path := base "\" A_LoopField
IfExist %path% ; ignore special icons like Computer (at least for now)
ret .= path "`n"
}
}
}
else
{
if selection
collection := window.document.SelectedItems
else
collection := window.document.Folder.Items
for item in collection
ret .= item.path "`n"
}
return Trim(ret,"`n")
}
; http://forum.script-coding.com/viewtopic.php?pid=83582#p83582
Explorer_GetSelectedDesktop()
{
shellWindows := ComObjCreate("{9BA05972-F6A8-11CF-A442-00A0C90A8F39}")
desktop := shellWindows.Item(ComObj(19, 8))
if ptlb := ComObjQuery(desktop
, "{4C96BE40-915C-11CF-99D3-00AA004AE837}" ; SID_STopLevelBrowser
, "{000214E2-0000-0000-C000-000000000046}") ; IID_IShellBrowser
{
if DllCall(NumGet(NumGet(ptlb+0)+15*A_PtrSize), "ptr", ptlb, "ptr*", psv:=0) = 0
{
VarSetCapacity(IID_IDispatch, 16)
NumPut(0x46000000000000C0, NumPut(0x20400, IID_IDispatch, "int64"), "int64")
DllCall(NumGet(NumGet(psv+0)+15*A_PtrSize), "ptr", psv
, "uint", 0, "ptr", &IID_IDispatch, "ptr*", pdisp:=0)
Items := ComObjEnwrap(pdisp).SelectedItems()
Loop, % Items.Count
ret .= Items.Item(A_Index - 1).Path "`n"
ObjRelease(psv)
}
ObjRelease(ptlb)
}
return Trim(ret,"`n")
}