on adding folder items to myFolder after receiving myFiles버그 :
repeat with myFile in myFilesend adding folder items to
set myPath to (POSIX path of myFile)end repeat
set myType to do shell script "file --mime -br " & (quoted form of myPath)
if myType is "image/jpeg" and myPath does not end with ".jpg" and myPath does not end with ".jpeg" then
set newExtension to ".jpg"else if myType is "image/gif" and myPath does not end with ".gif" then
set newExtension to ".gif"else if myType is "image/png" and myPath does not end with ".png" then
set newExtension to ".png"else
set newExtension to nullend if
tell application "Finder"
if newExtension is not null thenend tell
set name of myFile to (name of myFile) & newExtensionend if
여기에는 버그가 있는데
set myType to mySubstringBetweenFirstDelimiters(myTypeString, "image/", ";")
와 같은 함수를 사용해서 image/jpeg;
와 같은 부분만 추출해야 할 필요가 있다.
레퍼런스 :
http://henrik.nyh.se/2008/11/extension-action -> 설명
http://gist.github.com/27558 -> 소스코드
No comments:
Post a Comment