Create new folder in Explorer? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Lee James
Posts: 17
Joined: 05 May 2019, 06:27

Create new folder in Explorer?

08 May 2019, 05:31

I've been struggling with this for a while…

In Explorer, I want to be able to delete files by pressing Ctrl+D, and create a new folder by pressing Ctrl+G.

The Script I made works fine for delete, but not for making a new folder:

Code: Select all

; *** Delete ***
#IfWinActive, Explorer
^d::
   Send, {delete}
Return

; *** New folder ***
#IfWinActive, Explorer
^g::
   Send, {control}{shift}n
Return
I also tried ^+n instead of {control}{shift}n but neither has any effect.

Something else I would love to be able to do (if it's possible?) is have a shortcut which moves the currently selected files into a new folder. Can that be done?
Last edited by Lee James on 09 May 2019, 07:00, edited 1 time in total.
User avatar
elModo7
Posts: 217
Joined: 01 Sep 2017, 02:38
Location: Spain
Contact:

Re: Create new folder in Exploerer?  Topic is solved

08 May 2019, 05:39

Change that to this:

Code: Select all

; *** New folder ***
#IfWinActive, ahk_exe explorer.exe
^g::
	Send, {LControl Down}{LShift Down}N{LControl Up}{LShift Up}
Return
Lee James
Posts: 17
Joined: 05 May 2019, 06:27

Re: Create new folder in Exploerer?

09 May 2019, 06:44

elModo7 wrote:
08 May 2019, 05:39
Change that to this:
FANTASTIC! :) Thank you elModo7! :)
Lee James
Posts: 17
Joined: 05 May 2019, 06:27

Re: Create new folder in Exploerer?

09 May 2019, 06:59

elModo7 wrote:
08 May 2019, 05:39
Change that to this:
I've just noticed something strange… Now that I've added your code to my script, none of my other keys work!

For example, this shortcut no longer works at all:

Code: Select all

#2::
   Send, ½
Return
gregster
Posts: 9064
Joined: 30 Sep 2013, 06:48

Re: Create new folder in Explorer?

09 May 2019, 12:16

Strange? Depends on the structure of your script. My guess: you placed the other hotkeys behind the context-sensitive hotkey:

A context-sensitive hotkey definition section (started here with #IfWinActive, ahk_exe explorer.exe) needs to be closed with #IfWinactive or #If without any parameter to close the context-sensitive section, if there are other hotkeys after it, that should work anyway...
https://www.autohotkey.com/docs/commands/_If.htm wrote:To turn off context sensitivity, specify #If or any #IfWin directive but omit all the parameters.

Code: Select all

; some general hotkeys here
[...]

#IfWinActive, ahk_exe explorer.exe
[...]		; contect-sensitive hotkeys here
#If		; closes the context-sensitive section

; other general hotkeys here:
#2::
   Send, ½
Return
If that's not it - please show a code snippet that allows to reproduce the problem...
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Create new folder in Explorer?

10 May 2019, 07:54

- I would do it like this:

Code: Select all

#IfWinActive, ahk_exe explorer.exe
^g:: ;create new folder
SendInput, ^+n
return
#IfWinActive
- Note: I use n, not N, N is equivalent to shift+n. (I tested, and SendInput, ^N worked, although I prefer ^+n for clarity.)
- Note also (repeating gregster): #If and #IfWinActive affect all hotkey labels underneath them, until the next #If/#IfWinActive.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
elModo7
Posts: 217
Joined: 01 Sep 2017, 02:38
Location: Spain
Contact:

Re: Create new folder in Explorer?

13 May 2019, 02:11

I myself had never used the #IfWinActive, I tend to do something like this:

Code: Select all

^g::gosub, SampleLabel


SampleLabel:
	IfWinActive, Untitled - Notepad
	{
	    WinMaximize  ; Maximizes the Notepad window found by IfWinActive above.
	    Send, Some text.{Enter}
	    return
	}
return
That way I find hotkeys easier to spot and labels help isolate their purpose.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 176 guests