Quote from JEROME BRUET on April 3, 2024, 12:56 pmI want to send keys (Ctrl + N) to another application. I try whith a "+" and whithout but nothing works. Could you help me ?
SendKeys "C:\Program Files (x86)\WinJump 2014\WinJump2014.exe" "{CtrlDn}+{N}"
I want to send keys (Ctrl + N) to another application. I try whith a "+" and whithout but nothing works. Could you help me ?
SendKeys "C:\Program Files (x86)\WinJump 2014\WinJump2014.exe" "{CtrlDn}+{N}"
Quote from JEROME BRUET on April 3, 2024, 2:16 pmThanks a lot for your quick answer.
But it doesn't work. I don't why.
I can control the application with single key like {F6} but {CtrlDn}{N} doesn't work ! But it works when I do it directly in the application by the keyboard !
An idea ?
Thanks a lot for your quick answer.
But it doesn't work. I don't why.
I can control the application with single key like {F6} but {CtrlDn}{N} doesn't work ! But it works when I do it directly in the application by the keyboard !
An idea ?
Quote from Gaev on April 3, 2024, 2:56 pm@jerome-bruet
I can control the application with single key like {F6} but {CtrlDn}{N} doesn't work !
1) As stated here ... https://winhelp.visualneo.com/Applications.html#SENDKEYS ...
{ShiftDn} {ShiftUp} {CtrlDn} {CtrlUp} {AltDn} {AltUp}
These keys must always be used in pairs. For example, if you use {ShiftDn} you must remember to follow it with a {ShiftUp} code, otherwise your keyboard will behave as if the Shift key is stuck in the down position.
2) As shown in the example on this same page ...
SendKeys "notepad.exe" "Hello world{Enter}{AltDn}FP{AltUp}"
... regular text does not have to be placed inside curly brackets.
So try ...
{CtrlDn}N{CtrlUp}
I can control the application with single key like {F6} but {CtrlDn}{N} doesn't work !
1) As stated here ... https://winhelp.visualneo.com/Applications.html#SENDKEYS ...
{ShiftDn} {ShiftUp} {CtrlDn} {CtrlUp} {AltDn} {AltUp}
These keys must always be used in pairs. For example, if you use {ShiftDn} you must remember to follow it with a {ShiftUp} code, otherwise your keyboard will behave as if the Shift key is stuck in the down position.
2) As shown in the example on this same page ...
SendKeys "notepad.exe" "Hello world{Enter}{AltDn}FP{AltUp}"
... regular text does not have to be placed inside curly brackets.
So try ...
{CtrlDn}N{CtrlUp}
Quote from JEROME BRUET on April 3, 2024, 4:10 pmThanks !
It doesn't work ! But thank you :) !
Thanks !
It doesn't work ! But thank you :) !
Quote from Gaev on April 3, 2024, 8:04 pm@jerome-bruet
It doesn't work !
1) See if you can send the same keys to notepad.exe; note that if you do a Ctrl+N on a just opened notepad.exe, nothing will be visibly different, but if you do it while there is an unsaved text in the current space, you will be asked if you wanted to save this first.
2) Perhaps this is a timing issue i.e. if you are attempting to send this key combo immediately after the Run command, the SendKeys command may be serviced BEFORE this program is fully loaded and ready to accept keys.
You might want to wait a while until this program is fully loaded (either x seconds or temporarily have a separate button to send the keys after you can confirm that this program is ready to accept user input).
3) If you are interested in further investigating this anomaly ...
a) what does Ctrl+N do within this program ?
b) what does F1 do within this program ?
It doesn't work !
1) See if you can send the same keys to notepad.exe; note that if you do a Ctrl+N on a just opened notepad.exe, nothing will be visibly different, but if you do it while there is an unsaved text in the current space, you will be asked if you wanted to save this first.
2) Perhaps this is a timing issue i.e. if you are attempting to send this key combo immediately after the Run command, the SendKeys command may be serviced BEFORE this program is fully loaded and ready to accept keys.
You might want to wait a while until this program is fully loaded (either x seconds or temporarily have a separate button to send the keys after you can confirm that this program is ready to accept user input).
3) If you are interested in further investigating this anomaly ...
a) what does Ctrl+N do within this program ?
b) what does F1 do within this program ?
Quote from JEROME BRUET on April 3, 2024, 8:28 pmThanks. I'll try all these points.
Thanks. I'll try all these points.
Quote from JEROME BRUET on April 3, 2024, 9:43 pmThe results :
1) See if you can send the same keys to notepad.exe; note that if you do a Ctrl+N on a just opened notepad.exe, nothing will be visibly different, but if you do it while there is an unsaved text in the current space, you will be asked if you wanted to save this first.
>> It's open a new notepad but it isn't ask to save the first one
>> If I do a Ctrl+S, it works and it asks to save the new one
So Ctrl+S works2) Perhaps this is a timing issue i.e. if you are attempting to send this key combo immediately after the Run command, the SendKeys command may be serviced BEFORE this program is fully loaded and ready to accept keys.
You might want to wait a while until this program is fully loaded (either x seconds or temporarily have a separate button to send the keys after you can confirm that this program is ready to accept user input).
>> I had tested this way but I don't think that can be the reason because if I do another action like {F6} it works well
3) If you are interested in further investigating this anomaly ...
a) what does Ctrl+N do within this program ?
>>It works. It do what the program must dob) what does F1 do within this program ?
>>Nothing.
The results :
1) See if you can send the same keys to notepad.exe; note that if you do a Ctrl+N on a just opened notepad.exe, nothing will be visibly different, but if you do it while there is an unsaved text in the current space, you will be asked if you wanted to save this first.
>> It's open a new notepad but it isn't ask to save the first one
>> If I do a Ctrl+S, it works and it asks to save the new one
So Ctrl+S works
2) Perhaps this is a timing issue i.e. if you are attempting to send this key combo immediately after the Run command, the SendKeys command may be serviced BEFORE this program is fully loaded and ready to accept keys.
You might want to wait a while until this program is fully loaded (either x seconds or temporarily have a separate button to send the keys after you can confirm that this program is ready to accept user input).
>> I had tested this way but I don't think that can be the reason because if I do another action like {F6} it works well
3) If you are interested in further investigating this anomaly ...
a) what does Ctrl+N do within this program ?
>>It works. It do what the program must do
b) what does F1 do within this program ?
>>Nothing.
Quote from Gaev on April 3, 2024, 11:24 pm@jerome-bruet
Since I don't have WinJump2014.exe (and hence I do not know how it responds to the Ctrl+N user input), I did some tests using notepad.exe
I observed some strange behavior that I thought of sharing with you (and the VisualNEOWin community); of course, this may or may not happen with WinJump2014.exe, but here goes ...
a) as mentioned before, if I press the N key while holding down the Ctrl key ...
- if the data space is empty, nothing happens
- if the data space has some content, it asks me if the current data should be saved first (in other words, it attempts to service the New File request in the same space)b) on the other hand, when I attempt to send {CtrlDn}N{CtrlUp}, it starts a new copy of notepad.exe; this is evidenced by the fact that when I move the mouse pointer over the notepad icon in the task bar, I see 2 copies.
If I send these keys bbbb{CtrlDn}N{CtrlUp}aaaa ... then the first (existing) copy accepts bbbbaaaa while a second copy is empty.
So, the response is different depending on the source of the Ctrl+N key combo.
I do not know if this anomaly arises from the SendKeys command, Windows (I am using version 10) or notepad.exe
And of course I do not know how WinJump2014.exe responds; this was the reason for my earlier enquiry about what WinJump2014.exe does with this key combo ... you might check the task bar after invoking the SendKeys command ... perhaps your program is designed not to start a second copy ?
b) what does F1 do within this program ?
>>Nothing.LOL, I meant F6 (you mentioned that sending the key code for F6 worked as expected).
Unless you can share details of the response of your program to Ctrl+N and F6, I am afraid I have run out of ideas.
Since I don't have WinJump2014.exe (and hence I do not know how it responds to the Ctrl+N user input), I did some tests using notepad.exe
I observed some strange behavior that I thought of sharing with you (and the VisualNEOWin community); of course, this may or may not happen with WinJump2014.exe, but here goes ...
a) as mentioned before, if I press the N key while holding down the Ctrl key ...
- if the data space is empty, nothing happens
- if the data space has some content, it asks me if the current data should be saved first (in other words, it attempts to service the New File request in the same space)
b) on the other hand, when I attempt to send {CtrlDn}N{CtrlUp}, it starts a new copy of notepad.exe; this is evidenced by the fact that when I move the mouse pointer over the notepad icon in the task bar, I see 2 copies.
If I send these keys bbbb{CtrlDn}N{CtrlUp}aaaa ... then the first (existing) copy accepts bbbbaaaa while a second copy is empty.
So, the response is different depending on the source of the Ctrl+N key combo.
I do not know if this anomaly arises from the SendKeys command, Windows (I am using version 10) or notepad.exe
And of course I do not know how WinJump2014.exe responds; this was the reason for my earlier enquiry about what WinJump2014.exe does with this key combo ... you might check the task bar after invoking the SendKeys command ... perhaps your program is designed not to start a second copy ?
b) what does F1 do within this program ?
>>Nothing.
LOL, I meant F6 (you mentioned that sending the key code for F6 worked as expected).
Unless you can share details of the response of your program to Ctrl+N and F6, I am afraid I have run out of ideas.
Quote from Gaev on April 3, 2024, 11:38 pm@jerome-bruet
LATE BREAKING NEWS ... notepad.exe treats Ctrl+n different than Ctrl+N (or Ctrl+Shift+n) ... i.e. open new file in same program vs. in new copy of program.
It is consistent with what happens when you SendKeys {CtrlDn}n{CtrlUp} vs. {CtrlDn}N{CtrlUp} ... so you might try and use the lowercase n.
LATE BREAKING NEWS ... notepad.exe treats Ctrl+n different than Ctrl+N (or Ctrl+Shift+n) ... i.e. open new file in same program vs. in new copy of program.
It is consistent with what happens when you SendKeys {CtrlDn}n{CtrlUp} vs. {CtrlDn}N{CtrlUp} ... so you might try and use the lowercase n.
Quote from JEROME BRUET on April 4, 2024, 1:49 pmYesssss ! It works ! It was due to the capital letter {CtrlDn}n{CtrlUp} vs. {CtrlDn}N{CtrlUp}
Thanks a lot !
Yesssss ! It works ! It was due to the capital letter {CtrlDn}n{CtrlUp} vs. {CtrlDn}N{CtrlUp}
Thanks a lot !