topten

Find the full path of the opened txt document

7 posts in this topic

I have a txt document C:/sometext.txt, which I open with a notepad exe. Is it possible to find the full path to the document which is opened by the notepad? NOT the path to the process (notepad.exe), but the path to the opened document itself  (.doc, .pdf etc)

 

Great thanx in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I don't think so, but you can get the name of document (is part of the wintitle) and search with _FileListToArrayRec for all files with that name.

Edit: with trying save as you can also read the path.

Edited by AutoBert

Share this post


Link to post
Share on other sites

But if I have five "New Document"s in the system... its a little bit like a blind search

Share this post


Link to post
Share on other sites

One way that will work is to open the file save as dialog, you can then read the path of the last file opend/saved from the path combobox and the name of the file from the filename combo box. Put the 2 together and you have the full file path. Finally cancel the File SaveAs dialog,

I

 


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

You could use notepad++ instead. It has the full path to the document opened in the title.

Share this post


Link to post
Share on other sites

You could be interested in this :

 

 

Share this post


Link to post
Share on other sites

Topten, what you ask is not easily possible. Files opened by a process - no good, as notepad does not keep them open. MRU lists pose the same issue as of files of same name in different paths. Automating the "save as" dialog is not aesthetic. Now, why not share your real purpose? Automating notepad can't be it. Perhaps we can help better with your real purpose.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now