Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Full path to file that is open in notepad or wordpad?


  • Please log in to reply
12 replies to this topic
fredinga
  • Members
  • 32 posts
  • Last active: Dec 07 2011 05:08 PM
  • Joined: 26 Jul 2009
I have searched high and low for an example that provides the full path of a file open in notepad or wordpad.

Right now I am using brute force to get it. I send ^o to bring up the File>Open Window and read the path from there with ControlGetText. Then I close the File>Open Window. But that is really ugly!

There must be a simpler way.

Thanks in advance...

fredinga

x79animal
  • Members
  • 1021 posts
  • Last active: May 14 2013 04:21 PM
  • Joined: 01 May 2010
i dont think its possible to retrieve that information

Rapte_Of_Suzaku
  • Members
  • 901 posts
  • Last active: Jul 08 2011 02:12 PM
  • Joined: 29 Feb 2008
Interesting question... I poked around for a bit but couldn't find any way either...

What do you need that info for? There might be another way.

Also, other programs (like Notepad++) display the full path of the current file in the titlebar. Switch to one of those and it would be trivial to get the path.

fredinga
  • Members
  • 32 posts
  • Last active: Dec 07 2011 05:08 PM
  • Joined: 26 Jul 2009
I need to get to a sub-folder (holding image files) within the main folder where the open file is. My editing needs are pretty basic and not everyone who might use this script will have quick access to editors beyond notepad and wordpad.

This for the script at http://www.autohotke...pic.php?t=64296

Notepad and wordpad have to have the full path somewhere inside since File>Open displays it, but the question is how to get to it.

Thanks for the ideas...

Fred

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
Try:

WinGetTitle, File, ahk_class NotePad

It may have " - NotePad" at the end, so if it does, just trim it off using StringTrimRight:

StringTrimRight, File, File, 10


MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009

Try:

WinGetTitle, File, ahk_class NotePad

Unlike Notepad++, standard Notepad shows only the filename in the title, not the whole path.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


x79animal
  • Members
  • 1021 posts
  • Last active: May 14 2013 04:21 PM
  • Joined: 01 May 2010
if u go task manager , view -> select columns, check 'image path name'

it says the location of any .exe that is running =] still a pain in the ass to read from

Rapte_Of_Suzaku
  • Members
  • 901 posts
  • Last active: Jul 08 2011 02:12 PM
  • Joined: 29 Feb 2008

Notepad and wordpad have to have the full path somewhere inside since File>Open displays it, but the question is how to get to it.

It wasn't anywhere obvious. I used Process Explorer and didn't see anything anywhere. I'll try a memory viewer tomorrow, just for fun!

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
I tried Cheat Engine and had no sucess. This kind of information is stored inside the registry (some "OpenSaveMRU" stuff), but I didn't find a relevant/reliable specific key for that.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


Rapte_Of_Suzaku
  • Members
  • 901 posts
  • Last active: Jul 08 2011 02:12 PM
  • Joined: 29 Feb 2008
Also using Cheat Engine, I saw the path in there for notepad at least.

fredinga
  • Members
  • 32 posts
  • Last active: Dec 07 2011 05:08 PM
  • Joined: 26 Jul 2009
Thanks for everyone's help and comments. for now I am using this subroutine.

getTitle: ;+++++++++++++++++++++++++++++++
WinGetTitle, myFile, ahk_PID %myPID%
StringTrimRight, myFile, myFile, 10
StringTrimRight, myTitle, myFile, 4
WinMenuSelectItem, ahk_PID %myPID%, , File, Open
WinWaitActive, Open
ControlGetText, myPath , ToolbarWindow322, Open
myPath := substr(myPath, 10)
WinClose, Open
return ;------------------------------


dotslashc
  • Members
  • 9 posts
  • Last active: Nov 04 2010 10:51 AM
  • Joined: 28 Oct 2010
Maybe you can fiddle around with OpenFiles command. I can't check it now since I am at work right now.

Stef
  • Members
  • 1 posts
  • Last active: Apr 29 2014 02:38 PM
  • Joined: 29 Apr 2014

How I always find the filepath in any program including notepad and wordpad: go to file --> SaveAs, and this will show you where the file is NOW. No need to save it as anything else, or at all. Just Cancel, but now you know where you are and can go there, for instance to back the file up (right-click and Send to), etc.