Jump to content

Find the full path of the opened txt document


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
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.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...