kcvinu Posted June 22, 2019 Share Posted June 22, 2019 Hi all, I am trying to open a specific path in my pc with this command ShellExecute("D:\MyFolderPath") But this will open the folder in a new explorer window. I just want the folder to open in the current explorer window. How to do it ? Please help. Thanks in advance. Side note : Actually, i am using QTTabbar in my Windows Explorer so it has a tabbed feature. If the folder opened in current window, it will displayed in a new tab. But now, it is opening in a new explorer window. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
rudi Posted June 25, 2019 Share Posted June 25, 2019 Hi. Use the Autoit Window Info Tool to catch the control-ID you need to put your path information in. AFAIK shellexecute() will always open an additional Windows Explorer window. CU Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Aelc Posted June 26, 2019 Share Posted June 26, 2019 (edited) Hey i actually don't know how QTTabbar works. but in a normal explorer u could set ur old window as parent to a new instance and set the pos/size to the old... like #include <WinAPI.au3> #include <WinAPISysWin.au3> $newpath = @ScriptDir Global $hMigration, $hExplHolder, $hExplorer, $sStartDir = "C:\" If WinExists ( "[CLASS:CabinetWClass]","" ) Then $hExplHolder = WinGetHandle ( "[CLASS:CabinetWClass]","" ) Local $pos = WinGetPos ( $hExplHolder,"" ) _createexp($hExplHolder,$newpath,$pos[2],$pos[3]) Else MsgBox ( 48,"error","no window exist" ) EndIf Func _createexp ($hwnd,$newpath,$w,$h) $sStartDir = $newpath Run('C:\Windows\explorer.exe /n, "' & $sStartDir & '"',"",@SW_HIDE) WinWaitActive("[CLASS:CabinetWClass]") $hExplorer2 = WinGetHandle("[CLASS:CabinetWClass]") WinSetState($hExplorer2, "", @SW_HIDE) WinMove($hExplorer2, "", -8, -30, $W, $H) _WinAPI_SetParent($hExplorer2, $hExplHolder) WinSetState($hExplorer2, "", @SW_SHOW) EndFunc you just have to care when you want to resize it (btw i think there is an option to force size of parent) or if you have more then 1 instances of it because always the last is selected... but you could write the handle down. was just first idea - maybe i get another soon tried to install QTTabbar but i have to read something about it first i guess else u could try it with controlsend or something there is no way to do this without a new instance i guess, but im not sure Edited June 26, 2019 by Aelc why do i get garbage when i buy garbage bags? Link to comment Share on other sites More sharing options...
Earthshine Posted June 26, 2019 Share Posted June 26, 2019 see FAQ 31and UIAutomation My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
robertocm Posted October 23 Share Posted October 23 Just to add this reference that seems to work: ;Xenobiologist, Oct 21, 2020 ;https://stackoverflow.com/questions/64417468/object-shell-application-open-folder-in-same-explorer-window bdr529 1 Link to comment Share on other sites More sharing options...
bdr529 Posted October 24 Share Posted October 24 14 hours ago, robertocm said: Just to add this reference that seems to work: ;Xenobiologist, Oct 21, 2020 ;https://stackoverflow.com/questions/64417468/object-shell-application-open-folder-in-same-explorer-window SendKeepActive($handle) Send('{F4}') Send('^a') Send(@AppDataCommonDir & "{ENTER}") ......... SendKeepActive($handle) if @OSVersion="WIN_11" then Send('^t') ; new tab win 11 if @OSVersion="WIN_11" or @OSVersion="WIN_10" then Send('^l') ; focus on the address bar (win 10&11) else Send('{F4}') Send('^a') endif Send(@AppDataCommonDir & "{ENTER}") To community goes all my regards and thanks Link to comment Share on other sites More sharing options...
robertocm Posted October 24 Share Posted October 24 16 hours ago, robertocm said: Just to add this reference that seems to work: ;Xenobiologist, Oct 21, 2020 ;https://stackoverflow.com/questions/64417468/object-shell-application-open-folder-in-same-explorer-window The Function _WinGetHandleByPID does not work with explorer.exe returning 0 as the handle: $pid = ShellExecute("explorer.exe ", @DesktopDir) If Not ProcessExists($pid) Then ConsoleWrite("no matching process" & @CRLF) Explained here: Link to comment Share on other sites More sharing options...
KaFu Posted October 24 Share Posted October 24 Use @LarsJ’s excellent UDF. robertocm 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) 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