Easy Access to Currently Opened Folders
Re: Easy Access to Currently Opened Folders
this has been one of my pet peeves since forever. all the way back to windows xp when i got my first computer. its even more frustrating when the folder is open right there beside the "save as" window. its strange to think there is still no official solution after all this time but maybe none of the great people at microsoft are as bothered by this
anyway, just in case you dont know about it .document.folder.self.path stores the exact path to a folder so you might be able to skip the PathCreateFromUrl() function that youre using. (unless there is some other reason for doing it that way.... i just had a quick scan through your script so i could be missing something else)
ive also got away without using any sleep or controlGetFocus commands but maybe you have run into problems yourself
thats a great idea using this for the command line though, and sending the focus back to edit1 is a nice touch so im gonna have to rob that on you as well
anyway, just in case you dont know about it .document.folder.self.path stores the exact path to a folder so you might be able to skip the PathCreateFromUrl() function that youre using. (unless there is some other reason for doing it that way.... i just had a quick scan through your script so i could be missing something else)
Code: Select all
For pwb in ComObjCreate("Shell.Application").Windows
Menu, CurrentLocations, Add, % pwb.document.folder.self.path, f_Navigate
Code: Select all
winActivate, ahk_class #32770
send ^{l}
controlSetText, edit2, % a_thisMenuItem, ahk_class #32770
send {enter}
Re: Easy Access to Currently Opened Folders
I suspected there would be a function to get the path in a clean format! Thanks for that one, saves a DllCall!
1) Edit2 doesn't exist when the dialog inits. There's only the breadcrumb controls, like ToolbarWindow322, which the user clicks to turn into an edit box.
2) On custom dialogs (such as MPC-HC's Save Image dialog) the address bar editbox is bumped to Edit3! In that dialog Edit2 is actually the JPEG Quality input. Go figure! Why this is allowed I do not know, maybe there are good reasons, who knows.
So I have to grab the address bar by ID because its class sits on shifting sands. Also want to make sure I target the right dialog in case several are open, dunnow... And Sleep 50 has also proven necessary on my machine.
Again, see the discussion on Reddit
The problems here are thative also got away without using any sleep or controlGetFocus commands but maybe you have run into problems yourself
1) Edit2 doesn't exist when the dialog inits. There's only the breadcrumb controls, like ToolbarWindow322, which the user clicks to turn into an edit box.
2) On custom dialogs (such as MPC-HC's Save Image dialog) the address bar editbox is bumped to Edit3! In that dialog Edit2 is actually the JPEG Quality input. Go figure! Why this is allowed I do not know, maybe there are good reasons, who knows.
So I have to grab the address bar by ID because its class sits on shifting sands. Also want to make sure I target the right dialog in case several are open, dunnow... And Sleep 50 has also proven necessary on my machine.
Again, see the discussion on Reddit
Re: Easy Access to Currently Opened Folders
ha what a mess. its like the search box in the autohotkey .chm help file. it changes to a different edit number depending on what tabs youve clicked on which means there is no predictable way to know which it isleeroy wrote:the address bar editbox is bumped to Edit3!
Re: Easy Access to Currently Opened Folders
Going to try it out and see if it works with Directory Opus or see about getting it to work for DOpus... If so I'll be adding this to my personal framework addons_run folder to have it run every time I launch my framework ( which holds all of my scripts / hotkeys / classes / etc.. and dynamically creates the inclusion lists https://bitbucket.org/Acecool/acecoolah ... k/overview ) but I wouldn't release it with your script without your consent, naturally..
Edit: Found a bug - I'll post on github too..
If you only have one folder open and you middle click > release middle click > left-click only folder > release left-click - it will save to the currently opened folder instead of switching to the selected folder... I just saved the web-page and wanted to save to downloads and thought it worked when it automatically closed the SaveAs window after selecting the downloads folder... But, then I opened folder location and it was the previous folder in SaveAs... When 2 folders are open, clicking on 1 actually switches the folder.
Edit: Found a bug - I'll post on github too..
If you only have one folder open and you middle click > release middle click > left-click only folder > release left-click - it will save to the currently opened folder instead of switching to the selected folder... I just saved the web-page and wanted to save to downloads and thought it worked when it automatically closed the SaveAs window after selecting the downloads folder... But, then I opened folder location and it was the previous folder in SaveAs... When 2 folders are open, clicking on 1 actually switches the folder.
-Josh 'Acecool' Moser
I teach various programming languages, game programming, etc... I am also taking on programming jobs as my health allows.
I teach various programming languages, game programming, etc... I am also taking on programming jobs as my health allows.
Re: Easy Access to Currently Opened Folders
i was messing around with the old/classic save dialog in photoshop today and realised that you can enter a folder path into edit1 and it will go to the folder. it works for the new save dialogs as well. no hotkeys needed!
edit: ok i lied. the newer dialogs need a "sleep 50" in between those two lines
Code: Select all
controlSetText, edit1, % folder_path, ahk_class #32770
sleep 50
controlSend, edit1, {enter}, ahk_class #32770
edit: ok i lied. the newer dialogs need a "sleep 50" in between those two lines
Re: Easy Access to Currently Opened Folders
I know but I avoid using Edit1 because that's for filenames... If a Save dialog pre-fills the filename and I write over it to navigate to a path... basically I'm too lazy to properly handle that situation. And I don't see a reason to do so, what with Send !{d} and all. Using the address bar for addresses seems more appropriate.davebrny wrote:realised that you can enter a folder path into edit1 and it will go to the folder.
An improvement would be to dispense with the whole mechanism altogether and navigate independent of the dialog's controls. Using some Windows API. No more Sleep 50 and no more occasional quirks. That's why I posted it everywhere, in case someone can point out how that can be done. It's proven hard to Google.
Re: Easy Access to Currently Opened Folders
leeroy wrote:If a Save dialog pre-fills the filename and I write over it to navigate to a path
it actually puts the name back in after you enter the path. but if you enter the path half way through typing a new name then you would lose it though.
i just went with this method in the end since the !d hotkey doesnt work with the older dialogs. if you dont have to deal with any of them then lucky you!
Re: Easy Access to Currently Opened Folders
Oooh, I get it now. I'd like to support older dialogs too, so I'll look into it. It's true, I haven't had to deal with them in a while.
EDIT: Regedit Export dialog is one of these old ones.
I remember I could get one of these old dialogs with PowerShell:
They look like this
(screen recording from another useful gist, Conjoined Twins - IFTTT-style application actions using auditing and scheduled tasks)
EDIT: Regedit Export dialog is one of these old ones.
I remember I could get one of these old dialogs with PowerShell:
Code: Select all
# Show a legacy Common Open File Dialog, the one with the Places bar on the left
Function Get-FileName($initialDirectory, $Title) {
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
$OpenFileDialog.Title = $Title
$OpenFileDialog.initialDirectory = $initialDirectory
$OpenFileDialog.filter = "Executable Files(*.exe;*.bat;*.cmd)|*.exe;*.bat;*.cmd|All files (*.*)|*.*"
$OpenFileDialog.ShowHelp = $true # Without ShowHelp set to true the dialog doesn't display!
$OpenFileDialog.ShowDialog() | Out-Null
$OpenFileDialog.filename
}
$dialogtest = Get-FileName -initialDirectory "D:\Demo" -Title "Select whatever, this is a drill..."
(screen recording from another useful gist, Conjoined Twins - IFTTT-style application actions using auditing and scheduled tasks)
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 241 guests