Applications

【AppleScriptOC】全てのアプリケーションを終了させる(除外リスト付き)


【AppleScriptAS】全てのアプリケーションを終了させる(除外リスト付き)
【AppleScriptOC】全てのアプリケーションを終了させる(除外リスト付き)


【スクリプトエディタで開く】 |

アプリケーション終了Asoc.scpt
ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(*
004全てのアプリケーションを終了させる
005
006
007com.cocolog-nifty.quicktimer.icefloe *)
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009use AppleScript version "2.8"
010use framework "Foundation"
011use framework "AppKit"
012use scripting additions
013
014property refMe : a reference to current application
015
016log doAppQuit()
017
018to doAppQuit()
019   #ログ用のリスト
020   set listFalseApp to {} as list
021   #終了させない除外リスト
022   set listExclusion to {"com.apple.ScriptEditor2", "com.apple.finder"} as list
023   #ワークスペース=Finder
024   set appWorkspace to refMe's NSWorkspace's sharedWorkspace()
025   #起動中のアプリケーション
026   set listApps to appWorkspace's runningApplications()
027   #起動中のアプリケーションを順番に
028   repeat with itemApp in listApps
029      #アプリケーションのファイルURL
030      set ocidAppURL to itemApp's bundleURL()
031      #テキスト形式で
032      set strAppPath to ocidAppURL's |path|() as text
033      #アプリケーションディレクトリにある場合は
034      if strAppPath contains "/Applications/" then
035         #バンドルIDを取得して
036         set strChkBundleID to itemApp's bundleIdentifier() as text
037         #除外リストに含まれているか?確認して
038         if listExclusion does not contain strChkBundleID then
039            #除外リストに含まれていないなら
040            #通常終了を試みる
041            set boolDone to itemApp's terminate()
042            #false=失敗で戻ったら
043            if boolDone is false then
044               #強制終了する
045               set boolDone to itemApp's forceTerminate()
046            end if
047            #強制終了も失敗したアプリは
048            if boolDone is false then
049               #ログで確認用
050               set strAppName to itemApp's localizedName() as text
051               set strAppName to end of listFalseApp
052            end if
053         end if
054      end if
055   end repeat
056   if listFalseApp is {} then
057      #失敗がない場合はtrueを返す
058      return true
059   else
060      #失敗がある場合失敗リストを返す
061      return listFalseApp
062   end if
063end doAppQuit
AppleScriptで生成しました

| | コメント (0)

【AppleScriptAS】全てのアプリケーションを終了させる(除外リスト付き)


【AppleScriptAS】全てのアプリケーションを終了させる(除外リスト付き)
【AppleScriptOC】全てのアプリケーションを終了させる(除外リスト付き)


【スクリプトエディタで開く】 |

アプリケーション終了As.scpt
ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(*
004昔ながらの方法
005今やこの方法ではアプリは終了できない場合も多い
006
007除外リストに入れてあるアプリケーションは終了しない
008
009com.cocolog-nifty.quicktimer.icefloe *)
010----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
011use AppleScript version "2.8"
012use scripting additions
013
014doAppQuit()
015
016to doAppQuit()
017   #除外 終了させないリスト
018   set listExclusion to {"com.apple.studentd", "com.apple.ScriptEditor2", "com.apple.systemevents", "com.apple.loginwindow", "com.apple.finder", "com.apple.chronod", "com.apple.ViewBridgeAuxiliary", "com.apple.LocalAuthentication.UIAgent", "com.apple.AuthenticationServicesCore.AuthenticationServicesAgent", "com.apple.siriactionsd", "com.apple.UIKitSystemApp", "com.apple.universalcontrol", "com.apple.WebKit.GPU", "missing value"} as list
019   #システムイベント
020   tell application "System Events"
021      #アプリケーションプロセスの名前をリストで取得
022      set listBundleID to bundle identifier of every application process as list
023   end tell
024   #プロセスを巡回
025   repeat with itemBundleID in listBundleID
026      #除外リストに含まれていないければ
027      if listExclusion does not contain itemBundleID then
028         set boolVisible to missing value
029         try
030            #対象のアプリケーションの
031            tell application id itemBundleID
032               #名前の
033               set strAppName to name
034               tell application "System Events"
035                  #プロセスが
036                  tell application process strAppName
037                     #表示されるプロセスか?
038                     set boolVisible to visible as boolean
039                  end tell
040               end tell
041            end tell
042         end try
043         #表示されるアプリケーションなら
044         if boolVisible is true then
045            #終了させる
046            try
047               tell application id itemBundleID to quit
048            end try
049         end if
050      end if
051   end repeat
052   
053   
054end doAppQuit
AppleScriptで生成しました

| | コメント (0)

[appleScript]Time Machine,Mission ControlやLaunchpadといったlauncherアプリの起動


【スクリプトエディタで開く】 |

Siri.app.scpt
ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(*
004バンドルIDからアプリケーションURL
005com.apple.exposelauncher
006/System/Applications/Mission Control.app
007com.apple.launchpad.launcher
008/System/Applications/Launchpad.app
009com.apple.backup.launcher
010/System/Applications/Time Machine.app
011com.apple.siri.launcher
012/System/Applications/Siri.app
013com.cocolog-nifty.quicktimer.icefloe *)
014----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
015use AppleScript version "2.6"
016use framework "Foundation"
017use framework "AppKit"
018use scripting additions
019
020property refMe : a reference to current application
021
022#推奨
023set strBundleID to "com.apple.siri.launcher"
024tell application id strBundleID
025   launch
026end tell
027
028return
029
030set strCmdText to ("/usr/bin/open -b " & strBundleID & "") as text
031do shell script strCmdText
032
033###############
034#パスを開く=実行することで開く
035tell application "Finder"
036   set aliasAppFileApth to (application file id strBundleID) as alias
037end tell
038
039set strAppFilePath to (POSIX path of aliasAppFileApth) as text
040set ocidAppFilePathStr to refMe's NSString's stringWithString:(strAppFilePath)
041set ocidAppFilePath to ocidAppFilePathStr's stringByStandardizingPath()
042set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
043set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
044set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
045
046
047###############
048#バンドルを取得して起動
049set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:(strBundleID)
050if ocidAppBundle is not (missing value) then
051   set ocidAppBundlePath to ocidAppBundle's bundlePath()
052   set ocidAppFilePath to ocidAppBundlePath's stringByStandardizingPath()
053   set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
054else
055   set appNSWorkspace to refMe's NSWorkspace's sharedWorkspace()
056   set ocidAppFilePathURL to appNSWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID)
057end if
058
059#起動
060set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
061set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
062
063
AppleScriptで生成しました

【スクリプトエディタで開く】 |

Time Machine.app.scpt
ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(*
004バンドルIDからアプリケーションURL
005/System/Applications/Mission Control.app
006/System/Applications/Launchpad.app
007/System/Applications/Time Machine.app
008com.cocolog-nifty.quicktimer.icefloe *)
009----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
010use AppleScript version "2.6"
011use framework "Foundation"
012use framework "AppKit"
013use scripting additions
014
015property refMe : a reference to current application
016
017#推奨
018set strBundleID to "com.apple.backup.launcher"
019tell application id strBundleID
020   launch
021end tell
022
023return
024###############
025#パスを開く=実行することで開く
026tell application "Finder"
027   set aliasAppFileApth to (application file id strBundleID) as alias
028end tell
029
030set strAppFilePath to (POSIX path of aliasAppFileApth) as text
031set ocidAppFilePathStr to refMe's NSString's stringWithString:(strAppFilePath)
032set ocidAppFilePath to ocidAppFilePathStr's stringByStandardizingPath()
033set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
034set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
035set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
036
037
038###############
039#バンドルを取得して起動
040set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:(strBundleID)
041if ocidAppBundle is not (missing value) then
042   set ocidAppBundlePath to ocidAppBundle's bundlePath()
043   set ocidAppFilePath to ocidAppBundlePath's stringByStandardizingPath()
044   set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
045else
046   set appNSWorkspace to refMe's NSWorkspace's sharedWorkspace()
047   set ocidAppFilePathURL to appNSWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID)
048end if
049
050#起動
051set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
052set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
053
054
AppleScriptで生成しました

【スクリプトエディタで開く】 |

Launchpad.app.scpt
ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(*
004バンドルIDからアプリケーションURL
005/System/Applications/Mission Control.app
006/System/Applications/Launchpad.app
007com.cocolog-nifty.quicktimer.icefloe *)
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009use AppleScript version "2.6"
010use framework "Foundation"
011use framework "AppKit"
012use scripting additions
013
014property refMe : a reference to current application
015
016#推奨
017set strBundleID to "com.apple.launchpad.launcher"
018tell application id strBundleID
019   launch
020end tell
021
022
023###############
024#パスを開く=実行することで開く
025tell application "Finder"
026   set aliasAppFileApth to (application file id strBundleID) as alias
027end tell
028
029set strAppFilePath to (POSIX path of aliasAppFileApth) as text
030set ocidAppFilePathStr to refMe's NSString's stringWithString:(strAppFilePath)
031set ocidAppFilePath to ocidAppFilePathStr's stringByStandardizingPath()
032set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
033set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
034set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
035
036
037###############
038#バンドルを取得して起動
039set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:(strBundleID)
040if ocidAppBundle is not (missing value) then
041   set ocidAppBundlePath to ocidAppBundle's bundlePath()
042   set ocidAppFilePath to ocidAppBundlePath's stringByStandardizingPath()
043   set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
044else
045   set appNSWorkspace to refMe's NSWorkspace's sharedWorkspace()
046   set ocidAppFilePathURL to appNSWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID)
047end if
048
049#起動
050set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
051set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
052
053
AppleScriptで生成しました

【スクリプトエディタで開く】 |

Mission Controlの起動.scpt
ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(*
004バンドルIDからアプリケーションURL
005/System/Applications/Mission Control.app
006
007com.cocolog-nifty.quicktimer.icefloe *)
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009use AppleScript version "2.6"
010use framework "Foundation"
011use framework "AppKit"
012use scripting additions
013
014property refMe : a reference to current application
015
016#推奨
017set strBundleID to "com.apple.exposelauncher"
018tell application id strBundleID
019   launch
020end tell
021
022
023###############
024#パスを開く=実行することで開く
025tell application "Finder"
026   set aliasAppFileApth to (application file id strBundleID) as alias
027end tell
028
029set strAppFilePath to (POSIX path of aliasAppFileApth) as text
030set ocidAppFilePathStr to refMe's NSString's stringWithString:(strAppFilePath)
031set ocidAppFilePath to ocidAppFilePathStr's stringByStandardizingPath()
032set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
033set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
034set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
035
036
037###############
038#バンドルを取得して起動
039set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:(strBundleID)
040if ocidAppBundle is not (missing value) then
041   set ocidAppBundlePath to ocidAppBundle's bundlePath()
042   set ocidAppFilePath to ocidAppBundlePath's stringByStandardizingPath()
043   set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
044else
045   set appNSWorkspace to refMe's NSWorkspace's sharedWorkspace()
046   set ocidAppFilePathURL to appNSWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID)
047end if
048
049#起動
050set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
051set boolDone to appSharedWorkspace's openURL:(ocidAppFilePathURL)
052
053
AppleScriptで生成しました

| | コメント (0)

バンドルIDからアプリケーションのバージョンの取得(汎用・iOSアプリ対応)

アプリケーションのバージョン取得.scpt

AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#com.cocolog-nifty.quicktimer.icefloe
004# バンドルIDからアプリケーションのバージョンを取得する
005# アプリケーションを起動させない
006# iOSアプリも対応させたいと思ったらこうなった
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "AppKit"
011use scripting additions
012property refMe : a reference to current application
013
014#バンドルID
015set strBundleID to ("com.xrite.pantone.pantoneconnect") as text
016#想定されるパス
017set strPresAppPath to ("~/Applications/Pantone Connect.app") as text
018
019##############
020#アプリケーションのパス取得
021set refResponse to doChkAppPath(strBundleID, strPresAppPath)
022if refResponse is false then
023  return "アプリケーションが見つかりませんでした"
024else
025  set {strAppPath, ocidAppPathURL} to refResponse
026end if
027log strAppPath
028
029##############
030#バージョン取得
031set refResponse to doGetAppVerSion(ocidAppPathURL)
032if refResponse is false then
033  return "アプリケーションのバージョン不明"
034else
035  set {ocidVersion, ocidVersionString} to refResponse
036end if
037log ocidVersion as text
038log ocidVersionString as text
039
040
041return
042
043##########################
044#【A】インストール済みチェック
045to doChkAppPath(argBundleID, argPresAppPath)
046  set appFileManager to refMe's NSFileManager's defaultManager()
047  set ocidAppBundle to (refMe's NSBundle's bundleWithIdentifier:(argBundleID))
048  if ocidAppBundle = (missing value) then
049    #バンドルで見つからない場合 NSWorkspace
050    set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
051    set ocidAppPathURL to (appSharedWorkspace's URLForApplicationWithBundleIdentifier:(argBundleID))
052    if ocidAppPathURL = (missing value) then
053      #AppKitで見つからない場合 Finder
054      try
055        tell application "Finder"
056          set aliasAppApth to (application file id argBundleID) as alias
057          set strAppPath to (POSIX path of aliasAppApth) as text
058        end tell
059        set ocidAppPathStr to (refMe's NSString's stringWithString:(strAppPath))
060        set ocidAppPath to ocidAppPathStr's stringByStandardizingPath()
061        set ocidAppPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppPath) isDirectory:true)
062      on error
063        set ocidPresAppPathStr to (refMe's NSString's stringWithString:(argPresAppPath))
064        set ocidPresAppPath to ocidPresAppPathStr's stringByStandardizingPath()
065        set ocidPresAppPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidPresAppPath) isDirectory:true)
066        set boolDirExists to appFileManager's fileExistsAtPath:(ocidPresAppPath) isDirectory:(missing value)
067        if boolDirExists is true then
068          set ocidAppPath to ocidPresAppPath
069          set ocidAppPathURL to ocidPresAppPathURL
070        else if boolDirExists is false then
071          log "アプケーションを発見できません"
072          return false
073        end if
074      end try
075    end if
076  else
077    #バンドルで見つかる場合
078    set ocidAppPathURL to ocidAppBundle's bundleURL()
079  end if
080  ##########################
081  #本当にあるか?チェック
082  set ocidAppPath to ocidAppPathURL's |path|()
083  set boolDirExists to appFileManager's fileExistsAtPath:(ocidAppPath) isDirectory:(missing value)
084  if boolDirExists is true then
085    log "インストール済み"
086  else if boolDirExists is false then
087    #見つからない Finderで再チェック
088    tell application "Finder"
089      set aliasAppApth to (application file id argBundleID) as alias
090      set strAppPath to (POSIX path of aliasAppApth) as text
091    end tell
092    set ocidAppPathStr to (refMe's NSString's stringWithString:(strAppPath))
093    set ocidAppPath to ocidAppPathStr's stringByStandardizingPath()
094    set ocidAppPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppPath) isDirectory:true)
095    set strAppPath to ocidAppPathURL's |path|() as text
096    set boolDirExists to appFileManager's fileExistsAtPath:(ocidAppPath) isDirectory:(missing value)
097    #Finderで見つかった
098    if boolDirExists is true then
099      set listResponse to {strAppPath, ocidAppPathURL} as list
100      return listResponse
101    else if boolDirExists is false then
102      #想定パスも探す
103      set ocidPresAppPathStr to (refMe's NSString's stringWithString:(argPresAppPath))
104      set ocidPresAppPath to ocidPresAppPathStr's stringByStandardizingPath()
105      set ocidPresAppPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidPresAppPath) isDirectory:true)
106      set boolDirExists to appFileManager's fileExistsAtPath:(ocidPresAppPath) isDirectory:(missing value)
107      if boolDirExists is true then
108        set strAppPath to ocidPresAppPathURL's |path|() as text
109        set listResponse to {strAppPath, ocidAppPathURL} as list
110        return listResponse
111      else if boolDirExists is false then
112        log "アプケーションを発見できません"
113        return false
114      end if
115    end if
116  end if
117  set strAppPath to ocidAppPathURL's |path|() as text
118  set listResponse to {strAppPath, ocidAppPathURL} as list
119  return listResponse
120end doChkAppPath
121
122
123##########################
124#【B】アプリケーションのバージョンの取得
125to doGetAppVerSion(argAppPathURL)
126  set ocidBundle to refMe's NSBundle's bundleWithURL:(argAppPathURL)
127  set ocidInfoDict to ocidBundle's infoDictionary()
128  set ocidVersionString to (ocidInfoDict's valueForKey:("CFBundleShortVersionString"))
129  set ocidVersion to (ocidInfoDict's valueForKey:("CFBundleVersion"))
130  return {ocidVersion, ocidVersionString}
131end doGetAppVerSion
AppleScriptで生成しました

|

Master PDF Editor

なんと『ロシア製』のPDFエディタ
よく出来ている、とてもいい

これは使えない。
202502271209011_1376x924

使い続ける勇気がない…ロシア製


|

Pixelmatorお試し版廃止…

Pixelmatorのサイトからお試し版が廃止になった
Appleに買収されたのもあり
サイトのルックもAppleっぽい感じ…苦笑

1週間お試しの後年4500円のサブスクの
Photomator
https://www.pixelmator.com/photomator/
実質こちらがお試し版となったわけかな?たぶん

8000円の
Pixelmator Pro
https://www.pixelmator.com/pro/

Pixelmator Proに軍配だろう
ホームユーザーには良いと思うし
Web限定なら、十分な機能もあるのでおすすめできるし
コスパがいい♪

|

[skitch]skitchのリセット(フォントがおかしくなった時用)


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#com.cocolog-nifty.quicktimer.icefloe
004# サンドボックスアプリケーションを初期化
005----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
006use AppleScript version "2.8"
007use framework "Foundation"
008use framework "AppKit"
009use scripting additions
010property refMe : a reference to current application
011
012#初期化するアプリのバンドルID
013set listBundleName to {"com.skitch.skitch", "com.skitch.skitch.SkitchMacAction", "com.skitch.skitch.SkitchMacPhotoEditing"} as list
014
015set listDirName to {"Application Scripts", "WebKit", "HTTPStorages", "Containers", "Caches"} as list
016
017
018set appFileManager to refMe's NSFileManager's defaultManager()
019set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
020set ocidLibraryDirPathURL to ocidURLsArray's firstObject()
021
022###############################
023# ゴミ箱に入れる
024
025repeat with itemDirName in listDirName
026  set ocidContainersDirPathURL to (ocidLibraryDirPathURL's URLByAppendingPathComponent:(itemDirName) isDirectory:(true))
027  
028  repeat with itemBundleName in listBundleName
029    
030    set ocidMove2TrashDirPathURL to (ocidContainersDirPathURL's URLByAppendingPathComponent:(itemBundleName) isDirectory:(true))
031    
032    set ListDone to (appFileManager's trashItemAtURL:(ocidMove2TrashDirPathURL) resultingItemURL:(ocidMove2TrashDirPathURL) |error| :(reference))
033    if (item 2 of ListDone) (missing value) then
034      set strErrorNO to (item 2 of ListDone)'s code() as text
035      set strErrorMes to (item 2 of ListDone)'s localizedDescription() as text
036      refMe's NSLog("■:" & strErrorNO & strErrorMes)
037      log "エラーしました" & strErrorNO & strErrorMes
038    end if
039    
040  end repeat
041  
042end repeat
043
044###############################
045###############################
046# ディレクトリ
047set appFileManager to refMe's NSFileManager's defaultManager()
048set ocidTempDirURL to appFileManager's temporaryDirectory()
049
050###############################
051#  Tキャッシュをゴミ箱に
052repeat with itemDirName in listDirName
053  
054  set ocidMove2TrashDirPathURL to (ocidTempDirURL's URLByAppendingPathComponent:(itemDirName) isDirectory:(true))
055  
056  set appFileManager to refMe's NSFileManager's defaultManager()
057  set ListDone to (appFileManager's trashItemAtURL:(ocidMove2TrashDirPathURL) resultingItemURL:(ocidMove2TrashDirPathURL) |error| :(reference))
058  if (item 2 of ListDone) (missing value) then
059    set strErrorNO to (item 2 of ListDone)'s code() as text
060    set strErrorMes to (item 2 of ListDone)'s localizedDescription() as text
061    refMe's NSLog("■:" & strErrorNO & strErrorMes)
062    log "エラーしました" & strErrorNO & strErrorMes
063  end if
064  
065end repeat
066
067
068set ocidVarFolderPathURL to ocidTempDirURL's URLByDeletingLastPathComponent()
069set ocidCDirPathURL to (ocidVarFolderPathURL's URLByAppendingPathComponent:("C") isDirectory:(true))
070
071###############################
072#  Cキャッシュをゴミ箱に
073repeat with itemDirName in listDirName
074  
075  set ocidMove2TrashDirPathURL to (ocidCDirPathURL's URLByAppendingPathComponent:(itemDirName) isDirectory:(true))
076  
077  set appFileManager to refMe's NSFileManager's defaultManager()
078  set ListDone to (appFileManager's trashItemAtURL:(ocidMove2TrashDirPathURL) resultingItemURL:(ocidMove2TrashDirPathURL) |error| :(reference))
079  if (item 2 of ListDone) (missing value) then
080    set strErrorNO to (item 2 of ListDone)'s code() as text
081    set strErrorMes to (item 2 of ListDone)'s localizedDescription() as text
082    refMe's NSLog("■:" & strErrorNO & strErrorMes)
083    log "エラーしました" & strErrorNO & strErrorMes
084  end if
085  
086end repeat
087
088
089return
AppleScriptで生成しました

|

Affinity お試し版ダウンロードURLの取得(少し治し テキストファイルにするようにした)


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#com.cocolog-nifty.quicktimer.icefloe
005#
006#
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "AppKit"
011use scripting additions
012property refMe : a reference to current application
013
014
015#対象のURL
016# set strURL to ("https://store.serif.com/en-gb/update/macos/publisher/2/") as text
017# set strURL to ("https://store.serif.com/en-gb/update/macos/photo/2/") as text
018set strURL to ("https://store.serif.com/en-gb/update/macos/designer/2/") as text
019
020#URL
021set ocidURLString to (refMe's NSString's stringWithString:(strURL))
022set ocidURL to (refMe's NSURL's alloc()'s initWithString:(ocidURLString))
023
024#XML
025set ocidOption to (refMe's NSXMLDocumentTidyHTML)
026set listReadXMLDoc to (refMe's NSXMLDocument's alloc()'s initWithContentsOfURL:(ocidURL) options:(ocidOption) |error| :(reference))
027set ocidReadXMLDoc to (item 1 of listReadXMLDoc)
028set ocidRootElement to ocidReadXMLDoc's rootElement()
029set ocidHeadElement to (ocidRootElement's elementsForName:("body"))'s firstObject()
030set listResponse to (ocidHeadElement's nodesForXPath:("//a") |error| :(reference))
031if (item 2 of listResponse) = (missing value) then
032  set ocidAArray to (item 1 of listResponse)
033else if (item 2 of listResponse) (missing value) then
034  set strErrorNO to (item 2 of listResponse)'s code() as text
035  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
036  refMe's NSLog("■:" & strErrorNO & strErrorMes)
037  return "エラーしました" & strErrorNO & strErrorMes
038end if
039
040#出力用テキスト
041set ocidOutPutstring to refMe's NSMutableString's alloc()'s initWithCapacity:(0)
042
043#収集したURLの数だけ繰り返し
044repeat with itemNode in ocidAArray
045  set ocidLinkAttr to (itemNode's attributeForName:("href"))
046  set strLinkURL to ocidLinkAttr's stringValue() as text
047  set ocidLinkURLString to (refMe's NSString's stringWithString:(strLinkURL))
048  set ocidLinkURL to (refMe's NSURL's alloc()'s initWithString:(ocidLinkURLString))
049  set strExtensionName to ocidLinkURL's pathExtension() as text
050  if strExtensionName is "dmg" then
051    (ocidOutPutstring's appendString:(ocidLinkURLString))
052    (ocidOutPutstring's appendString:("\n--------------------------\n"))
053  end if
054end repeat
055
056###ディレクトリ
057set appFileManager to refMe's NSFileManager's defaultManager()
058set ocidTempDirURL to appFileManager's temporaryDirectory()
059set ocidUUID to refMe's NSUUID's alloc()'s init()
060set ocidUUIDString to ocidUUID's UUIDString
061set ocidSaveDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
062
063
064set appFileManager to refMe's NSFileManager's defaultManager()
065set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
066ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
067set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
068###パス
069set strFileName to "URL.txt" as text
070set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(strFileName) isDirectory:false
071
072
073
074set listDone to ocidOutPutstring's writeToURL:(ocidSaveFilePathURL) atomically:(true) encoding:(refMe's NSUTF8StringEncoding) |error| :(reference)
075if (item 1 of listDone) is true then
076  
077  
078  set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
079  set boolDone to appSharedWorkspace's openURL:(ocidSaveFilePathURL)
080  
081else if (item 1 of listDone) is false then
082  log (item 2 of listDone)'s localizedDescription() as text
083  return "保存に失敗しました"
084end if
085
086
087return (ocidOutPutstring as text)
AppleScriptで生成しました

|

ドロップレット等でGateKeeperの排他になったアプリを利用可能にする

Sentinel1
企業ユーザーにはアレだけど
一般ユーザーなら使ってもいいかもしれない
便利だし、コマンド覚えなくていいし…
https://github.com/alienator88/Sentinel

|

com.apple.tips ヒント.app


サンプルコード

サンプルソース(参考)
行番号ソース
001#!/bin/zsh
002
003/usr/bin/open  -b com.apple.tips
004/usr/bin/open /System/Library/CoreServices/Tips.app
005
006/usr/bin/open x-apple-tips://
007/usr/bin/open "x-apple-tips://open?collection=WelcomeToMac"
008/usr/bin/open "x-apple-tips://open?collection=WhatsNewInMacOS"
009
010/usr/bin/open  -b com.apple.tips "x-apple-tips://open?collection=WelcomeToMac"
011/usr/bin/open  -b com.apple.tips "x-apple-tips://open?collection=WhatsNewInMacOS"
012
013#x-help-action://openPrefPane?bundleId=com.apple.preferences.password
014#↓
015/usr/bin/open "x-apple.systempreferences:com.apple.Touch-ID-Settings.extension*TouchIDPasswordPrefs"
016
017#x-help-action://openPrefPane?bundleId=com.apple.preferences.AppleIDPrefPane
018#↓
019x-apple.systempreferences:com.apple.systempreferences.AppleIDSettings*AppleIDSettings
AppleScriptで生成しました

|

その他のカテゴリー

Accessibility Acrobat Acrobat 2020 Acrobat 2024 Acrobat AddOn Acrobat Annotation Acrobat AppleScript Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat GentechAI Acrobat JS Acrobat JS Word Search Acrobat Maintenance Acrobat Manifest Acrobat Menu Acrobat Merge Acrobat Open Acrobat PDFPage Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat Print Acrobat Python Acrobat Reader Acrobat Reader Localized Acrobat Reference Acrobat Registered Products Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat URL List Mac Acrobat URL List Windows Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin ConfigCode Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin NetWork Admin Permission Admin Pkg Admin Power Management Admin Printer Admin Printer Basic Admin Printer Custompapers Admin SetUp Admin SMB Admin softwareupdate Admin Support Admin System Information Admin TCC Admin Tools Admin Umask Admin Users Admin Volumes Admin XProtect Adobe Adobe AUSST Adobe Bridge Adobe Documents Adobe FDKO Adobe Fonts Adobe Reference Adobe RemoteUpdateManager Adobe Sap Code AppKit Apple AppleScript AppleScript Duplicate AppleScript entire contents AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Video Applications AppStore Archive Archive Keka Attributes Automator BackUp Barcode Barcode Decode Barcode QR Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome Chromedriver CIImage CityCode CloudStorage Color Color NSColor Color NSColorList com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time delimiters Desktop Desktop Position Device Diff Disk do shell script Dock Dock Launchpad DropBox Droplet eMail Encode % Encode Decode Encode HTML Entity Encode UTF8 Error EXIFData exiftool ffmpeg File File Name Finder Finder Window Firefox Folder FolderAction Font List FontCollections Fonts Fonts Asset_Font Fonts ATS Fonts Emoji Fonts Maintenance Fonts Morisawa Fonts Python Fonts Variable Foxit GIF github Guide HTML Icon Icon Assets.car Illustrator Image Events ImageOptim Input Dictionary iPhone iWork Javascript Jedit Ω Json Label Language Link locationd lsappinfo m3u8 Mail Map Math Media Media AVAsset Media AVconvert Media AVFoundation Media AVURLAsset Media Movie Media Music Memo Messages Microsoft Microsoft Edge Microsoft Excel Microsoft Fonts Microsoft Office Microsoft Office Link Microsoft OneDrive Microsoft Teams Mouse Music Node Notes NSArray NSArray Sort NSAttributedString NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSGraphicsContext Crop NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMetadataItem NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSet NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSUbiquitous NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth PDF PDF Image2PDF PDF MakePDF PDF nUP PDF Pymupdf PDF Pypdf PDFContext PDFDisplayBox PDFImageRep PDFKit PDFKit Annotation PDFKit AnnotationWidget PDFKit DocumentPermissions PDFKit OCR PDFKit Outline PDFKit Start PDFPage PDFPage Rotation PDFView perl Photoshop PlistBuddy pluginkit plutil postalcode PostScript PowerShell prefPane Preview Python Python eyed3 Python pip QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver Script Editor Script Menu SF Symbols character id SF Symbols Entity Shortcuts Shortcuts Events sips Skype Slack Sound Spotlight sqlite StandardAdditions StationSearch Subtitles LRC Subtitles SRT Subtitles VTT Swift swiftDialog System Events System Settings TemporaryItems Terminal Text Text CSV Text MD Text TSV TextEdit Tools Translate Trash Twitter Typography UI Unit Conversion UTType valueForKeyPath Video VisionKit Visual Studio Code VMware Fusion Wacom Weather webarchive webp Wifi Windows XML XML EPUB XML HTML XML LSSharedFileList XML LSSharedFileList sfl2 XML LSSharedFileList sfl3 XML objectsForXQuery XML OPML XML Plist XML Plist System Events XML RSS XML savedSearch XML SVG XML TTML XML webloc XML xmllint XML XMP YouTube Zero Padding zoom