0

I need to save a PDF enter image description herefile which is being opened at Webpage (Integrated Adbobe reader on the webpage). To save the PDF I need to programmatically press Ctrl+Shift+S.

I'm using:

SendKeys.SendWait("+^(s)");

I also tried these combinations. None of them are working:

SendKeys.SendWait("+^(s)");
SendKeys.SendWait("^+s");

However, if I pass (Ctrl+P) for printing:

SendKeys.SendWait("^(p)")

I'm not sure why Ctrl+Shift+S is not working.

If I manually press Ctrl+Shift+S it is working. But in sendkeys it doesn't work.

mx0
  • 6,445
  • 12
  • 49
  • 54
Prabhu
  • 39
  • 1
  • 6

4 Answers4

0

System.Windows.Forms.SendKeys.Send("^+{S}");

More: How to Send Ctrl+Shift+F1 to an application using send keys

Community
  • 1
  • 1
huse.ckr
  • 530
  • 12
  • 39
  • Thanks. I did try this. But the window is not popping up. If I manually press SHIFT + CTRL + S it is popping up – Prabhu Aug 17 '16 at 07:55
  • 1
    Try changing to a lowercase s: `Send("^+{s}")`. I've noticed for example that `Send("^{S}")` will actually send Ctrl + Shift + S, so a similar problem could be happening here. – Bloopy Jul 13 '17 at 09:40
0

Try using the Windows Input Simulator .NET wrapper for the Win32 SendInput API. It gives you more direct control over the use of shift and control keys.

Ton Plooij
  • 2,583
  • 12
  • 15
  • 1
    Do We know why the send keys for SHIFT + CTRL + S is not working? on other hand I could see send keys for CTRL + P is working. – Prabhu Aug 17 '16 at 10:30
  • Thanks! I tried using Input Simulator though no luck. below is the code I have used. Please correct me if Im wrong. //InputSimulator.SimulateKeyPress(VirtualKeyCode.SHIFT); //InputSimulator.SimulateKeyPress(VirtualKeyCode.CONTROL); //InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_S); – Prabhu Aug 17 '16 at 10:54
  • My guess is that it's using GetAsyncKeyState() to read the shift key state, in which sending keys won't work (e.g. read [here](http://stackoverflow.com/questions/11890972/simulating-key-press-with-postmessage-only-works-in-some-applications)). Do other CTRL+X commands work while all SHIFT+CTRL+X commands don't? – Ton Plooij Aug 17 '16 at 11:09
  • I'm not sure. However CTRL + P is working with Simulator... InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_P); On other Hand this is not working – Prabhu Aug 17 '16 at 11:24
  • Try this: InputSimulator.SimulateKeyDown(VirtualKeyCode.SHIFT);InputSimulator.SimulateKeyDown(VirtualKeyCode.CONTROL); then the VK_S, then wait a bit and then the KeyUps for shift and control. – Ton Plooij Aug 17 '16 at 11:31
  • I did try though no Luck. I could see the Shift key is being pressed. I checked using Iskeypressdown check. Not sure why save window is not popping up. – Prabhu Aug 19 '16 at 08:58
0

SendKeys.Send("^+S"); This should work

Manju
  • 34
  • 6
0

The solution that worked for me was to make the window visible and activate it before sending the keys. For whatever reason, that let me send ctrl shift s. Only using activate did not work.

So something like this, where "i" is my window that was looped to find:

shellObj.Windows(i).Visible = True
AppActivate shellObj.Windows(i).LocationName
SendKeys "^+{S}", True
Alan W.
  • 1
  • 1