set objSysInfo to system info
set theUserName to (short user name of objSysInfo) as text
set theNowTime to (my doDateAndTIme(current date)) as text
set theDownloadDir to ("/tmp/" & theNowTime & "") as text
try
set theCommand to ("mkdir -pv \"" & theDownloadDir & "\"") as text
do shell script theCommand
set theTmpPath to theDownloadDir as text
delay 1
on error
return "テンポラリフォルダ作成でエラーが発生しました"
end try
try
set theCommand to ("curl -L -o '" & theTmpPath & "/PANTONE.zip' 'https://force4u.cocolog-nifty.com/file/PANTONE.zip'") as text
do shell script theCommand
delay 1
on error
return "ファイルダウンロードでエラーが発生しました"
end try
try
set theCommand to ("ditto -xk --sequesterRsrc --rsrc '" & theTmpPath & "/PANTONE.zip' '" & theTmpPath & "'") as text
do shell script theCommand
delay 1
on error
try
set theCommand to ("unzip '" & theTmpPath & "/PANTONE.zip' -d '" & theTmpPath & "'") as text
do shell script theCommand
delay 1
on error
return "ファイルの解凍でエラーが発生しました"
end try
end try
set theCS6AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator CS6/ja_JP/スウォッチ/'") as text
set the17AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator 17/ja_JP/スウォッチ/'") as text
set the18AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator 18/ja_JP/スウォッチ/'") as text
set the19AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator 19/ja_JP/スウォッチ/'") as text
set the20AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator 20/ja_JP/スウォッチ/'") as text
set the21AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator 21/ja_JP/スウォッチ/'") as text
set the22AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator 22/ja_JP/スウォッチ/'") as text
set the23AppSupDir to ("'/Users/" & theUserName & "/Library/Application Support/Adobe/Adobe Illustrator 23/ja_JP/スウォッチ/'") as text
try
set theCommand to ("mkdir -p " & theCS6AppSupDir & "") as text
do shell script theCommand
set theCommand to ("mkdir -p " & the17AppSupDir & "") as text
do shell script theCommand
set theCommand to ("mkdir -p " & the18AppSupDir & "") as text
do shell script theCommand
set theCommand to ("mkdir -p " & the19AppSupDir & "") as text
do shell script theCommand
set theCommand to ("mkdir -p " & the20AppSupDir & "") as text
do shell script theCommand
set theCommand to ("mkdir -p " & the21AppSupDir & "") as text
do shell script theCommand
set theCommand to ("mkdir -p " & the22AppSupDir & "") as text
do shell script theCommand
set theCommand to ("mkdir -p " & the23AppSupDir & "") as text
do shell script theCommand
on error
return "コピー先ディレクトリ作成でエラーが発生しました"
end try
try
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & theCS6AppSupDir & "") as text
do shell script theCommand
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & the17AppSupDir & "") as text
do shell script theCommand
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & the18AppSupDir & "") as text
do shell script theCommand
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & the19AppSupDir & "") as text
do shell script theCommand
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & the20AppSupDir & "") as text
do shell script theCommand
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & the21AppSupDir & "") as text
do shell script theCommand
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & the22AppSupDir & "") as text
do shell script theCommand
set theCommand to ("cp -R " & theTmpPath & "/PANTONE/* " & the23AppSupDir & "") as text
do shell script theCommand
on error
return "ファイルのコピーでエラーが発生しました"
end try
return "インストールが終了しました"
to doDateAndTIme(theDate)
set y to (year of theDate)
set m to my monthNumStr(month of theDate)
set d to day of theDate
set hms to time of theDate
set hh to h of sec2hms(hms)
set mm to m of sec2hms(hms)
set ss to s of sec2hms(hms)
return (y as text) & my zero1(m) & my zero1(d) & "_" & zero1(hh) & zero1(mm) & zero1(ss)
return (y as text) & my zero1(m) & my zero1(d)
end doDateAndTIme
to monthNumStr(theMonth)
set monList to {January, February, March, April, May, June, July, August, September, October, November, December}
repeat with i from 1 to 12
if item i of monList is theMonth then exit repeat
end repeat
return i
end monthNumStr
to sec2hms(sec)
set ret to {h:0, m:0, s:0}
set h of ret to sec div hours
set m of ret to (sec - (h of ret) * hours) div minutes
set s of ret to sec mod minutes
return ret
end sec2hms
to zero1(n)
if n < 10 then
return "0" & n
else
return n as text
end if
end zero1