!WheelUp & !WheelDown según Script

Esta sección es para preguntas sobre programación/scripting usando AutoHotkey.

Moderator: Flipeador

CEA6597
Posts: 1
Joined: 21 Jan 2020, 19:22

!WheelUp & !WheelDown según Script

21 Jan 2020, 19:38

Saludos, alguien se le ocurre como puedo adaptar y añadir las lineas restantes a este Script?; Lo que quiero lograr es que al apretar !WheelUp me ejecute las teclas ya asignadas ^PgUp y lo mismo con !WheelDown ejecute las teclas ^PgDn para asi simplificar aun mas el proceso final del script :headwall: este es el Script en cuestión...
PD: Soy Nuevo :lolno:

Code: Select all

#IfWinActive, ahk_class CabinetWClass
^PgUp:: ;explorer - navigate to sibling folder
^PgDn:: ;explorer - navigate to sibling folder
#IfWinActive, ahk_class ExploreWClass
^PgUp:: ;explorer - navigate to sibling folder
^PgDn:: ;explorer - navigate to sibling folder
vGetNext := !!InStr(A_ThisHotkey, "Dn")
WinGet, hWnd, ID, A
WinGetClass, vWinClass, % "ahk_id " hWnd
if !(vWinClass = "CabinetWClass") && !(vWinClass = "ExploreWClass")
	return
for oWin2 in ComObjCreate("Shell.Application").Windows
	if (oWin2.HWND = hWnd)
	{
		vDir2 := oWin2.Document.Folder.Self.Path
		vDir2 := RTrim(vDir2, "\")
		oWin := oWin2
		break
	}
oWin2 := ""
if !FileExist(vDir2)
{
	oWin := ""
	return
}
SplitPath, vDir2, vName1, vDir1
vIsMatch := 0
vName := ""
Loop, Files, % vDir1 "\*", D
{
	if vIsMatch
	{
		vName := A_LoopFileName
		break
	}
	if (A_LoopFileName = vName1)
		if vGetNext
			vIsMatch := 1
		else
			break
	vName := A_LoopFileName
}
if (vName = vName1) || (vName = "")
{
	oWin := ""
	return
}
vDir := vDir1 "\" vName
;MsgBox, % vDir

if !InStr(vDir, "#") ;folders that don't contain #
	oWin.Navigate(vDir)
else ;folders that contain #
{
	DllCall("shell32\SHParseDisplayName", WStr,vDir, Ptr,0, PtrP,vPIDL, UInt,0, Ptr,0)
	VarSetCapacity(SAFEARRAY, A_PtrSize=8?32:24, 0)
	NumPut(1, &SAFEARRAY, 0, "UShort") ;cDims
	NumPut(1, &SAFEARRAY, 4, "UInt") ;cbElements
	NumPut(vPIDL, &SAFEARRAY, A_PtrSize=8?16:12, "Ptr") ;pvData
	NumPut(DllCall("shell32\ILGetSize", Ptr,vPIDL, UInt), &SAFEARRAY, A_PtrSize=8?24:16, "Int") ;rgsabound[1]
	oWin.Navigate2(ComObject(0x2011, &SAFEARRAY), 0)
	DllCall("shell32\ILFree", Ptr,vPIDL)
}
oWin := ""
return
#IfWinActive
[Mod edit: [code][/code] tags added]
User avatar
elModo7
Posts: 217
Joined: 01 Sep 2017, 02:38
Location: Spain
Contact:

Re: !WheelUp & !WheelDown según Script

23 Jan 2020, 08:31

Code: Select all

#IfWinActive, ahk_class CabinetWClass
!WheelUp::
!WheelDown::
^PgUp:: ;explorer - navigate to sibling folder
^PgDn:: ;explorer - navigate to sibling folder
#IfWinActive, ahk_class ExploreWClass
!WheelUp::
!WheelDown::
^PgUp:: ;explorer - navigate to sibling folder
^PgDn:: ;explorer - navigate to sibling folder
vGetNext := !!InStr(A_ThisHotkey, "Dn") 
vGetNext2 := !!InStr(A_ThisHotkey, "Down") 
WinGet, hWnd, ID, A
WinGetClass, vWinClass, % "ahk_id " hWnd
if !(vWinClass = "CabinetWClass") && !(vWinClass = "ExploreWClass")
	return
for oWin2 in ComObjCreate("Shell.Application").Windows
	if (oWin2.HWND = hWnd)
	{
		vDir2 := oWin2.Document.Folder.Self.Path
		vDir2 := RTrim(vDir2, "\")
		oWin := oWin2
		break
	}
oWin2 := ""
if !FileExist(vDir2)
{
	oWin := ""
	return
}
SplitPath, vDir2, vName1, vDir1
vIsMatch := 0
vName := ""
Loop, Files, % vDir1 "\*", D
{
	if vIsMatch
	{
		vName := A_LoopFileName
		break
	}
	if (A_LoopFileName = vName1)
		if vGetNext || vGetNext2
			vIsMatch := 1
		else
			break
	vName := A_LoopFileName
}
if (vName = vName1) || (vName = "")
{
	oWin := ""
	return
}
vDir := vDir1 "\" vName
;MsgBox, % vDir

if !InStr(vDir, "#") ;folders that don't contain #
	oWin.Navigate(vDir)
else ;folders that contain #
{
	DllCall("shell32\SHParseDisplayName", WStr,vDir, Ptr,0, PtrP,vPIDL, UInt,0, Ptr,0)
	VarSetCapacity(SAFEARRAY, A_PtrSize=8?32:24, 0)
	NumPut(1, &SAFEARRAY, 0, "UShort") ;cDims
	NumPut(1, &SAFEARRAY, 4, "UInt") ;cbElements
	NumPut(vPIDL, &SAFEARRAY, A_PtrSize=8?16:12, "Ptr") ;pvData
	NumPut(DllCall("shell32\ILGetSize", Ptr,vPIDL, UInt), &SAFEARRAY, A_PtrSize=8?24:16, "Int") ;rgsabound[1]
	oWin.Navigate2(ComObject(0x2011, &SAFEARRAY), 0)
	DllCall("shell32\ILFree", Ptr,vPIDL)
}
oWin := ""
return
#IfWinActive
Creo que eso es lo que quieres.

Return to “Pedir Ayuda”

Who is online

Users browsing this forum: No registered users and 78 guests