• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版2f849b775333617fb71af921a4393893091354fd (tree)
时间2014-06-13 17:26:13
作者edktsnr <edktsnr@yaho...>
Commiteredktsnr

Log Message

3rd

更改概述

差异

--- a/cycle_save.applescript
+++ b/cycle_save.applescript
@@ -1 +1,91 @@
1-(* 2012-08-27 v1.0 2012-09-06 v1.1 ドキュメント修正時のみ保存 *) property waitTime : 15 --分単位 on idle {} my main() return waitTime * 60 end idle on main() tell application "Adobe Illustrator" if (count of document) is not 0 then set flg_doc to 0 tell current document set doc_name to name try set doc_path to file path as Unicode text set flg_doc to 1 on error display dialog "一度も保存されていないようです" buttons " OK " default button 1 giving up after 3 return end try end tell if modified of current document is true then my doc_save(doc_path) if flg_doc is 1 then try --display dialog "doc_copy" my doc_copy(doc_path, doc_name) on error --display dialog "make new folder" tell application "Finder" to make new folder at (my Delimiters(doc_path, doc_name, "") as alias) with properties {name:"_version"} my doc_copy(doc_path, doc_name) end try end if end if end if end tell end main on doc_save(doc_path) tell application "Adobe Illustrator" save current document in file doc_path as Illustrator with options {class:Illustrator save options, PDF compatible:false} --PDF互換にするにはPDF compatible:falseをtrueにする end tell end doc_save on doc_copy(doc_path, doc_name) set p_doc_path to POSIX path of doc_path set new_doc_path to my Delimiters(p_doc_path, doc_name, "") & "_version/" & my Delimiters(doc_name, ".ai", "") & "_" & my DateToString() & ".ai" set shellcmd to "cp -p " & quoted form of p_doc_path & " " & quoted form of new_doc_path --display dialog shellcmd do shell script shellcmd end doc_copy on Delimiters(theText, serchStr, replaceStr) set OriginalDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to serchStr set theText to text items of theText set AppleScript's text item delimiters to replaceStr set theText to theText as string set AppleScript's text item delimiters to OriginalDelimiters return theText end Delimiters on DateToString() set M to do shell script "date +%m" set D to do shell script "date +%d" set h to do shell script "date +%H" set mm to do shell script "date +%M" set ss to do shell script "date +%S" set todayStr to M & D & "_" & h & mm return (todayStr) end DateToString
\ No newline at end of file
1+(*
2+ 2012-08-27 v1.0
3+ 2012-09-06 v1.1 ドキュメント修正時のみ保存
4+*)
5+
6+property waitTime : 15 --分単位
7+
8+on idle {}
9+ my main()
10+ return waitTime * 60
11+end idle
12+
13+
14+on main()
15+ tell application "Adobe Illustrator"
16+ if (count of document) is not 0 then
17+ set flg_doc to 0
18+ tell current document
19+ set doc_name to name
20+ try
21+ set doc_path to file path as Unicode text
22+ set flg_doc to 1
23+ on error
24+ display dialog "一度も保存されていないようです" buttons " OK " default button 1 giving up after 3
25+ return
26+ end try
27+ end tell
28+
29+ if modified of current document is true then
30+
31+ my doc_save(doc_path)
32+
33+ if flg_doc is 1 then
34+ try
35+ --display dialog "doc_copy"
36+ my doc_copy(doc_path, doc_name)
37+ on error
38+ --display dialog "make new folder"
39+ tell application "Finder" to make new folder at (my Delimiters(doc_path, doc_name, "") as alias) with properties {name:"_version"}
40+ my doc_copy(doc_path, doc_name)
41+ end try
42+ end if
43+
44+ end if
45+
46+ end if
47+ end tell
48+end main
49+
50+
51+on doc_save(doc_path)
52+ tell application "Adobe Illustrator"
53+ save current document in file doc_path as Illustrator with options {class:Illustrator save options, PDF compatible:false}
54+ --PDF互換にするにはPDF compatible:falseをtrueにする
55+ end tell
56+end doc_save
57+
58+on doc_copy(doc_path, doc_name)
59+ set p_doc_path to POSIX path of doc_path
60+ set new_doc_path to my Delimiters(p_doc_path, doc_name, "") & "_version/" & my Delimiters(doc_name, ".ai", "") & "_" & my DateToString() & ".ai"
61+
62+ set shellcmd to "cp -p " & quoted form of p_doc_path & " " & quoted form of new_doc_path
63+ --display dialog shellcmd
64+ do shell script shellcmd
65+end doc_copy
66+
67+on Delimiters(theText, serchStr, replaceStr)
68+ set OriginalDelimiters to AppleScript's text item delimiters
69+ set AppleScript's text item delimiters to serchStr
70+ set theText to text items of theText
71+ set AppleScript's text item delimiters to replaceStr
72+ set theText to theText as string
73+ set AppleScript's text item delimiters to OriginalDelimiters
74+ return theText
75+end Delimiters
76+
77+
78+on DateToString()
79+ set todayStr to do shell script "date '+%m%d_%k%M'"
80+ (*
81+ set M to do shell script "date +%m"
82+ set D to do shell script "date +%d"
83+ set h to do shell script "date +%H"
84+ set mm to do shell script "date +%M"
85+ set ss to do shell script "date +%S"
86+ set todayStr to M & D & "_" & h & mm
87+ *)
88+ return (todayStr)
89+end DateToString
90+
91+