1
Post New Requests Here / IDEA: Insta-switch file dialog to any Explorer window's path (code included)
« on: April 01, 2010, 08:25 PM »
Hi, first post ;D
I used to use Direct Folders, but had to switch to Folder Menu after I got tired of dealing with various bugs. One thing I sorely missed was the QuickSwitch feature, so I hacked up a LinkExplorerPathToFileDialog Autohotkey script. It's been briefly tested in Window XP only. If anyone would like to take a stab at any of the "NEEDS HELP WITH" or offer suggestions it would be greatly appreciated! I'm an AHK newbie...
I used to use Direct Folders, but had to switch to Folder Menu after I got tired of dealing with various bugs. One thing I sorely missed was the QuickSwitch feature, so I hacked up a LinkExplorerPathToFileDialog Autohotkey script. It's been briefly tested in Window XP only. If anyone would like to take a stab at any of the "NEEDS HELP WITH" or offer suggestions it would be greatly appreciated! I'm an AHK newbie...
Code: AutoIt [Select]
- ; LinkExplorerPathToFileDialog.ahk v0.01 WIP by koomi
- ; *** WARNING: Alpha code! Use at your own risk! ***
- ; Makes a file dialog instantly jump to the folder of any Explorer Window you click
- ; Idea stolen from Direct Folders' "QuickSwitch" feature.
- ;
- ; How to use:
- ; 1) Open a file dialog (Open/Save, also works with 7-Zip Extract and so forth)
- ; 2) Switch to an open Windows Explorer window
- ; 3) The Open/Save dialog will change to same path as the Explorer window
- ; *) Autohotkey_L is recommended if your system has non-Western foldernames
- ;
- ; NEEDS HELP WITH:
- ; User testing
- ; Windows Vista/7 compatibility
- ; Better sanity checking to make sure we're really dealing with a file dialog
- ; Maybe by matching the window title against a list of known good ones?
- ; Work with folder tree dialogs as well (like Direct Folders)
- ; .INI file to allow specifying custom class+control+title combinations
- ; Microsoft Office compatibility
- ; Allow modification of the filename after the dialog first opens
- ; Pretty icon and menu stuff like "Disable/Enable"
- ; Flash taskbar/caption of dialog parent when path is changed or something
- #SingleInstance Force
- #Persistent
- SetBatchLines,-1
- Gui +LastFound
- shWnd := WinExist()
- OnMessage( MsgNum, "ShellMessage" )
- HookProcAdr := RegisterCallback( "HookProc", "F" )
- hWinEventHook := SetWinEventHook( 0x3, 0x3, 0, HookProcAdr, 0, 0, 0 )
- ; Globals that need to be shared between ShellMessage() and HookProc()
- ControlText =
- ControlHwnd =
- LastCharacter =
- OnExit, HandleExit
- ; See http://www.autohotkey.com/forum/post-123323.html
- ShellMessage( wParam,lParam )
- {
- global ControlText
- global ControlHwnd
- global LastCharacter
- ; See http://msdn.microsoft.com/en-us/library/ms644989.aspx
- {
- WinGetClass, Class, ahk_id %lParam%
- ; Is this an Explorer window?
- {
- ; Do we have a Open/Save control handle available?
- {
- {
- ; Change the path to the Explorer path
- ; Put the original filename back in the dialog edit control
- }
- ; For cases like 7-Zip "Extract" dialog which contain pathnames, not filenames
- {
- }
- ; If Dialog is gone, reset globals to avoid extra work next time around
- If ErrorLevel
- {
- ControlText =
- ControlHwnd =
- LastCharacter =
- }
- }
- }
- }
- }
- ; See http://www.autohotkey.com/forum/topic35659.html
- {
- global ControlText
- global ControlHwnd
- global LastCharacter
- If Event ; EVENT_SYSTEM_FOREGROUND = 0x3
- {
- ; Windows and dialog boxes need time to "settle". See AHK manual
- WinGetClass, DialogClass, ahk_id %hWnd%
- ; Is this a typical Open/Save dialog box?
- {
- ; Populate globals for use in ShellMessage
- }
- }
- }
- SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags)
- {
- , Uint,eventMin
- , Uint,eventMax
- , Uint,hmodWinEventProc
- , Uint,lpfnWinEventProc
- , Uint,idProcess
- , Uint,idThread
- , Uint,dwFlags)
- }
- UnhookWinEvent()
- {
- }
- HandleExit:
- UnhookWinEvent()
- ExitApp