CyberSlug Posted March 10, 2005 Posted March 10, 2005 (edited) I really like explorer's file path\name autocompletion feature; however, I frequently wish I could have an explorer window open with the file selected. (For example suppose I want to bring up the file properties for C:\Windows\system32\calc.exe. I could launch "C:\Windows\system32" and then scroll down--or repeatedly hit the letter C--until I reach calc.exe, but this is annoying.)Aside: I do have tab-completion configured for cmd but I prefer the drop-down completion list provided by explorer or the Run dialog. Example usage:0) Execute script below.1) Click Start, Run2) Type in a path such as C:\Windows\notepad.exe3) Click the View button (or press Alt+V)4) Wait for the explorer window to appear Edit: Removed the WinWaitDelayexpandcollapse popup; CyberSlug - 10 March 2005 ; ; Code largely borrowed from Valik < http://www.autoitscript.com/forum/index.php?showtopic=8900 > #include <GUIConstants.au3> ;;;;;;;Opt("WinWaitDelay", 10) HotKeySet("!v", "ClickView") Func ClickView() ToolTip("Please Wait") ControlClick("Run", "", "&View") Sleep(500) ToolTip('') EndFunc While 1 sleep(10) WinWait("Run") Local $hWnd = WinGetHandle("Run") Local $hRealButton = ControlGetHandle($hWnd, "", "Button4") Local $aControl = ControlGetPos($hWnd, "", $hRealButton) GUICreate("FooView", $aControl[2], $aControl[3], 10, $aControl[1], $WS_CHILD, -1, $hWnd) Local $hFakeButton = GUICtrlCreateButton("&View", 0, 0, $aControl[2], $aControl[3]) GUISetState(@SW_SHOW) While WinExists($hWnd) Local $msg = GUIGetMsg() If $msg = $hFakeButton Then Run("explorer /select," & """" & ControlGetText("Run","","Edit1") & """") WinClose("Run") EndIf WEnd WEndStatement of the obvious:If you don't like the script running in the background all the time, then remove the outer While loop, put Send("#r") at the beginning, and assign the script to a Start Menu or Desktop shortcut with the hotkey Ctrl+Alt+R or something. Edited March 14, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
buzz44 Posted March 14, 2005 Posted March 14, 2005 nice, i feel bad that no one has posted yet =(, but great job , i never use run etc but i can see how this is useful if u use it frequently qq
therks Posted March 14, 2005 Posted March 14, 2005 Odd.. when I first ran it, it just made all the buttons in my Run dialog disappear. Seems to be working fine now though. My AutoIt Stuff | My Github
CyberSlug Posted March 14, 2005 Author Posted March 14, 2005 (edited) Odd.. when I first ran it, it just made all the buttons in my Run dialog disappear. Seems to be working fine now though.<{POST_SNAPBACK}>Yeah, I noticed that on a computer. I think there is a timining issue; I'll work on a fix.Maybe using the default 250 ms WinWaitDelay will help. Edited March 14, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
SlimShady Posted March 14, 2005 Posted March 14, 2005 The script makes my CPU go up to 100% and makes it impossible to exit the script using the tray icon. Maybe it keeps recreating the window.
Kerberuz Posted March 14, 2005 Posted March 14, 2005 (edited) I really like explorer's file path\name autocompletion feature; Blah Blah Blah...Read original post...This is pretty cool tool. I took the code and added an alias/exe check. Not much to shout about, but I'm learning and thought I'd try to improve on CS's idea a little.Here is my rendition:expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: CyberSlug - 10 March 2005 ; Modified; Kerberuz - 14 March 2005 Added support for aliases ; ; Code largely borrowed from Valik < http://www.autoitscript.com/forum/index.php?showtopic=8900 > ; ; Script Function: ; Check an alias in the registry so when ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> #include "#CheckAlias.au3" Opt("WinWaitDelay", 10);speed things up HotKeySet("!v", "ClickView") Func ClickView() ToolTip("Please Wait") ControlClick("Run", "", "&View") Sleep(500) ToolTip('') EndFunc While 1 sleep(10) WinWait("Run") Local $hWnd = WinGetHandle("Run") Local $hRealButton = ControlGetHandle($hWnd, "", "Button4") Local $aControl = ControlGetPos($hWnd, "", $hRealButton) GUICreate("FooView", $aControl[2], $aControl[3], 10, $aControl[1], $WS_CHILD, -1, $hWnd) Local $hFakeButton = GUICtrlCreateButton("&View", 0, 0, $aControl[2], $aControl[3]) GUISetState(@SW_SHOW) While WinExists($hWnd) Local $msg = GUIGetMsg() If $msg = $hFakeButton Then Run("explorer /select," & """" & CheckAlias(ControlGetText("Run","","Edit1")) & """") WinClose("Run") EndIf WEnd WEnd#Include file #CheckAlias.au3expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: Kerberuz - 14 March 2005 ; ; Enhancment Code for topic http://www.autoitscript.com/forum/index.php?showtopic=9362 ; Original authors for the code are Valik & CyberSlug ; ; Script Function: ; This will allow aliases to be used with CyberSlugs Explorer View Select ; Also added a check for exe in the system directory ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here Dim $X = 0, $Count = 1, $AliasPath Func CheckAlias($Run) $AliasPath = "" If StringInStr($Run, ":") = 0 Then While $X = 0 $Alias = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\APP PATHS", $Count) $Count = $Count + 1 If @error Then ExitLoop EndIf If StringInStr($Alias, $Run) <> 0 Then $AliasPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\APP PATHS\" & $Alias, "") $AliasPath = StringReplace($AliasPath, "%ProgramFiles%", @ProgramFilesDir) $AliasPath = StringReplace($AliasPath, "%SystemRoot%", @WindowsDir) ExitLoop EndIf WEnd If StringInStr($AliasPath, ":") <> 0 Then; Alias found Return $AliasPath Else; No Alias try to find the file in the windir If StringInStr($Run, ".exe") <> 0 Then If FileExists(@SystemDir & "\" & $Run) Then Return @SystemDir & "\" & $Run EndIf Else If FileExists(@SystemDir & "\" & $Run & ".exe") Then Return @SystemDir & "\" & $Run & ".exe" EndIf EndIf EndIf Else Return $Run EndIf EndFunc ;==>CheckAliasBy using the word "Improve" I do not mean "Code War" as I will not be able to compete. ; Addendum this part was added for the select few you know who you are. Edited March 14, 2005 by Kerberuz Kerby
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