funlovin Posted January 26, 2010 Posted January 26, 2010 Hi, I'm using the software WindowTabs and would like to open a folder in a new window. WindowTabs then makes a new tab out of that window. This would be similar behavior like in firefox. My question is, how can I can open a folder in a new window with a wheelclick (middle mouse button). Can I emulate the string + double click? Can I use the windows api, due that I don't have to emulate something? Thanks
PsaltyDS Posted January 26, 2010 Posted January 26, 2010 You could just Run() or ShellExecute() an explorer.exe commandline: EXPLORER.EXE [/n][/e][,/root,<object>][[,/select],<sub object>] /n: Opens a new window in single-paned (My Computer) view for each item selected, even if the new window duplicates a window that is already open. /e: Uses Windows Explorer view. Windows Explorer view is most similar to File Manager in Windows version 3.x. Note that the default view is Open view. /root,<object>: Specifies the root level of the specified view. The default is to use the normal namespace root (the desktop). Whatever is specified is the root for the display. Can be a UNC network path. /select,<sub object>: Specifies the folder to receive the initial focus. If "/select" is used, the parent folder is opened and the specified object is selected. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
picea892 Posted January 26, 2010 Posted January 26, 2010 expandcollapse popup#include <WinAPI.au3> #include <GuiListView.au3> HotKeySet('{ESC}', '_EXIT') Global Const $tagMSLLHOOKSTRUCT = 'int X;int Y;uint;uint;uint;ulong_ptr' Global Const $WM_MOUSEMOVE = 0x0200 Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $WM_LBUTTONUP = 0x0202 Global Const $WM_LBUTTONDBLCLK = 0x0203 Global Const $WM_RBUTTONDOWN = 0x0204 Global Const $WM_RBUTTONUP = 0x0205 Global Const $WM_RBUTTONDBLCLK = 0x0206 Global Const $SHELLDLL_DefView = "SHELLDLL_DefView" Dim $hMHook, $pMHook, $hHook Dim $iDiff = TimerInit() $hMHook = DllCallbackRegister('LowLevelMouseProc', 'long', 'int;wparam;lparam') $pMHook = DllCallbackGetPtr($hMHook) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pMHook, _WinAPI_GetModuleHandle(0)) While 1 Sleep(50) WEnd Func _EXIT() Exit EndFunc Func OnAutoItExit() DllCallbackFree($hMHook) _WinAPI_UnhookWindowsHookEx($hHook) EndFunc Func LowLevelMouseProc($iCode, $iwParam, $ilParam) Local $tMSLLHOOKSTRUCT = DllStructCreate($tagMSLLHOOKSTRUCT, $ilParam) Local $hWnd If $iCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) If $iwParam = 0x0207 Then $hWnd = _WinAPI_WindowFromPoint($tMSLLHOOKSTRUCT) If _WinAPI_GetClassName(_WinAPI_GetParent($hWnd)) = $SHELLDLL_DefView And _ _WinAPI_IsClassName($hWnd, $__LISTVIEWCONSTANT_ClassName) Then Local $avArray = _GUICtrlListView_HitTest($hWnd) If $avArray[0] > -1 Then $filename=_GUICtrlListView_GetItemText($hWnd, $avArray[0]) ; if Stringright($filename,3)="au3" then if ControlGetFocus('Program Manager','') = "SysListView321" then ShellExecute("C:\windows\explorer.exe",'"'&@DesktopDir&$filename&'"') if ControlGetFocus("[class:ExploreWClass]") = "SysListView321" or ControlGetFocus("[class:CabinetWClass]")= "SysListView321" then ShellExecute("C:\windows\explorer.exe",'"'&ControlGetText("", "", "Edit1")&$filename&'"') ConsoleWrite(_GUICtrlListView_GetItemText($hWnd, $avArray[0]) & @LF) return 1 ; EndIf EndIf EndIf EndIf Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) EndFunc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now