Page 1 of 1

how can i change the folder in an in/active window via hotkey

Posted: 18 Nov 2016, 09:54
by Sarusei
what i want a hotkey to do:
after pressing the hotkey
a specifivic window should be selected let's say i use WinActivate for that
then the directory should be changed to a subdirectory of that folder
e.g.:
pressing hotkey
-> folder "C:\newF" was activated
--> chage directory of this folder to a subfolder "C:\newF\one"

this is how far i've made it ....

Code: Select all

pathToF := "C:\newF"
IfWinExist, %pathToF% ahk_class CabinetWClass
{
	WinActivate, %pathToF% ahk_class CabinetWClass
} else {
	run, %pathToF%
}
but what comes next?
how can i change the directory to show me another one(subdirectory in this case "c:\newF\one") in the Active window

i would imagine that the commands for a 2nd hotkey that sets the directory in an active window to the folder one level higher would be the similar, right?

any tips, hints or ideas
thx in advance

Re: how can i change the folder in an in/active window via hotkey  Topic is solved

Posted: 18 Nov 2016, 12:19
by GEV
Sarusei wrote:but what comes next?
how can i change the directory to show me another one(subdirectory in this case "c:\newF\one") in the Active window
Navigating to a directory without opening a new window:

Code: Select all

NavRun("C:\newF\one")

 ; http://msdn.microsoft.com/en-us/library/bb774094
GetActiveExplorer() {
    static objShell := ComObjCreate("Shell.Application")
    WinHWND := WinActive("A")    ; Active window
    for Item in objShell.Windows
        if (Item.HWND = WinHWND)
            return Item        ; Return active window object
    return -1    ; No explorer windows match active window
}

NavRun(Path) {
    if (-1 != objIE := GetActiveExplorer())
        objIE.Navigate(Path)
    else
        Run, % Path
}
https://autohotkey.com/board/topic/1021 ... ntry634365

Re: how can i change the folder in an in/active window via hotkey

Posted: 21 Nov 2016, 02:43
by Sarusei
that's what i needed tyvm