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

编程知识 更新时间:2023-04-07 16:44:01

找了很久没有很好答案:

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


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


参考:

http://hints.macworld/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


更多推荐

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

本文发布于:2023-04-07 16:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/a8ce48bcaaba27969755c0055553e6bf.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   应用程序   超链接   如何在   MACOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 54033文章数
  • 14阅读数
  • 0评论数