AppleScript名:Safariのダウンロードフォルダを求める v5 |
— Created 2015-03-06 by Takaaki Naganoya — Created 2018-04-09 by Takaaki Naganoya — 2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set dlRes to getSafariDownloadFolder() of me –> "/Users/maro/Downloads" on getSafariDownloadFolder() set theID to id of application "Safari" –> "com.apple.Safari" set dlRes2 to getAppDefaultsValue(theID, "DownloadsPath") return dlRes2 end getSafariDownloadFolder on getAppDefaultsValue(appBundleID, appKey) set storedDefaults to (current application’s NSUserDefaults’s standardUserDefaults()’s persistentDomainForName:appBundleID) set keyList to storedDefaults’s allKeys() as list if appKey is not in keyList then return missing value set dlRes to (storedDefaults’s valueForKeyPath:appKey) set dlRes2 to (dlRes’s stringByExpandingTildeInPath()) as list of string or string return dlRes2 end getAppDefaultsValue |
More from my site
(Visited 60 times, 1 visits today)