nf67 Posted June 18, 2010 Share Posted June 18, 2010 (edited) Hi, Is it possible to get the path of a file selected in the file browser / explorer? Or is it possible to use some kind of hotkey combination which copies the path of a selected file to the clipboard? Looking for suggestions, Thank you Edited June 18, 2010 by nf67 Link to comment Share on other sites More sharing options...
l3ill Posted June 18, 2010 Share Posted June 18, 2010 How about setting up a shortcut to a script in the context menu (right click). then you can use "FileGetLongPath" or whatever to put the info where you want it. Then all you have to do is right click the file, and click your script shortcut. good luck! Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted June 18, 2010 Share Posted June 18, 2010 Compile as "pathtest.exe" Global $sFilePath If $CmdLine[0] > 0 Then $sFilePath = $CmdLine[1] EndIf MsgBox(4096, "debug", "$sFilePath= " & $sFilePath) Then run this: $path = @ScriptDir & "\" & "pathtest.exe" RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\*\Shell", "pathtest") RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\*\Shell\pathtest", "Command") RegWrite("HKEY_LOCAL_MACHINE\Software\Classes\*\Shell\pathtest\Command", "", "REG_SZ", '"' & $path & '"' & " " & '"%1"') My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 18, 2010 Share Posted June 18, 2010 I did a search on 'explorer selected' and got a few results. Try here or here My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
nf67 Posted June 18, 2010 Author Share Posted June 18, 2010 Thanks to both of you, I've never modified anything shell related before, but it's working perfectly, just a right click and I can get the entire path using ClipPut(). Link to comment Share on other sites More sharing options...
KaFu Posted June 18, 2010 Share Posted June 18, 2010 Take also a look at this nice example, though I think I remember it only works on XP, but surley with some tweaking (change control classes of explorer in line with @OSVersion?) it should work on Vista or Win7 as well. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 18, 2010 Share Posted June 18, 2010 (edited) That's funny KaFu, you posted the same link as I did (2nd link). But hey.. guess what. Windows 7 doesn't use a listview anymore for Explorer windows. It uses that @#*$ 'DirectUIHWND' control type. Argh.. we're going to need to figure out a way to work with the DirectUI interface. Maybe Monoceres or trancexx might be willing to investigate possible ways to interact with these new interfaces. (just volunteering some names ) *edit: that link was just to get the folder path of what was being browsed.. I was thinking of how to get the actual files selected. Edited June 18, 2010 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
KaFu Posted June 19, 2010 Share Posted June 19, 2010 Seems like Authenticity and trancexx already pushed into that direction in this thread here...This thread also seems to contain some useful snippets.This is what I tried so far, at least there seems to be happening something ...expandcollapse popup#include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; http://www.autoitscript.com/forum/index.php?showtopic=98947&view=findpost&p=711318 Opt("WinWaitDelay", 0) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $oMyError = ObjEvent("AutoIt.Error", "_ErrFunc") Global $hOLEACC = DllOpen("oleacc.dll") Global $hWnd_DirectUIHWND3 = ControlGetHandle("[CLASS:CabinetWClass]", "", "[CLASSNN:DirectUIHWND3]") if not IsHWnd($hWnd_DirectUIHWND3) then Exit Global $oAccessibleObject = _AccessibleObjectFromWindow($hWnd_DirectUIHWND3) If IsObj($oAccessibleObject) Then ; http://msdn.microsoft.com/en-us/library/dd318466%28v=VS.85%29.aspx ; ConsoleWrite("accChild: " & $oAccessibleObject.accChild($Param) & @CRLF) ;<- ConsoleWrite("accChildCount: " & $oAccessibleObject.accChildCount & @CRLF) ConsoleWrite("accDefaultAction: " & $oAccessibleObject.accDefaultAction & @CRLF) ConsoleWrite("accDescription: " & $oAccessibleObject.accDescription & @CRLF) ConsoleWrite("accFocus: " & $oAccessibleObject.accFocus & @CRLF) ConsoleWrite("accHelp: " & $oAccessibleObject.accHelp & @CRLF) ; ConsoleWrite("accHelpTopic: " & $oAccessibleObject.accHelpTopic($Param) & @CRLF) ;<- ConsoleWrite("accKeyboardShortcut: " & $oAccessibleObject.accKeyboardShortcut & @CRLF) ConsoleWrite("accName: " & $oAccessibleObject.accName & @CRLF) ConsoleWrite("accParent: " & $oAccessibleObject.accParent & @CRLF) ConsoleWrite("accRole: " & $oAccessibleObject.accRole & @CRLF) ConsoleWrite("accSelection: " & $oAccessibleObject.accSelection & @CRLF) ConsoleWrite("accState: " & $oAccessibleObject.accState & @CRLF) ConsoleWrite("accValue: " & $oAccessibleObject.accValue & @CRLF) EndIf $oAccessibleObject = 0 DllClose($hOLEACC) Exit Func _AccessibleObjectFromWindow($hWnd) Local $sIID_IAccessible = "{618736E0-3C3D-11CF-810C-00AA00389B71}" Local $tGUID = _WinAPI_GUIDFromString($sIID_IAccessible) Local $pGUID = DllStructGetPtr($tGUID) Local $aCall = DllCall($hOLEACC, "int", "AccessibleObjectFromWindow", _ "hwnd", $hWnd, _ "dword", 0, _ ; OBJID_WINDOW "ptr", $pGUID, _ "idispatch*", 0) If @error Or $aCall[0] Then Return SetError(1, 0, 0) EndIf Return $aCall[4] EndFunc ;==>_AccessibleObjectFromWindow Func _ErrFunc() ConsoleWrite("--- COM Error, number = " & Ptr($oMyError.number) & ", description: " & $oMyError.windescription) EndFunc ;==>_ErrFunc OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 19, 2010 Share Posted June 19, 2010 Ahh, good find KaFu. The 'something' does appear to be happening ! Can't make heads or tails of it mysellfI was looking at the DirectUI/UIPower site, and it has this page on DirectUI ListView Methods. Not sure if that's IDispatch type of stuff or not? *shrug* All I know is I can't make it work myself.There is someone that figured out how to make Windows Explorer use the old SysListView32 format, but I don't see it as a good long-term solution.. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
666alberto Posted October 26, 2010 Share Posted October 26, 2010 That's funny KaFu, you posted the same link as I did (2nd link). But hey.. guess what. Windows 7 doesn't use a listview anymore for Explorer windows. It uses that @#*$ 'DirectUIHWND' control type. Argh.. we're going to need to figure out a way to work with the DirectUI interface. Maybe Monoceres or trancexx might be willing to investigate possible ways to interact with these new interfaces. (just volunteering some names ) *edit: that link was just to get the folder path of what was being browsed.. I was thinking of how to get the actual files selected. HEI finally!! i've the same iusse! (with win7 x64bit): it' hours i'm reading but i can't find my solution: like to save the .txt of a notepad in a different location? i watch names with AutoItWin Info and i find out ToolbarWindow32, what if i want to edit that "box" ?? i tried -ControlSetText("Salva con nome", "", "CLASS:ToolbarWindow32; INSTANCE:3]", "C:\") or with click -ControlClick("Salva con nome", "", "ToolbarWindow32") or with a normal Send But noone worked=( i'm at the beginning please help me!=( (i've read example script but not find for this!) [and then: what if i'd like to write in DirectUIHWND for a research? (while saving..)what should i do? ControlSend("Salva con nome","","[CLASS:DirectUIHWND; INSTANCE:3]","ciao"); doesn't work.. ] Link to comment Share on other sites More sharing options...
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