Open new notepad and insert some text without saving it in file
4 ビュー (過去 30 日間)
古いコメントを表示
I know that I can launch notepad from command:
!notepad
and I know that possible to open some existent text file by next way:
!notepad PathFile.extencion
But I want just to open notepad and automaticaly put in this window some text. And do it operation every time when push the button in my gui. Then operate with some number of opened unnamed notepad windows, copying and replacing text from one window to another, and then close it without saving. Please help me find the solve if it possible! Thanx!
0 件のコメント
採用された回答
Jan
2017 年 5 月 19 日
You want to remote control Notepad from Matlab, move some strings from one instance to the other and finally close the instances without saving? Why???
This is a really complicated project. Matlab is not designed to control other programs remotely and I cannot imagine that this method is useful at all. It will have a horrible usability.
Notepad has very limited power. Why don't you open the strings in Matlab figures containing an uicontrol('edit')? This allows copy&paste also, but no remote controlled magic.
その他の回答 (1 件)
dpb
2017 年 5 月 19 日
編集済み: dpb
2017 年 5 月 20 日
You're on your own as to how to use it, but would have to open an ActiveX server object in Matlab to attach to the API plugin to communicate with Notepad++; it doesn't have its own a la Excel, etc.
An alternative that could do either via ActiveX or .NET would be to use Word instead--overkill in functionality, probably, but assuming Office is installed it does have the interface packaged with it.
There's even a rudimentary example to get you started <work-with-microsoft-word-documents-using-net> that way.
ADDENDUM
Or, of course, the ActiveX server route works...
>> wd=actxserver('Word.Application')
wd =
COM.Word_Application
>>
OTOH,
>> np=actxserver('Notepad.Application')
Error using actxserver (line 90)
Server creation failed. Invalid ProgID 'Notepad.Application'.
>>
One can find the .Application keyword in the Excel/Word executable; did a search in notepad.exe for anything looking remotely like such with no dice; that and lack of any reference to same on MSDN or any other search leads to conclusion doesn't exist for Notepad...
3 件のコメント
dpb
2017 年 5 月 19 日
Well, it's a nontrivial thing, interprocess communication, it is... :)
I never use Notepad; presumed that the "++" was a modern OS release but I see it's apparently an open source project. Either, way, same issue holds; unable to determine from MSDN search about what sort of engine Notepad itself may support if any, which makes one suspect it doesn't.
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!