2
$\begingroup$

This question was posted 2 days ago at community. I had a good answer but it does not quit do what I wanted. Hence I am trying here to see if someone might know of some other solution. Here is the question:

I tend to name some files, which are in different folders, with the same name. Say source.nb

But when going back to open a specific file from one folder, using File->Open dialog, it does not show the full path of the file. Even a right-click on the file name, or hovering the mouse over the name, has no pop-up menu to show the full path name. This makes it hard to know in which folder any of these files are in. So I end up opening the wrong file many times. Here is a screen shot:

Mathematica graphics

I looked at options and did not see a way to change this. It might be there and I have overlooked it. I searched for "file" options. Using V 9.01 on windows.

Would any one know of a way to make it either display the full path name, or at least when hovering the mouse over the name, it will display the full path name in a small pop-up help display (which is the common way most applications handle this sort of thing).

$\endgroup$

1 Answer 1

4
$\begingroup$

This works on my system (v7, Windows 7):

Cases[
  NotebooksMenu /. Options[$FrontEnd],
  FrontEnd`FileName[{_, path__}, name_, ___] :> FileNameJoin @ {path, name},
  {3}
]

The first _ in {_, path__} is to skip $RootDirectory; if you want to preserve $RootDirectory leave it out.

To create a palette with buttons to open these Notebooks you may use:

Cases[
  NotebooksMenu /. Options[$FrontEnd],
  FrontEnd`FileName[{_, path__}, name_, ___] :> FileNameJoin@{path, name},
  {3}
] // CreatePalette @ Column[Button[#, NotebookOpen@#] & /@ #] &;
$\endgroup$
5
  • $\begingroup$ Thanks. But how do I use the output of the above? THe above just gives me a list of the file names with fullpath/ But what is next? I need to open a notebook. I am not familar with notebook commands. I just use the File->Open to open files. $\endgroup$
    – Nasser
    Jan 4, 2014 at 2:35
  • $\begingroup$ @Nasser Sorry, I didn't realize that was part of the question. Basically you can use NotebookOpen but I guess you want something more automated like a palette? $\endgroup$
    – Mr.Wizard
    Jan 4, 2014 at 2:38
  • $\begingroup$ I see. So you mean I'd copy the file name from the Cases output, and paste into a NotebokOpen command? Ok. Will try that. Sure, a palette based method would be great and much easier to use, if possible. It would be useful for many others I assume. I hope this feature is added to V 10. But no problem if it is too much trouble. I'll try the copy/paste method for now. thanks. $\endgroup$
    – Nasser
    Jan 4, 2014 at 2:40
  • $\begingroup$ @Nasser I added a palette generating function. Please try it and let me know if this is what you need. $\endgroup$
    – Mr.Wizard
    Jan 4, 2014 at 2:54
  • $\begingroup$ Nice. I tried it. Yes, much easier that way. Will use this from now on. I have many files with same name that I open all the time, and this helps allot. thanks. $\endgroup$
    – Nasser
    Jan 4, 2014 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.