我希望能够双击打开一个文件类型(超文本标记语言)在一个特定的应用程序(SeaMonkey composer)。
双击该文件将打开SeaMonkey浏览器,但我希望它在Seamonkey Composer中打开。执行此操作的唯一方法是使用以下命令行
seamonkey -editor "filename.html"那么,如何使用apple script或automator在composer中打开我的html文件呢?
发布于 2017-07-24 04:38:30
在脚本编辑器中将以下脚本另存为应用程序:
on run filesList
repeat with fileRef in filesList
do shell script "seamonkey -editor " & quoted form of POSIX path of fileRef
end repeat
end run选择View > Show Bundle Contents并给它一个自定义的bundle ID。然后,您可以像上面那样更改文件关联。
上面假设seamonkey命令本身只是一个启动器;如果它实际上是完整的应用程序(可能是这种情况,因为它显然不是一个本机Mac应用程序),则需要对中间行进行一些调整:
do shell script "nohup seamonkey -editor " & quoted form of POSIX path of fileRef & " >/dev/null 2>&1"这应该允许shell脚本在seamonkey进程启动时立即退出,让Seamonkey一直运行,直到您从其图形用户界面退出。
发布于 2017-07-23 07:32:59
如果你想使用AppleScript来做这件事,这个简单的脚本应该可以完成这项工作:
set filePath to ((path to documents folder) as text) & "filename.html"
tell application "Seamonkey Composer" to open filePath我没有要测试的Seamonkey Composer应用程序,但它可以与BBEdit一起工作。请注意,open命令必须具有文件的完整路径。
https://stackoverflow.com/questions/45227271
复制相似问题