ActiveX "sendkeys" not passing CTRL+1 to target program

1 vue (au cours des 30 derniers jours)
Sean Devlin
Sean Devlin le 26 Nov 2018
Commenté : Walter Roberson le 26 Nov 2018
Hi,
I'm trying to send CTRL+1 to an activeX window. I've followed all the instructions and understand the use of {} and (), but the following (or any parenthesized varient) won't send the command I'm looking to send. I can resolve a similar problem with case-sensitivity of alphabetical characters (must use upper case), but numeric digit is not passed correctly. Any advice?
h = actxserver('WScript.Shell');
h.Run('.\myProgram');
pause(3); % Waits for the application to load.
h.AppActivate('myProgram'); % Brings myProgram to focus
h.SendKeys('^1')
  1 commentaire
Walter Roberson
Walter Roberson le 26 Nov 2018
Can you h.SendKeys(char('1'-32)) ?
The offset of 32 is valid for the digits to find the corresponding control key. The more general expression would be char(bitand(uint8(TheCharacter),31))

Connectez-vous pour commenter.

Réponses (0)

Tags

Produits


Version

R2015b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by