在文字編輯中插入現在時間 - MAC

Necoo avatar
By Necoo
at 2012-12-10T21:21

Table of Contents

※ 引述《bennyaous (fortune | cowsay)》之銘言:
: 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

: 註2:
: 秒數可用 text 1 through -4 去掉,不過牽涉到 12/24 小時的顯示設定,
: 有 AM/PM 的話可能要用 set t to text 1 through -7 of time string of now

要做高級格式客制的話用 shell 的 date 比較快

set datetime to do shell script "date +" & quoted form of "%Y-%m-%d %H:%M"
set the clipboard to datetime
delay 0.1
tell application "System Events" to keystroke "v" using command down

這個會出現 2012-12-10 21:20 (我打文章的時間)

http://www.cyberciti.biz/faq/linux-unix-formatting-dates-for-display/
這裡面有完整的可用格式符
幾乎要什麼格式都行了


--
作者 Linux (Windows) 看板 C_and_CPP
標題 [問題] 如何確認是否 free 對記憶體
時間 Fri Nov 2 00:14:03 2012
akasan:valgrind, 但 windowns 版的沒試過XD 11/02 00:43
akasan:linux 上那真的是不二選擇了 11/02 00:44
Linux:我是用 Windows ....>"< 11/02 00:45

--
Tags: MAC

All Comments

Ingrid avatar
By Ingrid
at 2012-12-11T06:27
valgrind, 但 windowns 版的沒試過XD
Sarah avatar
By Sarah
at 2012-12-15T18:30
linux 上那真的是不二選擇了
Hardy avatar
By Hardy
at 2012-12-17T23:06
我是用 Windows ....>"<
Damian avatar
By Damian
at 2012-12-20T01:21
非常感謝!

Bootcamp 能支援3個OS嗎?

Quanna avatar
By Quanna
at 2012-12-10T19:06
請問一下, 我的MacbookPro已經裝了兩個OSX(10.8 andamp; 10.7), 在這種情況下,我還能夠使用bootcamp去切一個Windows7 OS嗎? 目前要用bootcamp去切partition都失敗... 是不是一定只能裝兩個OS? 例如: 1. 10.8 + 10.7 ...

台北車站附近的蘋果專賣店,iMac是最新的嗎?

Selena avatar
By Selena
at 2012-12-10T18:49
網路上看到一篇最新款iMac、Mac mini的諸多正負面評論 想要去現場看一下實際情形 請問台北車站附近的蘋果專賣店 展出的是最新款沒錯吧? 我沒用過,所以不是那麼清楚 謝謝 - ...

怎麼打萬用字元搜尋檔案

Selena avatar
By Selena
at 2012-12-10T18:36
我想在Finder打Windows的萬用字元* 去搜尋 可是卻找不到 請問怎麼在Finder搜尋 謝謝回答 --            ╭──────╮ 鄭先生正名運動 │ ◢██◣ │ 請大家叫他鄭先生   四○一手護症危 │ █ ◥▌ ...

2012 mac mini外接設備常無故退出

Isla avatar
By Isla
at 2012-12-10T18:19
我新買的mac mini , 有幾個外接設備。 主要是我有一個四合一硬碟盒,usb 3.0的,而我的time machine硬碟也接在裡面 另還有掃瞄機、印表機 但每次使用電腦到一半,外接設備會無故退出,常導致time machine 失敗 請問這也是這一款的bug麼? - ...

在文字編輯中插入現在時間

Rebecca avatar
By Rebecca
at 2012-12-10T18:11
假設系統語言是繁體中文,用 Spotlight 搜尋開啓 「AppleScript 編寫程式」, 貼上底下 8 行程式碼: set now to current date set {year:y, month:m, day:d} to now set t to time string of now s ...