Left-Right go up-down
Posted: 17 Dec 2014 04:42
I want to map Left-Right arrow key to go up/down without interfering with file rename (F2-rename file)
Possible via xys or ahk?
Currently I'm using this ahk, but it's ugly (remember to remap the KB shortcut of #162 (File>Open focused item) to Ctrl+Shift+o):
Possible via xys or ahk?
Currently I'm using this ahk, but it's ugly (remember to remap the KB shortcut of #162 (File>Open focused item) to Ctrl+Shift+o):
Code: Select all
#SingleInstance force
#NoEnv
;#notrayicon
Settitlematchmode, 2
SenderHWND := A_ScriptHwnd + 0 ;Return this script's hidden hwdn id. +0 to convert from Hex to Dec
MessagetoXYplorer := "::CopyData " SenderHWND ", get(""FocusedControl"").property(""Type"",""<focitem>""), 2" ;resolved to sth like this: ::CopyData 7409230, "<curitem>",2
#Ifwinactive XYplorer ahk_class ThunderRT6FormDC
~Left::
~Right::
Global Datareceived
OnMessage(0x4a, "Function_Receive_WM_COPYDATA") ; 0x4a is WM_COPYDATA. This onhold and wait for the WM_Copydata from XYplorer then execute Function_Receive_WM_COPYDATA(wParam, lParam) below
FunctionMessagetoXYplorer(MessagetoXYplorer)
if(SubStr(Datareceived,1,1) = "L")
{
if(A_Thishotkey = "~Left")
Sendinput {Alt Down}{Left}{Alt Up} ;FunctionMessagetoXYplorer("::#523")
Else If(Datareceived = "LFile Folder")
Sendinput {Shift Down}{Ctrl Down}o{Shift Up}{Ctrl Up} ;FunctionMessagetoXYplorer("::#162")
}
FunctionMessagetoXYplorer(MessagetoXYplorer) ;Send message to XYplorer
{
SetTitleMatchMode, 2
HWND := WinExist("XYplorer ahk_class ThunderRT6FormDC")
Size := StrLen(MessagetoXYplorer)
If !(A_IsUnicode)
{
VarSetCapacity(Data, Size * 2, 0)
StrPut(MessagetoXYplorer, &Data, Size, "UTF-16")
}
Else
Data := MessagetoXYplorer
VarSetCapacity(COPYDATA, A_PtrSize * 3, 0)
NumPut(4194305, COPYDATA, 0, "Ptr")
NumPut(Size * 2, COPYDATA, A_PtrSize, "UInt")
NumPut(&Data, COPYDATA, A_PtrSize * 2, "Ptr")
SendMessage, 0x4a, 0, ©DATA, , ahk_id %HWND%
}
Function_Receive_WM_COPYDATA(wParam, lParam)
{
StringAddress := NumGet(lParam + 2*A_PtrSize) ;lParam+8 is the address of CopyDataStruct's lpData member.
CopyOfData := StrGet(StringAddress) ;May also specify CP0 (default) or UTF-8 or UTF-16: StrGet(StringAddress, NumGet(lParam+A_PtrSize), "UTF-16")
cbData := NumGet(lParam+A_PtrSize)/2 ;cbData = String length
StringLeft, Datareceived, CopyOfData, cbData
}