ali79 Posted April 23, 2008 Share Posted April 23, 2008 (edited) Let's say I have got explorer open and I click two files using control. Now I wish to press some hotkey so that I get the paths of these two files. How is it to be done... I was thinking of trying it with GetCurrentSelection like this: Dim $selectedFiles WinWaitActive("[CLASS:ExploreWClass]", "", 10) If WinActive("[CLASS:ExploreWClass]", "") Then $selectedFiles = ControlCommand("", "", "[CLASS:SysListView32]","GetCurrentSelection") MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & 'selectedFiles' & @lf & @lf & 'Return:' & @lf & $selectedFiles);### Debug MSGBOX EndIf but I wasn't getting anything, just 0. However this will only give me the file names (even if I got it to work). So, what should I do? Thanks Edited April 23, 2008 by ali79 Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 23, 2008 Share Posted April 23, 2008 Hi, Opt("WinTitleMatchMode", 4) Global $ShellObject = ObjCreate("Shell.Application") Dim $Pfade = '' $WinList = WinList('[CLASS:ExploreWClass]') For $i = 1 To $WinList[0][0] $Pfade &= _GetExplorerWinOpenedPath($WinList[$i][1], $ShellObject) & @CRLF Next MsgBox(0, "", "Pfade geöffneter Explorer-Fenster:" & @CRLF & @CRLF & $Pfade) Func _GetExplorerWinOpenedPath($WinHandle, ByRef $ShellObject) If (Not IsObj($ShellObject)) And (Not ObjName($ShellObject) == 'IShellDispatch4') Then Return SetError(1, 0, '') For $Window In $ShellObject.Windows If ObjName($Window) == 'IWebBrowser2' Then If $window.HWND = $WinHandle Then Return StringReplace(StringReplace(StringReplace($window.LocationURL, 'file:///', ''), '/', '\'), '%20', ' ') EndIf EndIf Next Return SetError(2, 0, '') EndFunc Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
ali79 Posted April 23, 2008 Author Share Posted April 23, 2008 Thanks mega, this was interesting. However, I wish to get the file paths not in the url of explorer window but the file paths for files selected within by using mouse (ctrl + left-click). Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 23, 2008 Share Posted April 23, 2008 Hmmh, then I do not get what you need. Screenshot? Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Siao Posted April 23, 2008 Share Posted April 23, 2008 See #498391 "be smart, drink your wine" 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