Re: [問題] 在文字編輯中插入現在時間

看板MAC作者 (fortune | cowsay)時間13年前 (2012/12/10 18:11), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串3/5 (看更多)
假設系統語言是繁體中文,用 Spotlight 搜尋開啓 「AppleScript 編寫程式」, 貼上底下 8 行程式碼: set now to current date set {year:y, month:m, day:d} to now set t to time string of now set m to text -2 through -1 of ("0" & m * 1) set d to text -2 through -1 of ("0" & d) set the clipboard to (y & "/" & m & "/" & d as string) & " " & t delay 0.1 tell application "System Events" to keystroke "v" using command down * 按 Cmd + S 儲存,檔名隨意 (ex: 貼上目前時間.scpt) * 儲存至 ~/Library/Scripts/ (註1) * 檔案格式選「工序指令」 Cmd + , 打開 AppleScript 編寫程式偏好設定, 在一般底下勾選「在選單列中顯示工序指令選單」, 在畫面上方的 Menu bar 會多一個 script 圖示,裡面有剛才儲存的 script 檔案。 在一般編輯器中點選,可以插入目前時間如 2012/12/08 16:25:37 (註2) 希望有所幫助。 註1: 可先將 script 儲存在桌面,之後在 Finder 「前往」選單底下, 按 option 鍵出現資源庫的選項,打開找到 Scripts 資料夾,把 script 檔丟進去即可。 註2: 秒數可用 text 1 through -4 去掉,不過牽涉到 12/24 小時的顯示設定, 有 AM/PM 的話可能要用 set t to text 1 through -7 of time string of now ※ 引述《kratistos (卡地拖)》之銘言: : 想請教板友們, : 我想要在文字編輯器(像文字編輯,Mou,nvALT)做筆記和日記, : 想要在文字旁邊插入當下的日期和時間(如 2012/12/08 16:25), : 請問有沒有什麼方法,像是用 Applescript 或是什麼程式, : 可以讓我用快速鍵截取現在時間並自動貼上? : 謝謝大家。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.45.161.47

12/11 13:28, , 1F
非常感謝!
12/11 13:28, 1F
文章代碼(AID): #1GnRLV2h (MAC)
討論串 (同標題文章)
文章代碼(AID): #1GnRLV2h (MAC)