Paste folder path to "Save as" window Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Avastgard
Posts: 133
Joined: 30 Sep 2016, 21:54

Paste folder path to "Save as" window

Post by Avastgard » 07 Jul 2022, 08:17

Something I have to do all day at work is to use the "Save as" window to save files in specific folders. I noticed that everytime I do this I have the destination folder open, but the "Save as" window default location never is what I need it to be unless the last thing I saved was already on the destination folder. So what I do is:
  • Activate destination folder
  • Press Ctrl + L to select the folder path
  • Press Ctrl + C to copy folder path
  • Activate "Save as" window
  • Press Ctrl + L to select address bar
  • Press Ctrl + V to paste destination folder path
  • Press Enter to navigate to destination folder
  • Click OK to save on destination folder
This routine always feels clumsy and I wondered if AutoHotkey could help me make it more streamlined. My idea is to write a script that copies a folders's path whenever I click anywhere on it with MButton. Then, when I click on the "Save as" window with MButton, it automatically pastes the destination folder's path and presses Enter to navigate there. That's what I thought, at least, maybe there are simpler or more efficient solutions.

I wrote this script which will work for the first part (copying destination folder's path), but fails to paste it to the "Save as" folder:

Code: Select all

MButton::
IfWinActive ahk_class CabinetWClass ahk_exe Explorer.EXE
	Send, ^l
	Send, ^c
IfWinActive ahk_class #32770 ahk_exe chrome.exe
	Send, ^l
	Send, ^a
	Send, ^v
	Send, {Enter}
	return
Any help to fix it (or the suggestion of other approaches) are welcome.

Descolada
Posts: 1154
Joined: 23 Dec 2021, 02:30

Re: Paste folder path to "Save as" window  Topic is solved

Post by Descolada » 07 Jul 2022, 09:24

I think you're just missing some brackets:

Code: Select all

RButton::
	IfWinActive ahk_class CabinetWClass ahk_exe Explorer.EXE
	{
		Send, ^l
		Send, ^c
	}
	IfWinActive ahk_class #32770 ahk_exe chrome.exe
	{
		Send, ^l
		Send, ^a
		Send, ^v
		Send, {Enter}
	}
	return
Without the brackets, it only includes the next line:

Code: Select all

IfWinActive ahk_class CabinetWClass ahk_exe Explorer.EXE
	Send, ^l
Send, ^c
is equivalent to

Code: Select all

IfWinActive ahk_class CabinetWClass ahk_exe Explorer.EXE
{
	Send, ^l
}
Send, ^c ; Sends ctrl+c in any case

Avastgard
Posts: 133
Joined: 30 Sep 2016, 21:54

Re: Paste folder path to "Save as" window

Post by Avastgard » 07 Jul 2022, 09:46

Thanks, that solved the problem!

I seem to always fumble with brackets. Guess I'll have to do some more reading on the documentation about this.

Post Reply

Return to “Ask for Help (v1)”