9
$\begingroup$

On OSX at least, it's possible to quickly retrieve a folder/file path by dragging & dropping the folder/file into the terminal, eg:

enter image description here

Is it possible to program Mathematica's front end enable similar drag & drop operation? I'm primarily interested in passing path info to Import and Export.

$\endgroup$
4
  • $\begingroup$ What kind of content do you want to drag and drop? It works for Images. I am not exactly sure what action Mathematica should take when you drag and drop an arbitrary file. Do you just want the file's name to appear as a string? $\endgroup$
    – Searke
    Commented Jul 16, 2012 at 20:49
  • $\begingroup$ That's an interesting question. On Windows 7 that drag yields a list of file names within the folder. Is that what you get also? $\endgroup$
    – Mr.Wizard
    Commented Jul 16, 2012 at 20:50
  • $\begingroup$ The file's path. Editing post to refer to Import/Export $\endgroup$ Commented Jul 16, 2012 at 20:52
  • $\begingroup$ Also you get strings for files that are text files. A text file containing {1,2,3,4} yields "{1,2,3,4}". Some drag and drop functionality is already implemented. It would be probably wise to avoid actually overloading it. $\endgroup$
    – Searke
    Commented Jul 16, 2012 at 20:52

1 Answer 1

9
$\begingroup$

On Mac OS 10.7 just holding down the Option key while you drag works.

$\endgroup$
3
  • $\begingroup$ Excellent, that works. Is that documented? $\endgroup$ Commented Jul 16, 2012 at 20:54
  • 1
    $\begingroup$ Yes check out 'howto/InsertAFilePath' $\endgroup$
    – M.R.
    Commented Jul 16, 2012 at 20:54
  • 1
    $\begingroup$ On Windows one should hold down the Ctrl+Shift keys when releasing the mouse button. The cursor will change to indicate that a path will be inserted when you release the mouse button. reference.wolfram.com/mathematica/howto/InsertAFilePath.html $\endgroup$ Commented Jul 17, 2012 at 5:47

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.