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.

 채택된 답변

Jason Ross
Jason Ross 2011년 4월 27일

1 개 추천

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

yatin kharbe
yatin kharbe 2011년 4월 27일
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 2011년 4월 27일
I used
h.SendKeys('{CAPSLOCK}hello{TAB}world{BACKSPACE}{BACKSPACE}');
and got the expected results.
Jason Ross
Jason Ross 2011년 4월 27일
And for the ' symbol,
h.SendKeys('''')
yatin kharbe
yatin kharbe 2011년 4월 27일
OK .. THANKS

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Aleksander
Aleksander 2013년 2월 11일

0 개 추천

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

댓글 수: 1

Jason Ross
Jason Ross 2013년 2월 11일
편집: Jason Ross 2013년 2월 11일
All the keys are here, control-f should work the same way as the above example.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by