topten Posted May 8, 2016 Share Posted May 8, 2016 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 More sharing options...
AutoBert Posted May 8, 2016 Share Posted May 8, 2016 (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 May 8, 2016 by AutoBert Link to comment Share on other sites More sharing options...
topten Posted May 8, 2016 Author Share Posted May 8, 2016 But if I have five "New Document"s in the system... its a little bit like a blind search Link to comment Share on other sites More sharing options...
Bowmore Posted May 8, 2016 Share Posted May 8, 2016 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 More sharing options...
InunoTaishou Posted May 8, 2016 Share Posted May 8, 2016 You could use notepad++ instead. It has the full path to the document opened in the title. Link to comment Share on other sites More sharing options...
mikell Posted May 8, 2016 Share Posted May 8, 2016 You could be interested in this : Link to comment Share on other sites More sharing options...
orbs Posted May 8, 2016 Share Posted May 8, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now