matlab to notepad

I want to send keys like backspace which perform actions from matlab file to notepad using SendKeys method of windows shell scripting.All other keys are working except - backspace, delete, capslock etc.

 Respuesta aceptada

Jason Ross
Jason Ross el 27 de Abr. de 2011

1 voto

How are you sending them? Can you post some example code?
This link might help with the formatting of the string you send: http://msdn.microsoft.com/en-us/library/8c6yea83%28v=vs.85%29.aspx

4 comentarios

yatin kharbe
yatin kharbe el 27 de Abr. de 2011
i have earlier referred this site But the code does not works for Backspace , Capslock ,Delete , Shift and for character '
Although i am posting you my code
Check it
h = actxserver('WScript.Shell');
h.Run('notepad'); %Invokes notepad.exe
pause(3); %Waits for the application to load.
h.AppActivate('Notepad'); %Brings notepad to focus
h.SendKeys('hello world~'); %Sends keystrokes
In the above code at h.SendKeys() function The code for character ' , backspace ,delete ,Capslock does not seem to work .
Jason Ross
Jason Ross el 27 de Abr. de 2011
I used
h.SendKeys('{CAPSLOCK}hello{TAB}world{BACKSPACE}{BACKSPACE}');
and got the expected results.
Jason Ross
Jason Ross el 27 de Abr. de 2011
And for the ' symbol,
h.SendKeys('''')
yatin kharbe
yatin kharbe el 27 de Abr. de 2011
OK .. THANKS

Iniciar sesión para comentar.

Más respuestas (1)

Aleksander
Aleksander el 11 de Feb. de 2013

0 votos

hi, is it possible to send ctrl + f ? i wish to use the find and replace functionality in notepad.
all best Aleks.

1 comentario

Jason Ross
Jason Ross el 11 de Feb. de 2013
Editada: Jason Ross el 11 de Feb. de 2013
All the keys are here, control-f should work the same way as the above example.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by