MACOS: 如何在应用程序中应用文件超链接,直接打开文件

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/clayluo/article/details/55803074

找了很久没有很好答案:

官方给出的答案是基于共享网络协议,如smb://, afp://, 但mac 新系统已经严格控制共享文件权限,这些都不好用。


今天终于查到一个,就是用:file:///, 将路径贴在可以生成超链接的各种应用程序中,直接可以打开文件!


参考:

http://hints.macworld.com/article.php?story=20090313071515523

One way to share links to networked files
Authored by: blumenberg on Mar 23, '09 12:38:28PM

Mmh, mixed results -- I did the following things:

A) to get the filepath like:
"/Volumes/VOLUMENAME/FOLDERNAME/FILENAME"

  1. AppleScript from "ctierney": works besides "Umlaute" are garbled
  2. AppleScript from "Spartacus": no need for a list of files
  3. drag'n'drop file to a TextMate document: works besides "Umlaute" are garbled
  4. drag'n'drop file to a Terminal window: works besides spaces get escaped
  5. Contextual Menu like "haralds" (FilePathToClipCMPlugin.plugin) or FileUtilsCM.plugin w/ "copy file path": works perfect
  6. drag'n'drop file to Spotlight window ("thegooch49" tip): works perfect
and 

copy the previous copied filepath to a highlighted word via "Menu > Format > Link…" in TextEdit or Mail and add in front of the filepath "file://" -- this "linked" text is draggable to the finder and becomes a ".fileloc" file

B) or better:
"file:///Volumes/VOLUMENAME/FOLDERNAME/FILENAME"

  1. drag'n'drop file (rtf) to Firefox window : Firefox ask for download
  2. drag'n'drop folder to Firefox window : Firefox shows list/index of folder -- files and folders are links

C) or best:
"afp://BONJOURSERVERNAME.local/Volumes/VOLUMENAME/FOLDERNAME/FILENAME"

  • no readymade solution - besides:

D) combine the spotlight or the Contextual Menu tip w/ TextExpander like: prepare a snippet like "file://" (I used "flx") -- or for the additional function to mount an unmounted volume: "afp://BONJOURSERVERNAME.local" -- and put it together in Mail ("Add Link…") or TextEdit (see A))

Thinking: I'm sure there is someone who can build an AppleScript -- maybe with a dialogue -- to make this even easier


展开阅读全文

没有更多推荐了,返回首页