我所追求的功能是 Sublime Text 在瀏覽器中打開當前編輯檔案的列印預覽。
這是以下內容:
- 有一個 txt 檔案(崇高)。
- 選擇檔案 > 列印

- 觀察默認瀏覽器打開到列印預覽頁面(在firefox和safari中測驗)

url 似乎指向臨時目錄中的檔案并生成為 html 檔案。
file:///private/var/folders/05/q2p__63n3zx9k3yzcb8f9n0c0000gn/T/tmpbfkdzvmq.html
注意我的用例不需要生成 html,保留為 txt 就可以了。
答案可以是 swift 或 Objective-c。我正在研究如何打開瀏覽器進行列印預覽。
uj5u.com熱心網友回復:
我相信答案涉及使用@Willeke 提到的Apple Events。這些是我發現的對我有幫助的資訊:
- https://applescriptlibrary.files.wordpress.com/2013/11/apple-events-programming-guide.pdf
- http://webcache.googleusercontent.com/search?q=cache:B5zOBQgWUoMJ:mirror.informatimago.com/next/developer.apple.com/technotes/tn2002/tn2082.html &cd=1&hl=en&ct=clnk&gl=ae
- https://discussions.apple.com/thread/7743420
在偽 AppleScript 代碼中,它會是這樣的:
tell default browser
launch
print document
endtell
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/461573.html
上一篇:在Mac上從另一個行程讀取記憶體
