001 | #! /usr/bin/env osascript |
---|
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
---|
003 | # |
---|
004 | #com.cocolog-nifty.quicktimer.icefloe |
---|
005 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
---|
006 | use AppleScript version "2.8" |
---|
007 | use framework "Foundation" |
---|
008 | use framework "AppKit" |
---|
009 | use scripting additions |
---|
010 | property refMe : a reference to current application |
---|
011 | property refNotFound : a reference to 9.22337203685477E+18 + 5807 |
---|
012 | |
---|
013 | |
---|
014 | |
---|
015 | ########################################## |
---|
016 | # |
---|
017 | set listBundleID to {"com.adobe.Acrobat.Pro", "com.adobe.Reader"} as list |
---|
018 | |
---|
019 | ########################################## |
---|
020 | #アプリケーションを終了させる |
---|
021 | log doQuitApp() |
---|
022 | |
---|
023 | ########################################## |
---|
024 | ###Plistへのパス |
---|
025 | set appFileManager to refMe's NSFileManager's defaultManager() |
---|
026 | set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask)) |
---|
027 | set ocidLibraryDirPathURL to ocidURLsArray's firstObject() |
---|
028 | ###ReaderとPro両方処理する |
---|
029 | repeat with itemBundleID in listBundleID |
---|
030 | ########################################## |
---|
031 | ###【1】PLISTのパス |
---|
032 | set strSubPath to ("Preferences/" & itemBundleID) as text |
---|
033 | set ocidBaseFilePathURL to (ocidLibraryDirPathURL's URLByAppendingPathComponent:(strSubPath) isDirectory:(false)) |
---|
034 | set ocidPlistFilePathURL to (ocidBaseFilePathURL's URLByAppendingPathExtension:("plist")) |
---|
035 | |
---|
036 | ########################################## |
---|
037 | ### 【2】PLISTを可変レコードとして読み込み |
---|
038 | set ocidPlistDict to (refMe's NSMutableDictionary's alloc()'s initWithContentsOfURL:(ocidPlistFilePathURL)) |
---|
039 | ########################################## |
---|
040 | ### 【3】処理 |
---|
041 | set ocidDCDict to (ocidPlistDict's objectForKey:("DC")) |
---|
042 | ############ |
---|
043 | #旧UI 用 |
---|
044 | set ocidGeneralDict to (ocidDCDict's objectForKey:("General")) |
---|
045 | #現在の設定 |
---|
046 | set ocidRecentFoldersArray to (ocidGeneralDict's objectForKey:("RecentFolders")) |
---|
047 | if ocidRecentFoldersArray ≠ (missing value) then |
---|
048 | log (ocidRecentFoldersArray's objectAtIndex:0) as integer |
---|
049 | #値の変更 |
---|
050 | set ocidSetValue to (refMe's NSNumber's numberWithInteger:(0)) |
---|
051 | (ocidRecentFoldersArray's replaceObjectAtIndex:(0) withObject:(ocidSetValue)) |
---|
052 | #変更後の値 |
---|
053 | set ocidRecentFoldersArray to (ocidGeneralDict's objectForKey:("RecentFolders")) |
---|
054 | log (ocidRecentFoldersArray's objectAtIndex:0) as integer |
---|
055 | else if ocidRecentFoldersArray = (missing value) then |
---|
056 | #設定値が空 |
---|
057 | end if |
---|
058 | ############ |
---|
059 | #AV2新UI用 |
---|
060 | set ocidAV2GeneralDict to (ocidDCDict's objectForKey:("AVGeneral")) |
---|
061 | #現在の設定 |
---|
062 | set ocidAV2RecentFoldersArray to (ocidAV2GeneralDict's objectForKey:("RecentFolders")) |
---|
063 | if ocidAV2RecentFoldersArray ≠ (missing value) then |
---|
064 | log (ocidAV2RecentFoldersArray's objectAtIndex:0) as integer |
---|
065 | #値の変更 |
---|
066 | set ocidSetValue to (refMe's NSNumber's numberWithInteger:(0)) |
---|
067 | (ocidAV2RecentFoldersArray's replaceObjectAtIndex:(0) withObject:(ocidSetValue)) |
---|
068 | #変更後の値 |
---|
069 | set ocidAV2RecentFoldersArray to (ocidAV2GeneralDict's objectForKey:("RecentFolders")) |
---|
070 | log (ocidAV2RecentFoldersArray's objectAtIndex:0) as integer |
---|
071 | else if ocidAV2RecentFoldersArray = (missing value) then |
---|
072 | #設定値が空 |
---|
073 | end if |
---|
074 | |
---|
075 | ########################################## |
---|
076 | ####【4】保存 ここは上書き |
---|
077 | set boolDone to (ocidPlistDict's writeToURL:(ocidPlistFilePathURL) atomically:true) |
---|
078 | log boolDone |
---|
079 | if boolDone = true then |
---|
080 | log "正常終了" |
---|
081 | else |
---|
082 | return "保存に失敗しました" |
---|
083 | end if |
---|
084 | # |
---|
085 | end repeat |
---|
086 | |
---|
087 | |
---|
088 | ########################################## |
---|
089 | ####アプリケーションを終了させる |
---|
090 | |
---|
091 | to doQuitApp() |
---|
092 | |
---|
093 | set listBundleID to {"com.Adobe.Installers.AdobeLogCollectorTool", "com.Adobe.UnifiedPluginInstallerAgent", "com.adobe.ACCC.Uninstaller", "com.adobe.ARMDC", "com.adobe.ARMDCHelper", "com.adobe.AcroLicApp", "com.adobe.Acrobat.NativeMessagingHost", "com.adobe.Acrobat.Pro", "com.adobe.Acrobat.Uninstaller", "com.adobe.AdobeAcroCEF", "com.adobe.AdobeAcroCEFHelper", "com.adobe.AdobeAcroCEFHelperGPU", "com.adobe.AdobeAcroCEFHelperRenderer", "com.adobe.AdobeAcroRdrCEFHelperGPU", "com.adobe.AdobeAcroRdrCEFHelperRenderer", "com.adobe.AdobeApplicationUpdater", "com.adobe.AdobeCRDaemon", "com.adobe.AdobeIPCBroker", "com.adobe.AdobeRNAWebInstaller", "com.adobe.AdobeRdrCEF", "com.adobe.AdobeRdrCEFHelper", "com.adobe.AdobeRdrCEFHelperGPU", "com.adobe.AdobeRdrCEFHelperRenderer", "com.adobe.AdobeResourceSynchronizer", "com.adobe.Automator.Save-as-Adobe-PDF", "com.adobe.CCLibrary", "com.adobe.CCXProcess", "com.adobe.Creative-Cloud-Desktop-App", "com.adobe.HDInstall", "com.adobe.HDUninstaller", "com.adobe.ImporterREDServer.application", "com.adobe.Install", "com.adobe.LogTransport.LogTransport", "com.adobe.Reader", "com.adobe.Reader.helper", "com.adobe.acc.AdobeCreativeCloud", "com.adobe.acc.AdobeDesktopService", "com.adobe.acc.CCDContainer", "com.adobe.acc.HEXHelper", "com.adobe.acc.HEXHelper.GPU", "com.adobe.acc.HEXHelper.Renderer", "com.adobe.acc.installer.v2", "com.adobe.accmac", "com.adobe.accmac.ACCFinderSync", "com.adobe.acrobat.assert", "com.adobe.adobe_licutil", "com.adobe.bridge14", "com.adobe.cc.Adobe-Creative-Cloud-Diagnostics", "com.adobe.ccd.helper", "com.adobe.ccd.troubleshooter", "com.adobe.cep.CEPHtmlEngine", "com.adobe.cep.CEPHtmlEngine Helper", "com.adobe.cep.CEPHtmlEngine Helper (GPU)", "com.adobe.cep.CEPHtmlEngine Helper (Plugin)", "com.adobe.cep.CEPHtmlEngine Helper (Renderer)", "com.adobe.crashreporter", "com.adobe.distiller", "com.adobe.dynamiclinkmanager.application", "com.adobe.dynamiclinkmediaserver.application", "com.adobe.headlights.HLCrashProcessorApp", "com.adobe.headlights.LogTransport2App", "com.adobe.ngl.p7helper", "com.adobe.photodownloader", "com.apple.appkit.xpc.openAndSavePanelService"} as list |
---|
094 | |
---|
095 | |
---|
096 | repeat with itemBundleID in listBundleID |
---|
097 | set strBundleID to itemBundleID as text |
---|
098 | try |
---|
099 | set ocidResultsArray to (refMe's NSRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleID)) |
---|
100 | set numCntArray to ocidResultsArray count |
---|
101 | set ocidRunApp to (ocidResultsArray's objectAtIndex:0) |
---|
102 | ###通常終了 |
---|
103 | set boolDone to ocidRunApp's terminate() |
---|
104 | ####強制終了 |
---|
105 | set boolDone to ocidRunApp's forceTerminate() |
---|
106 | end try |
---|
107 | end repeat |
---|
108 | |
---|
109 | |
---|
110 | end doQuitApp |
---|