Luis Diaz
asked on
Autohotkey: open notepad++ and send ctrl+n
Hello experts,
I have the following command that allows me to open notepad ++.
I was wondering how to send ctrl + n to open a new tab as notepad ++ stock previous tab.
I tried the following but it doesn't work.
Thank you in advance for your help.
I have the following command that allows me to open notepad ++.
I was wondering how to send ctrl + n to open a new tab as notepad ++ stock previous tab.
I tried the following but it doesn't work.
Thank you in advance for your help.
#!n:: Run C:\Program Files\Notepad++\notepad++.exe
Sleep 20
#IfWinActive ahk_class Notepad
Send, ^n
Thank you in advance for your help.
ASKER
Thank you very much. I tested but I don't get the ctrl + n this is very strange.
Probably the activate windows is not notepad this is why the send ctrl + n is not performed.
Thank you very much for your help.
Probably the activate windows is not notepad this is why the send ctrl + n is not performed.
Thank you very much for your help.
I suspect you're doing something wrong, as it works perfectly here every time. Does NPP run? Please post the script you're using.
P.S. I'm going to be afk for a couple of hours. Will check back into the thread as soon as I return to see how you're doing.
P.S. I'm going to be afk for a couple of hours. Will check back into the thread as soon as I return to see how you're doing.
ASKER
Thank you,
Unable to test it right now. I will keep you informed as soon as I can.
Unable to test it right now. I will keep you informed as soon as I can.
OK, I'm back...ready to help.
You can also do this with VBS, even if you just want to test it to make sure NP++ is working as expected on your system. Create the following VBS script and then run from a command line as below, after adjusting the path to your notepad++.exe as needed.
cscript np.vbs
»bp
cscript np.vbs
Const NotepadPlusExe = "C:\Program Files\Notepad++\notepad++.exe"
With WScript.CreateObject("WScript.Shell")
.Run NotepadPlusExe, 9
WScript.Sleep 1000
.SendKeys "^n"
End With
»bp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tested and it cover the need. Thank you very much for your help!!
You're very welcome, Luis, I'm glad that works for you. Regards, Joe
Open in new window
Regards, Joe