<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: просмотр изображений бок о бок side by side]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15406&amp;type=atom" />
	<updated>2020-05-31T12:41:59Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15406</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: просмотр изображений бок о бок side by side]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139840#p139840" />
			<content type="html"><![CDATA[<p>При наличии времени, что угодно можно добавить.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-05-31T12:41:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139840#p139840</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: просмотр изображений бок о бок side by side]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139839#p139839" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> хорошее начало. Спасибо! <br />Зум же там можно тоже приделать с центрированием по положению указателя мышки?</p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2020-05-31T11:47:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139839#p139839</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: просмотр изображений бок о бок side by side]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139833#p139833" />
			<content type="html"><![CDATA[<p>Если знаете про библиотеку Gdip, то так при удержании f1 выводит 2 картинки из выделенных файлов.<br /></p><div class="codebox"><pre><code>
#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(), &quot;`n&quot;)  
	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 &gt; 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=&quot;&quot;)   - paths of target window&#039;s selected items
	Explorer_GetAll(hwnd=&quot;&quot;)        - paths of all items in the target window&#039;s folder
	Explorer_GetPath(hwnd=&quot;&quot;)       - path of target window&#039;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=&quot;&quot;)
{
	if !(window := Explorer_GetWindow(hwnd))
		return ErrorLevel := &quot;ERROR&quot;
	if (window=&quot;desktop&quot;)
		return A_Desktop
	path := window.LocationURL
	path := RegExReplace(path, &quot;ftp://.*@&quot;,&quot;ftp://&quot;)
	StringReplace, path, path, file:///
	StringReplace, path, path, /, \, All 
	
	; thanks to polyethene
	Loop
		If RegExMatch(path, &quot;i)(?&lt;=%)[\da-f]{1,2}&quot;, hex)
			StringReplace, path, path, `%%hex%, % Chr(&quot;0x&quot; . hex), All
		Else Break
	return path
}
Explorer_GetAll(hwnd=&quot;&quot;)
{
	return Explorer_Get(hwnd)
}
Explorer_GetSelected(hwnd=&quot;&quot;)
{
	return Explorer_Get(hwnd,true)
}

Explorer_GetWindow(hwnd=&quot;&quot;)
{
	; thanks to jethrow for some pointers here
    WinGet, process, processName, % &quot;ahk_id&quot; hwnd := hwnd? hwnd:WinExist(&quot;A&quot;)
    WinGetClass class, ahk_id %hwnd%
	
	if (process!=&quot;explorer.exe&quot;)
		return
	if (class ~= &quot;(Cabinet|Explore)WClass&quot;)
	{
		for window in ComObjCreate(&quot;Shell.Application&quot;).Windows
			if (window.hwnd==hwnd)
				return window
	}
	else if (class ~= &quot;Progman|WorkerW&quot;) 
		return &quot;desktop&quot; ; desktop found
}
Explorer_Get(hwnd=&quot;&quot;,selection=false)
{
	if !(window := Explorer_GetWindow(hwnd))
		return ErrorLevel := &quot;ERROR&quot;
	if (window=&quot;desktop&quot;)
	{ 
		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 ? &quot;Selected&quot;:&quot;&quot;) &quot;Col1&quot;,,ahk_id %hwWindow%
			base := SubStr(A_Desktop,0,1)==&quot;\&quot; ? SubStr(A_Desktop,1,-1) : A_Desktop
			Loop, Parse, files, `n, `r
			{
				path := base &quot;\&quot; A_LoopField
				IfExist %path% ; ignore special icons like Computer (at least for now)
					ret .= path &quot;`n&quot;
			}
		}
	} 
	else
	{
		if selection
			collection := window.document.SelectedItems
		else
			collection := window.document.Folder.Items
		for item in collection
			ret .= item.path &quot;`n&quot;
	}
	return Trim(ret,&quot;`n&quot;)
}
 
    ; http://forum.script-coding.com/viewtopic.php?pid=83582#p83582

Explorer_GetSelectedDesktop()
{
	shellWindows := ComObjCreate(&quot;{9BA05972-F6A8-11CF-A442-00A0C90A8F39}&quot;)
	
	desktop := shellWindows.Item(ComObj(19, 8))  
	if ptlb := ComObjQuery(desktop
		, &quot;{4C96BE40-915C-11CF-99D3-00AA004AE837}&quot;  ; SID_STopLevelBrowser
		, &quot;{000214E2-0000-0000-C000-000000000046}&quot;) ; IID_IShellBrowser
	{ 
		if DllCall(NumGet(NumGet(ptlb+0)+15*A_PtrSize), &quot;ptr&quot;, ptlb, &quot;ptr*&quot;, psv:=0) = 0
		{ 
			VarSetCapacity(IID_IDispatch, 16)
			NumPut(0x46000000000000C0, NumPut(0x20400, IID_IDispatch, &quot;int64&quot;), &quot;int64&quot;) 
			DllCall(NumGet(NumGet(psv+0)+15*A_PtrSize), &quot;ptr&quot;, psv
				, &quot;uint&quot;, 0, &quot;ptr&quot;, &amp;IID_IDispatch, &quot;ptr*&quot;, pdisp:=0)
			
			Items := ComObjEnwrap(pdisp).SelectedItems()
			Loop, % Items.Count
				ret .= Items.Item(A_Index - 1).Path &quot;`n&quot; 
			ObjRelease(psv)
		}
		ObjRelease(ptlb)
	}
	return Trim(ret,&quot;`n&quot;)
} 
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-05-31T09:38:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139833#p139833</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: просмотр изображений бок о бок side by side]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139831#p139831" />
			<content type="html"><![CDATA[<p>Здравствуйте, пытаюсь найти решение для быстрого и комфортного сравнения изображений, чтобы в explorer выделить 2 файла и смотреть их в режиме sbs(side by side). Есть программа которая удовлетворяет по функционалу просмотра изображений в sbs - FastStone, но у неё нет возможности запустить сразу sbs режим, при выборе нескольких изображений в проводнике windows. Только через открытие галереи проги и там уже выбирать что сравнивать, что не желательно так как изображения смотрятся с телефона - скорость не большая, достаточная чтобы быстро загрузить 2 изображения, но не индексировать папку с сотнями изображений.</p><p>По этому возникла идея найти такой sbs просмотрщик на ahk. Но пока ничего не попадается, это вообще реально с помощью ahk?</p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2020-05-31T08:09:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139831#p139831</id>
		</entry>
</feed>
