gamingmouse Posted October 5, 2009 Share Posted October 5, 2009 (edited) To grab the selected file names from the active windows explorer, I've been using a trick from this thread (code below): http://www.autoitscript.com/forum/index.php?showtopic=96598&st=0&p=695101&hl=egg%20crack&fromsearch=1&#entry695101 It's been working like a charm, but yesterday, when I had a bunch of explorer windows open, it stopped working. After investigating, I figured out that my script was sending its keystroke to the wrong explorer window. If I closed all the windows, and re-opened just the window I wanted, it worked again. However, I was under the impresson that ControlSend would default to the active window when it could match more than one window. Is this incorrect? Is there a way to make it default to the active window, as this is the behavior I want? Thanks, Jonah ;returns an array of full pathnames to selected files Func _ExplorerGetSelectedItems() Local $sOrigin_ClipGet = ClipGet() ClipPut("") If ControlSend("[CLASS:CabinetWClass]", "", "SysListView321", "^{INSERT}") = 0 Then MsgBox(4096, "Error", "Clipboard copy error") Return ClipPut($sOrigin_ClipGet) EndIf Local $sClipGet = ClipGet() Local $iTimer = TimerInit() While $sClipGet == "" And TimerDiff($iTimer) < 7000 ;wait for filenames to copy to clipboard Sleep(10) $sClipGet = ClipGet() WEnd ClipPut($sOrigin_ClipGet) If $sClipGet == "" Then MsgBox(4096, "Error", "No files Selected") Return -1 EndIf Return StringSplit($sClipGet, @LF) EndFunc Edited October 5, 2009 by gamingmouse Link to comment Share on other sites More sharing options...
TurionAltec Posted October 5, 2009 Share Posted October 5, 2009 Try this: ControlSend("[ACTIVE; CLASS:CabinetWClass]", "", "SysListView321", "^{INSERT}") Fubarable 1 Link to comment Share on other sites More sharing options...
gamingmouse Posted October 5, 2009 Author Share Posted October 5, 2009 Try this: ControlSend("[ACTIVE; CLASS:CabinetWClass]", "", "SysListView321", "^{INSERT}") that seems to fix it. thank you! 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