Open new notepad and insert some text without saving it in file
6 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Jan
on 19 May 2017
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.
More Answers (1)
dpb
on 19 May 2017
Edited: dpb
on 20 May 2017
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 Comments
dpb
on 19 May 2017
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.
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!