AppleScript名:自然言語で指定した日時以降に作成されたファイルをSpotlight検索 |
— Created 2017-09-21 by Takaaki Naganoya — Modified 2017-09-22 by Shane Stanley — 2017 Piyomaru Software use AppleScript version "2.5" use scripting additions use framework "Foundation" use mdLib : script "Metadata Lib" version "2.0.0" property NSString : a reference to current application’s NSString property NSDataDetector : a reference to current application’s NSDataDetector property NSTextCheckingTypeDate : a reference to current application’s NSTextCheckingTypeDate set aDate to getDatesIn("先週の月曜日") of me –"last Monday" in Japanese log aDate set thePath to POSIX path of (path to desktop) set theFiles to mdLib’s searchFolders:{thePath} searchString:("kMDItemFSCreationDate >= %@") searchArgs:{aDate} –> returns POSIX path list on getDatesIn(aString) set anNSString to NSString’s stringWithString:aString set theDetector to NSDataDetector’s dataDetectorWithTypes:(NSTextCheckingTypeDate) |error|:(missing value) set theMatch to theDetector’s firstMatchInString:anNSString options:0 range:{0, anNSString’s |length|()} if theMatch = missing value then error "No date found with String:" & aString set theDate to theMatch’s |date|() return theDate as date end getDatesIn |
More from my site
(Visited 48 times, 1 visits today)