Open new notepad and insert some text without saving it in file

4 ビュー (過去 30 日間)
Zak Kankin
Zak Kankin 2017 年 5 月 19 日
編集済み: dpb 2017 年 5 月 20 日
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!

採用された回答

Jan
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.
  2 件のコメント
Zak Kankin
Zak Kankin 2017 年 5 月 19 日
For me it is realy usability to work with simple text information in diferent notepad windows. For example I push the button on my gui and get all values from edits like a strings in opened notepad. Than I doing some changes in my gui and again push the button that opened new notepad window and so I can compare results in this two differen windows. Than if I want I can edit one of this window and save it by manual mode. Yes I can print this strings in the command window than move it in the notepad by ctrl-c, ctrl-v, but it not very comfortable. I thought that exist some way to put strings from matlab to notepad without saving and connecting trhought the COM server to notepad. Something like commands for bufer control.
Zak Kankin
Zak Kankin 2017 年 5 月 19 日
"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."
But it genuine idea! Thank you!

サインインしてコメントする。

その他の回答 (1 件)

dpb
dpb 2017 年 5 月 19 日
編集済み: dpb 2017 年 5 月 20 日
No klew how well it works, but... <notepad-plus-plus.org update-activex-plugin>.
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 件のコメント
Zak Kankin
Zak Kankin 2017 年 5 月 19 日
it is realy very dificult way
dpb
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 ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by