AppleScript名:ファイル名から拡張子を外して、別の拡張子に付け替える |
— Created 2018-01-29 by Takaaki Naganoya — 2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set origName to "6020 Touch BarとAppleScript.md" set newName to repFileNameExtension(origName, ".pdf") of me –> "6020 Touch BarとAppleScript.pdf" set origName to "6020 Touch BarとAppleScript" set newName to repFileNameExtension(origName, ".pdf") of me –> "6020 Touch BarとAppleScript.pdf" on repFileNameExtension(origName, newExt) set aName to current application’s NSString’s stringWithString:origName set theExtension to aName’s pathExtension() if (theExtension as string) is not equal to "" then set thePathNoExt to aName’s stringByDeletingPathExtension() set newName to (thePathNoExt’s stringByAppendingString:newExt) else set newName to (aName’s stringByAppendingString:newExt) end if return newName as string end repFileNameExtension |
More from my site
(Visited 17 times, 1 visits today)