Skype

[bash]Skypeアップデートすこし修正


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

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#ユーザードメインにインストール

########################################
##実行パス
SCRIPT_PATH="${BASH_SOURCE[0]}"
/bin/echo "実行中のスクリプト"
/bin/echo "\"$SCRIPT_PATH\""
########################################
##OS
PLIST_PATH="/System/Library/CoreServices/SystemVersion.plist"
STR_OS_VER=$(/usr/bin/defaults read "$PLIST_PATH" ProductVersion)
/bin/echo "OS VERSION :" "$STR_OS_VER"
STR_MAJOR_VERSION="${STR_OS_VER%%.*}"
/bin/echo "STR_MAJOR_VERSION :" "$STR_MAJOR_VERSION"
STR_MINOR_VERSION="${STR_OS_VER#*.}"
/bin/echo "STR_MINOR_VERSION :" "$STR_MINOR_VERSION"

########################################
##ユーザー
USER_WHOAMI=$(/usr/bin/whoami)
/bin/echo "実行したユーザーは:$USER_WHOAMI"
CURRENT_USER=$(/bin/echo "$HOME" | /usr/bin/awk -F'/' '{print $NF}')
/bin/echo "実行ユーザー:" "$CURRENT_USER"

########################################
##デバイス
#起動ディスクの名前を取得する
/usr/bin/touch "$USER_TEMP_DIR/diskutil.plist"
/usr/sbin/diskutil info -plist / >"$USER_TEMP_DIR/diskutil.plist"
STARTUPDISK_NAME=$(/usr/bin/defaults read "$USER_TEMP_DIR/diskutil.plist" VolumeName)
/bin/echo "ボリューム名:" "$STARTUPDISK_NAME"

STR_DEVICE_UUID=$(/usr/sbin/ioreg -c IOPlatformExpertDevice | grep IOPlatformUUID | awk -F'"' '{print $4}')
/bin/echo "デバイスUUID: " "$STR_DEVICE_UUID"

########################################
###ダウンロード起動時に削除する項目
USER_TEMP_DIR=$(/usr/bin/mktemp -d)
/bin/echo "起動時に削除されるディレクトリ:" "$USER_TEMP_DIR"

###CPUタイプでの分岐
ARCHITEC=$(/usr/bin/arch)
/bin/echo "Running on $ARCHITEC"
if [ "$ARCHITEC" == "arm64" ]; then
  ###ARM用のダウンロードURL
  STR_URL="https://get.skype.com/go/getskype-skypeformac"
  ###ファイル名を取得
  DL_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "DL_FILE_NAME:$DL_FILE_NAME"
  ###ダウンロード
  if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1で再トライします"
    if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20; then
      /bin/echo "ファイルのダウンロードに失敗しました"
      exit 1
    fi
  fi
else
  ###INTEL用のダウンロードURL
  STR_URL="https://get.skype.com/go/getskype-skypeformac"
  ###ファイル名を取得
  DL_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "DL_FILE_NAME:$DL_FILE_NAME"
  ###ダウンロード
  if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1で再トライします"
    if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20; then
      /bin/echo "ファイルのダウンロードに失敗しました"
      exit 1
    fi
  fi
fi
##全ユーザー実行可能にしておく
/bin/chmod 755 "$USER_TEMP_DIR/$DL_FILE_NAME"
/bin/echo "ダウンロードOK"

########################################
###アプリケーションの終了
###コンソールユーザーにのみ処理する
CONSOLE_USER=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/ { print $3 }')
/bin/echo "CONSOLE_USER:$CONSOLE_USER"
if [ -z "$CONSOLE_USER" ]; then
  /bin/echo "コンソールユーザーが無い=電源入れてログインウィンドウ状態"
else
  #####OSAスクリプトはエラーすることも多い(初回インストール時はエラーになる)
  if ! /usr/bin/osascript -e "tell application id \"com.skype.skype\" to quit"; then
    ##念の為 KILLもする
    /usr/bin/killall "Skype" 2>/dev/null
    /usr/bin/killall "Skype Helper" 2>/dev/null
    /usr/bin/killall "Skype Helper (GPU)" 2>/dev/null
    /usr/bin/killall "Skype Helper (Renderer)" 2>/dev/null
  fi
fi
/bin/sleep 2

############################################################
##基本メンテナンス
##ライブラリの不可視属性を解除
/usr/bin/chflags nohidden "/Users/$CURRENT_USER/Library"
/usr/bin/SetFile -a v "/Users/$CURRENT_USER/Library"
## Managed Itemsフォルダを作る
/bin/mkdir -p "/Users/$CURRENT_USER/Library/Managed Items"
/bin/chmod 755 "/Users/$CURRENT_USER/Library/Managed Items"
/usr/sbin/chown "$CURRENT_USER" "/Users/$CURRENT_USER/Library/Managed Items"
/usr/bin/touch "/Users/$CURRENT_USER/Library/Managed Items/.localized"

########################################
## HOME
########################################
## Developer
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Developer"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
## bin
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/bin"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
##アクセス権チェック
/bin/chmod 700 "/Users/$CURRENT_USER/Library"
/bin/chmod 700 "/Users/$CURRENT_USER/Movies"
/bin/chmod 700 /"Users/$CURRENT_USER/Music"
/bin/chmod 700 "/Users/$CURRENT_USER/Pictures"
/bin/chmod 700 "/Users/$CURRENT_USER/Downloads"
/bin/chmod 700 "/Users/$CURRENT_USER/Documents"
/bin/chmod 700 "/Users/$CURRENT_USER/Desktop"
##全ローカルユーザーに対して実施したい処理があれば追加する
/bin/echo "ユーザーディレクトリチェックDONE"
########################################
## Public
########################################
/bin/chmod 755 "/Users/$CURRENT_USER/Public"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Drop Box"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 733 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf nobody "$STR_CHECK_DIR_PATH"
##########
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Documents"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf admin "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Downloads"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf admin "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Favorites"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf admin "$STR_CHECK_DIR_PATH"
##########
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Groups"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 770 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf staff "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Shared"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 750 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf staff "$STR_CHECK_DIR_PATH"
##########
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Guest"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 777 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf nobody "$STR_CHECK_DIR_PATH"
##
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Public/Shared Items"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 775 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
/usr/bin/chgrp -Rf nobody "$STR_CHECK_DIR_PATH"

########################################
## Applications
########################################
## Applications
STR_CHECK_DIR_PATH="/Users/$CURRENT_USER/Applications"
/bin/mkdir -p "$STR_CHECK_DIR_PATH"
/bin/chmod 700 "$STR_CHECK_DIR_PATH"
/usr/bin/touch "$STR_CHECK_DIR_PATH/.localized"
##サブフォルダを作る
LIST_SUB_DIR_NAME=("Demos" "Desktop" "Developer" "Documents" "Downloads" "Favorites" "Groups" "Library" "Movies" "Music" "Pictures" "Public" "Shared" "Sites" "System" "Users" "Utilities")
##リストの数だけ処理
for ITEM_DIR_NAME in "${LIST_SUB_DIR_NAME[@]}"; do
  /bin/mkdir -p "$STR_CHECK_DIR_PATH/${ITEM_DIR_NAME}"
  /bin/chmod 700 "$STR_CHECK_DIR_PATH/${ITEM_DIR_NAME}"
  /usr/bin/touch "$STR_CHECK_DIR_PATH/${ITEM_DIR_NAME}/.localized"
done
########################################
##シンボリックリンクを作る
if [[ ! -e "/Users/$CURRENT_USER/Applications/Applications" ]]; then
  /bin/ln -s "/Applications" "/Users/$CURRENT_USER/Applications/Applications"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/Finder Applications" ]]; then
  /bin/ln -s "/System/Library/CoreServices/Finder.app/Contents/Applications" "/Users/$CURRENT_USER/Applications/Utilities/Finder Applications"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/Finder Libraries" ]]; then
  /bin/ln -s "/System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries" "/Users/$CURRENT_USER/Applications/Utilities/Finder Libraries"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/System Applications" ]]; then
  /bin/ln -s "/System/Library/CoreServices/Applications" "/Users/$CURRENT_USER/Applications/Utilities/System Applications"
fi
if [[ ! -e "/Users/$CURRENT_USER/Applications/Utilities/System Utilities" ]]; then
  /bin/ln -s "/Applications/Utilities" "/Users/$CURRENT_USER/Applications/Utilities/System Utilities"
fi

############################################################
#####古いファイルをゴミ箱に USER
function DO_MOVE_TO_TRASH() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "/Users/$CURRENT_USER/.Trash/SKYPE.XXXXXXXX")
    /bin/chmod 777 "$TRASH_DIR"
    /bin/mv "$1" "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に USER
DO_MOVE_TO_TRASH "/Applications/Skype.app"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Applications/Skype.app"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Applications/Groups/Skype.app"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Caches/com.skype.skype"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Caches/com.skype.skype.ShipIt"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/Cache"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/Code Cache"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/Crashpad"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/GPUCache"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/logs"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/HTTPStorages/com.skype.skype"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Logs/Skype Helper (Renderer)"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Saved Application State/com.skype.skype.savedState"

/bin/echo "ユーザーキャッシュ削除DONE"
############################################################
###/var/folde T
MKTEMP_DIR=$(/usr/bin/mktemp -d)
TEMP_DIR_T="$(/usr/bin/dirname "$MKTEMP_DIR")"
function DO_MOVE_TO_TRASH_T() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "/Users/$CURRENT_USER/.Trash/SKYPE.T.XXXXXXXX")
    /bin/chmod 777 "$TRASH_DIR"
    /bin/mv "$1" "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype"
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype Helper"
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype Helper (GPU)"
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype Helper (Renderer)"

/bin/echo "ユーザーキャッシュT DONE"
############################################################
###/var/folder C
TEMP_DIR="$(/usr/bin/dirname "$TEMP_DIR_T")"
TEMP_DIR_C="${TEMP_DIR}/C"
function DO_MOVE_TO_TRASH_C() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "/Users/$CURRENT_USER/.Trash/SKYPE.C.XXXXXXXX")
    /bin/chmod 777 "$TRASH_DIR"
    /bin/mv "$1" "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype"
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype.Helper"
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype.Helper-(GPU)"
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype.Helper-(Renderer)"
/bin/echo "ユーザーキャッシュ C DONE"

############################################################
######### DITTOコピーインストール
/bin/echo "インストール開始:DITTO:" "$CURRENT_USER"
###ディスクをマウント
/usr/bin/hdiutil attach "$USER_TEMP_DIR/$DL_FILE_NAME" -noverify -nobrowse -noautoopen
sleep 2
####コピーして
/usr/bin/ditto "/Volumes/Skype/Skype.app" "/Users/$CURRENT_USER/Applications/Groups/Skype.app"
sleep 2
###ディスクをアンマウント
/usr/bin/hdiutil detach /Volumes/Skype -force
################################################
###設定項目
STR_BUNDLEID="com.skype.skype"
STR_APP_PATH="$HOME/Applications/Groups/Skype.app"

###アプリケーション名を取得
STR_APP_NAME=$(/usr/bin/defaults read "$STR_APP_PATH/Contents/Info.plist" CFBundleDisplayName)
if [ -z "$STR_APP_NAME" ]; then
  STR_APP_NAME=$(/usr/bin/defaults read "$STR_APP_PATH/Contents/Info.plist" CFBundleName)
fi
/bin/echo "アプリケーション名:$STR_APP_NAME"

##Dockの登録数を調べる
JSON_PERSISENT_APPS=$(/usr/bin/defaults read com.apple.dock persistent-apps)
NUN_CNT_ITEM=$(/bin/echo "$JSON_PERSISENT_APPS" | grep -o "tile-data" | wc -l)
/bin/echo "Dock登録数:$NUN_CNT_ITEM"
##Dockの登録数だけ繰り返し
NUM_CNT=0 #カウンタ初期化
NUM_POSITION="NULL" #ポジション番号にNULL文字を入れる
###対象のバンドルIDがDockに登録されているか順番に調べる
while [ $NUM_CNT -lt "$NUN_CNT_ITEM" ]; do
  ##順番にバンドルIDを取得して
  STR_CHK_BUNDLEID=$(/usr/libexec/PlistBuddy -c "Print:persistent-apps:$NUM_CNT:tile-data:bundle-identifier" "$HOME/Library/Preferences/com.apple.dock.plist")
  ##対象のバンドルIDだったら
  if [ "$STR_CHK_BUNDLEID" = "$STR_BUNDLEID" ]; then
    /bin/echo "DockのポジションNO: $NUM_CNT バンドルID:$STR_CHK_BUNDLEID"
    ##位置情報ポジションを記憶しておく
    NUM_POSITION=$NUM_CNT
  fi
  NUM_CNT=$((NUM_CNT + 1))
done
##結果 対象のバンドルIDが無ければ
if [ "$NUM_POSITION" = "NULL" ]; then
  /bin/echo "Dockに未登録です"
  PLIST_DICT="<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$STR_APP_PATH</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
  /usr/bin/defaults write com.apple.dock persistent-apps -array-add "$PLIST_DICT"
else
  ##すでに登録済みの場合は一旦削除
  /bin/echo "Dockの$NUM_POSITION に登録済み 削除してから同じ場所に登録しなおします"
  ##削除して
  /usr/libexec/PlistBuddy -c "Delete:persistent-apps:$NUM_POSITION" "$HOME/Library/Preferences/com.apple.dock.plist"
  ##保存
  /usr/libexec/PlistBuddy -c "Save" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "Revert" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###同じ内容を作成する
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION dict" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:GUID integer $RANDOM$RANDOM" "$HOME/Library/Preferences/com.apple.dock.plist"
  ## 想定値 file-tile directory-tile
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-type string file-tile" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###↑この親Dictに子要素としてtile-dataをDictで追加
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data dict" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###↑子要素のtile-dataにキーと値を入れていく
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:showas integer 0" "$HOME/Library/Preferences/com.apple.dock.plist"
  ## 想定値 2:フォルダ 41:アプリケーション 169 Launchpad とMission Control
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-type integer 41" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:displayas integer 0" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:parent-mod-date integer $(date '+%s')" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-mod-date integer $(date '+%s')" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-label string $STR_APP_NAME" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:is-beta bool false" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###↑この子要素のtile-dataに孫要素でfile-dataをDictで追加
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-data dict" "$HOME/Library/Preferences/com.apple.dock.plist"
  ###値を入れていく
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-data:_CFURLStringType integer 15" "$HOME/Library/Preferences/com.apple.dock.plist"
  /usr/libexec/PlistBuddy -c "add:persistent-apps:$NUM_POSITION:tile-data:file-data:_CFURLString string file://$STR_APP_PATH" "$HOME/Library/Preferences/com.apple.dock.plist"
  ##保存
  /usr/libexec/PlistBuddy -c "Save" "$HOME/Library/Preferences/com.apple.dock.plist"
fi
###
###反映させて
sleep 1
/usr/bin/killall cfprefsd
/bin/echo "処理終了 DOCKを再起動します"
sleep 1
/usr/bin/killall "Dock"

/bin/echo "処理終了しました"

exit 0


|

com.skype.skype.mobileconfig基本


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

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>

  <key>PayloadContent</key>
  <array>
    <dict>
      <key>DisableSkypeMeeting</key>
      <false/>

      <key>PayloadDisplayName</key>
      <string>Microsoft Outlook</string>
      <key>PayloadIdentifier</key>
      <string>com.microsoft.Outlook.FB97A090-C289-442C-A666-BF90BA43832E</string>
      <key>PayloadType</key>
      <string>com.microsoft.Outlook</string>
      <key>PayloadUUID</key>
      <string>FB97A090-C289-442C-A666-BF90BA43832E</string>
      <key>PayloadVersion</key>
      <integer>1</integer>
    </dict>
    <dict>

      <key>enable_spellchecking</key>
      <false/>
      <key>use_spelling_service</key>
      <false/>

      <key>SKAllowStealthUpgrade</key>
      <false/>
      <key>SKSilentUpgradeNoticeShown</key>
      <false/>
<!--
この値が設定されていると起動できなくなる
<key>NSTreatUnknownArgumentsAsOpen</key>
<true/>
-->
      <key>calling.enablePluginlessStackByDefault</key>
      <true/>
      <key>app.shouldSendOptionalTelemetry</key>
      <false/>

      <key>NSFullScreenMenuItemEverywhere</key>
      <true/>

      
      <key>PayloadDisplayName</key>
      <string>Skype</string>
      <key>PayloadIdentifier</key>
      <string>com.skype.skype.6DB39227-858B-4590-8E62-3DD5F96FB6AE</string>
      <key>PayloadType</key>
      <string>com.skype.skype</string>
      <key>PayloadUUID</key>
      <string>6DB39227-858B-4590-8E62-3DD5F96FB6AE</string>
      <key>PayloadVersion</key>
      <integer>1</integer>

    </dict>
  </array>
  <key>ConsentText</key>
  <dict>
    <key>default</key>
    <string>com.skype.skypeの基本設定 削除可</string>
  </dict>
  <key>HasRemovalPasscode</key>
  <false/>
  <key>PayloadDescription</key>
  <string>com.skype.skype基本設定</string>
  <key>PayloadDisplayName</key>
  <string>com.skype.skype</string>
  <key>PayloadIdentifier</key>
  <string>com.skype.skype.CD1B6F66-7FFC-403C-80A9-A968CD3B1753</string>
  <key>PayloadOrganization</key>
  <string>com.skype.skype</string>
  <key>PayloadRemovalDisallowed</key>
  <false/>
  <key>PayloadScope</key>
  <string>User</string>
  <key>PayloadType</key>
  <string>Configuration</string>
  <key>PayloadUUID</key>
  <string>481E4F3B-429F-4E57-A70A-8995CF5605DD</string>
  <key>PayloadVersion</key>
  <integer>1</integer>
  <key>TargetDeviceType</key>
  <integer>5</integer>
</dict>
</plist>


|

スカイプ バージョンチェッカ


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#com.cocolog-nifty.quicktimer.icefloe
#
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

###アプリケーションのバンドルID
set strBundleID to "com.skype.skype"

###URL
set strURL to "https://get.skype.com/go/getskype-skypeformac" as text
###コマンド実行してサーバーレスポンスからファイル名を取得する
try
  set strCommandText to ("/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' " & strURL & "") as text
  set strLocation to (do shell script strCommandText) as text
on error strErrorMes number errorNumber
return "ファイル名の取得に失敗しまし"
end try

################################################
###### インストール済みのパージョン
################################################
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
##バンドルからアプリケーションのURLを取得
set ocidAppBundle to (refMe's NSBundle's bundleWithIdentifier:(strBundleID))
if ocidAppBundle ≠ (missing value) then
  set ocidAppPathURL to ocidAppBundle's bundleURL()
else if ocidAppBundle = (missing value) then
  set ocidAppPathURL to (appSharedWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID))
end if
##予備(アプリケーションのURL)
if ocidAppPathURL = (missing value) then
  tell application "Finder"
    try
      set aliasAppApth to (application file id strBundleID) as alias
      set strAppPath to POSIX path of aliasAppApth as text
      set strAppPathStr to refMe's NSString's stringWithString:(strAppPath)
      set strAppPath to strAppPathStr's stringByStandardizingPath()
      set ocidAppPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(strAppPath) isDirectory:true
    on error
return "アプリケーションが見つかりませんでした"
    end try
  end tell
end if
set ocidFilePathURL to ocidAppPathURL's URLByAppendingPathComponent:("Contents/Info.plist")
#####PLISTの内容を読み込んで
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
set listReadPlistData to refMe's NSMutableDictionary's dictionaryWithContentsOfURL:ocidFilePathURL |error|:(reference)
set ocidPlistDict to item 1 of listReadPlistData
set ocidCfbundleversionPlist to ocidPlistDict's valueForKey:"CFBundleVersion"
log "PLIST:" & ocidCfbundleversionPlist as text
################################################
###### チェック
################################################
set strCfbundleversionPlist to ocidCfbundleversionPlist as text
log strCfbundleversionPlist

if strLocation contains strCfbundleversionPlist then
return "最新版を利用中です:" & (strCfbundleversionPlist as text) & "\r" & strLocation & "\r"
else
return "アップデートがありますインストールが必要です:\r" & strLocation & "\r"
end if

################################################
###### 置換
################################################
to doReplace(argOrignalText, argSearchText, argReplaceText)
  set strDelim to AppleScript's text item delimiters
  set AppleScript's text item delimiters to argSearchText
  set listDelim to every text item of argOrignalText
  set AppleScript's text item delimiters to argReplaceText
  set strReturn to listDelim as text
  set AppleScript's text item delimiters to strDelim
return strReturn
end doReplace


|

[Skype]ツールv1

ダウンロード - skype.zip

|

[Skype]キャッシュクリア


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set appFileManager to refMe's NSFileManager's defaultManager()

###################################
########まずは処理するアプリケーションを終了させる
###################################
doQuitApp2UTI("com.skype.skype")


###################################
######## Application Supportフォルダー
###################################
# log doMoveToTrash("~/Library/Application Support/Skype")
log doMoveToTrash("~/Library/Application Support/Microsoft/Skype for Desktop/Cache")
log doMoveToTrash("~/Library/Application Support/Microsoft/Skype for Desktop/Code Cache")
log doMoveToTrash("~/Library/Application Support/Microsoft/Skype for Desktop/Crashpad")
log doMoveToTrash("~/Library/Application Support/Microsoft/Skype for Desktop/GPUCache")
log doMoveToTrash("~/Library/Application Support/Microsoft/Skype for Desktop/ecscache.json")
log doMoveToTrash("~/Library/Application Support/Microsoft/Skype for Desktop/logs")
log doMoveToTrash("~/Library/Application Support/Microsoft/Skype for Desktop/skylib")


###################################
########LOGS
###################################
log doMoveToTrash("~/Library/Logs/Skype")
log doMoveToTrash("~/Library/Logs/Skype Helper (GPU)")
log doMoveToTrash("~/Library/Logs/Skype Helper (Renderer)")

###################################
########Saved Application State
###################################
log doMoveToTrash("~/Library/Saved Application State/com.skype.skype.savedState")

###################################
########キャッシュ
###################################

log doMoveToTrash("~/Library/Caches/Skype")
log doMoveToTrash("~/Library/Caches/com.skype.skype")
log doMoveToTrash("~/Library/Caches/com.skype.skype.ShipIt")

###################################
########HTTPStorages
###################################

log doMoveToTrash("~/Library/HTTPStorages/com.skype.skype")

###################################
########Saved Application State
###################################

log doMoveToTrash("~/Library/WebKit/com.skype.skype")

###################################
########キャッシュNSTemporaryDirectory
###################################
### T
set ocidTempDir to (refMe's NSTemporaryDirectory())
set ocidTemporaryTPathURL to refMe's NSURL's fileURLWithPath:(ocidTempDir)
log doMoveToTrash(ocidTemporaryTPathURL's URLByAppendingPathComponent:"com.skype.skype")
log doMoveToTrash(ocidTemporaryTPathURL's URLByAppendingPathComponent:"com.skype.skype.Helper-(GPU)")
log doMoveToTrash(ocidTemporaryTPathURL's URLByAppendingPathComponent:"com.skype.skype.Helper-(Renderer)")
###
set ocidTempURL to ocidTemporaryTPathURL's URLByDeletingLastPathComponent()
### C
set ocidTemporaryCPathURL to ocidTempURL's URLByAppendingPathComponent:"C"

log doMoveToTrash(ocidTemporaryCPathURL's URLByAppendingPathComponent:"com.skype.skype")
log doMoveToTrash(ocidTemporaryCPathURL's URLByAppendingPathComponent:"com.skype.skype.Helper-(GPU)")
log doMoveToTrash(ocidTemporaryCPathURL's URLByAppendingPathComponent:"com.skype.skype.Helper-(Renderer)")




###################################
########処理 ゴミ箱に入れる
###################################

to doMoveToTrash(argFilePath)
  ###ファイルマネジャー初期化
  set appFileManager to refMe's NSFileManager's defaultManager()
  #########################################
  ###渡された値のClassを調べてとりあえずNSURLにする
  set refClass to class of argFilePath
  if refClass is list then
return "エラー:リストは処理しません"
  else if refClass is text then
    log "テキストパスです"
    set ocidArgFilePathStr to (refMe's NSString's stringWithString:argFilePath)
    set ocidArgFilePath to ocidArgFilePathStr's stringByStandardizingPath
    set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
  else if refClass is alias then
    log "エイリアスパスです"
    set strArgFilePath to (POSIX path of argFilePath) as text
    set ocidArgFilePathStr to (refMe's NSString's stringWithString:strArgFilePath)
    set ocidArgFilePath to ocidArgFilePathStr's stringByStandardizingPath
    set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
  else
    set refClass to (className() of argFilePath) as text
    if refClass contains "NSPathStore2" then
      log "NSPathStore2です"
      set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:argFilePath)
    else if refClass contains "NSCFString" then
      log "NSCFStringです"
      set ocidArgFilePath to argFilePath's stringByStandardizingPath
      set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
    else if refClass contains "NSURL" then
      set ocidArgFilePathURL to argFilePath
      log "NSURLです"
    end if
  end if
  #########################################
  ###
  -->false
  set ocidFalse to (refMe's NSNumber's numberWithBool:false)'s boolValue
  -->true
  set ocidTrue to (refMe's NSNumber's numberWithBool:true)'s boolValue
  #########################################
  ###NSURLがエイリアス実在するか?
  set ocidArgFilePath to ocidArgFilePathURL's |path|()
  set boolFileAlias to appFileManager's fileExistsAtPath:(ocidArgFilePath)
  ###パス先が実在しないなら処理はここまで
  if boolFileAlias = false then
    log ocidArgFilePath as text
    log "処理中止 パス先が実在しない"
return false
  end if
  #########################################
  ###NSURLがディレクトリなのか?ファイルなのか?
  set listBoolDir to ocidArgFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error|:(reference)
  # log (item 1 of listBoolDir)
  # log (item 2 of listBoolDir)
  # log (item 3 of listBoolDir)
  if (item 2 of listBoolDir) = ocidTrue then
    #########################################
    log "ディレクトリです"
    log ocidArgFilePathURL's |path| as text
    ##内包リスト
    set listResult to appFileManager's contentsOfDirectoryAtURL:ocidArgFilePathURL includingPropertiesForKeys:{refMe's NSURLPathKey} options:0 |error|:(reference)
    ###結果
    set ocidContentsPathURLArray to item 1 of listResult
    ###リストの数だけ繰り返し
    repeat with itemContentsPathURL in ocidContentsPathURLArray
      ###ゴミ箱に入れる
      set listResult to (appFileManager's trashItemAtURL:itemContentsPathURL resultingItemURL:(missing value) |error|:(reference))
    end repeat
  else
    #########################################
    log "ファイルです"
    set listBoolDir to ocidArgFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsAliasFileKey) |error|:(reference)
    if (item 2 of listBoolDir) = ocidTrue then
      log "エイリアスは処理しません"
return false
    end if
    set listBoolDir to ocidArgFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsSymbolicLinkKey) |error|:(reference)
    if (item 2 of listBoolDir) = ocidTrue then
      log "シンボリックリンクは処理しません"
return false
    end if
    set listBoolDir to ocidArgFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsSystemImmutableKey) |error|:(reference)
    if (item 2 of listBoolDir) = ocidTrue then
      log "システムファイルは処理しません"
return false
    end if
    ###ファイルをゴミ箱に入れる
    set listResult to (appFileManager's trashItemAtURL:ocidArgFilePathURL resultingItemURL:(missing value) |error|:(reference))
  end if
return true
end doMoveToTrash

###################################
########アプリケーションを終了させる
###################################
to doQuitApp2UTI(argUTI)
  set strUTI to argUTI as text
  ### まずは普通に終了を試みる
  tell application id strUTI to quit
  delay 2
  set ocidResultsArray to refMe's NSRunningApplication's runningApplicationsWithBundleIdentifier:strUTI
  set numCntArray to ocidResultsArray count
  if numCntArray ≠ 0 then
    set ocidRunApp to ocidResultsArray's objectAtIndex:0
    
    ###通常終了
    set boolDone to ocidRunApp's terminate()
    ####強制終了
    set boolDone to ocidRunApp's forceTerminate()
    
    #### killallを使う場合
    set ocidExecAppURL to ocidRunApp's executableURL()
    set ocidFileName to ocidExecAppURL's lastPathComponent()
    set strFileName to ocidFileName as text
    
    set strCommandText to ("/usr/bin/killall -z " & strFileName & "") as text
    set ocidCommandText to refMe's NSString's stringWithString:strCommandText
    set ocidTermTask to refMe's NSTask's alloc()'s init()
ocidTermTask's setLaunchPath:"/bin/zsh"
ocidTermTask's setArguments:({"-c", ocidCommandText})
    set listDoneReturn to ocidTermTask's launchAndReturnError:(reference)
    
    
    ####killを使う場合
    set ocidPID to ocidRunApp's processIdentifier()
    set strPID to ocidPID as text
    log strPID
    set strCommandText to ("/bin/kill -9 " & strPID & "") as text
    set ocidCommandText to refMe's NSString's stringWithString:strCommandText
    set ocidTermTask to refMe's NSTask's alloc()'s init()
ocidTermTask's setLaunchPath:"/bin/zsh"
ocidTermTask's setArguments:({"-c", ocidCommandText})
    set listDoneReturn to ocidTermTask's launchAndReturnError:(reference)
    
    
  end if
end doQuitApp2UTI



|

[BASH]Skypeユーザーアップデート(カレントユーザーのみ)


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

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
########################################
##OS
PLIST_PATH="/System/Library/CoreServices/SystemVersion.plist"
STR_OS_VER=$(/usr/bin/defaults read "$PLIST_PATH" ProductVersion)
/bin/echo "OS VERSION :" "$STR_OS_VER"
STR_MAJOR_VERSION="${STR_OS_VER%%.*}"
/bin/echo "STR_MAJOR_VERSION :" "$STR_MAJOR_VERSION"
STR_MINOR_VERSION="${STR_OS_VER#*.}"
/bin/echo "STR_MINOR_VERSION :" "$STR_MINOR_VERSION"

########################################
##ユーザー
USER_WHOAMI=$(/usr/bin/whoami)
/bin/echo "実行したユーザーは:$USER_WHOAMI"
CURRENT_USER=$(/bin/echo "$HOME" | /usr/bin/awk -F'/' '{print $NF}')
/bin/echo "実行ユーザー:" "$CURRENT_USER"

########################################
##デバイス
USER_TEMP_DIR=$(/usr/bin/mktemp -d)
/bin/echo "起動時に削除されるディレクトリ:" "$USER_TEMP_DIR"
#起動ディスクの名前を取得する
/usr/bin/touch "$USER_TEMP_DIR/diskutil.plist"
/usr/sbin/diskutil info -plist / >"$USER_TEMP_DIR/diskutil.plist"
STARTUPDISK_NAME=$(/usr/bin/defaults read "$USER_TEMP_DIR/diskutil.plist" VolumeName)
/bin/echo "ボリューム名:" "$STARTUPDISK_NAME"

########################################
###ダウンロード起動時に削除する項目

###CPUタイプでの分岐
ARCHITEC=$(/usr/bin/arch)
/bin/echo "Running on $ARCHITEC"
if [ "$ARCHITEC" == "arm64" ]; then
  ###ARM用のダウンロードURL
  STR_URL="https://go.skype.com/mac.download"
  ###ファイル名を取得
  DL_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "DL_FILE_NAME:$DL_FILE_NAME"
  ###ダウンロード
  if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1で再トライします"
    if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20; then
      /bin/echo "ファイルのダウンロードに失敗しました"
      exit 1
    fi
  fi
else
  ###INTEL用のダウンロードURL
  STR_URL="https://go.skype.com/mac.download"
  ###ファイル名を取得
  DL_FILE_NAME=$(/usr/bin/curl -s -L -I -o /dev/null -w '%{url_effective}' "$STR_URL" | /usr/bin/rev | /usr/bin/cut -d'/' -f1 | /usr/bin/rev)
  /bin/echo "DL_FILE_NAME:$DL_FILE_NAME"
  ###ダウンロード
  if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --connect-timeout 20; then
    /bin/echo "ファイルのダウンロードに失敗しました HTTP1.1で再トライします"
    if ! /usr/bin/curl -L -o "$USER_TEMP_DIR/$DL_FILE_NAME" "$STR_URL" --http1.1 --connect-timeout 20; then
      /bin/echo "ファイルのダウンロードに失敗しました"
      exit 1
    fi
  fi
fi
##全ユーザー実行可能にしておく
/bin/chmod 755 "$USER_TEMP_DIR/$DL_FILE_NAME"
/bin/echo "ダウンロードOK"

########################################
###アプリケーションの終了
###コンソールユーザーにのみ処理する
CONSOLE_USER=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/ { print $3 }')
/bin/echo "CONSOLE_USER:$CONSOLE_USER"
if [ -z "$CONSOLE_USER" ]; then
  /bin/echo "コンソールユーザーが無い=電源入れてログインウィンドウ状態"
else
  #####OSAスクリプトはエラーすることも多い(初回インストール時はエラーになる)
  if ! /usr/bin/osascript -e "tell application id \"com.skype.skype\" to quit"; then
    ##念の為 KILLもする
    /usr/bin/killall "Skype" 2>/dev/null
    /usr/bin/killall "Skype Helper" 2>/dev/null
    /usr/bin/killall "Skype Helper (GPU)" 2>/dev/null
    /usr/bin/killall "Skype Helper (Renderer)" 2>/dev/null
  fi
fi
/bin/sleep 2

############################################################
##基本メンテナンス

##ライブラリの不可視属性を解除
/usr/bin/chflags nohidden "/Users/$CURRENT_USER/Library"
/usr/bin/SetFile -a v "/Users/$CURRENT_USER/Library"
##ユーザーアプリケーションフォルダを作る
/bin/mkdir -p "/Users/$CURRENT_USER/Applications"
/bin/chmod 700 "/Users/$CURRENT_USER/Applications"
/usr/sbin/chown "$CURRENT_USER" "/Users/$CURRENT_USER/Applications"
/usr/bin/touch "/Users/$CURRENT_USER/Applications/.localized"
##ユーザーユーティリティフォルダを作る
/bin/mkdir -p "/Users/$CURRENT_USER/Applications/Utilities"
/bin/chmod 755 "/Users/$CURRENT_USER/Applications/Utilities"
/usr/sbin/chown "$CURRENT_USER" "/Users/$CURRENT_USER/Applications/Utilities"
/usr/bin/touch "/Users/$CURRENT_USER/Applications/Utilities/.localized"
## Managed Itemsフォルダを作る
/bin/mkdir -p "/Users/$CURRENT_USER/Library/Managed Items"
/bin/chmod 755 "/Users/$CURRENT_USER/Library/Managed Items"
/usr/sbin/chown "$CURRENT_USER" "/Users/$CURRENT_USER/Library/Managed Items"
/usr/bin/touch "/Users/$CURRENT_USER/Library/Managed Items/.localized"
##アクセス権チェック
/bin/chmod 700 "/Users/$CURRENT_USER/Library"
/bin/chmod 700 "/Users/$CURRENT_USER/Movies"
/bin/chmod 700 /"Users/$CURRENT_USER/Music"
/bin/chmod 700 "/Users/$CURRENT_USER/Pictures"
/bin/chmod 700 "/Users/$CURRENT_USER/Downloads"
/bin/chmod 700 "/Users/$CURRENT_USER/Documents"
/bin/chmod 700 "/Users/$CURRENT_USER/Desktop"
##全ローカルユーザーに対して実施したい処理があれば追加する
/bin/echo "ユーザーディレクトリチェックDONE"

############################################################
#####古いファイルをゴミ箱に USER
function DO_MOVE_TO_TRASH() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "/Users/$CURRENT_USER/.Trash/SKYPE.XXXXXXXX")
    /bin/chmod 777 "$TRASH_DIR"
    /bin/mv "$1" "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に USER
DO_MOVE_TO_TRASH "/Applications/Skype.app"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Applications/Skype.app"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Caches/com.skype.skype"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Caches/com.skype.skype.ShipIt"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/Cache"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/Code Cache"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/Crashpad"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/GPUCache"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Application Support/Microsoft/Skype for Desktop/logs"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/HTTPStorages/com.skype.skype"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Logs/Skype Helper (Renderer)"
DO_MOVE_TO_TRASH "/Users/$CURRENT_USER/Library/Saved Application State/com.skype.skype.savedState"

/bin/echo "ユーザーキャッシュ削除DONE"
############################################################
###/var/folde T
MKTEMP_DIR=$(/usr/bin/mktemp -d)
TEMP_DIR_T="$(/usr/bin/dirname "$MKTEMP_DIR")"
function DO_MOVE_TO_TRASH_T() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "/Users/$CURRENT_USER/.Trash/SKYPE.T.XXXXXXXX")
    /bin/chmod 777 "$TRASH_DIR"
    /bin/mv "$1" "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype"
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype Helper"
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype Helper (GPU)"
DO_MOVE_TO_TRASH_T "$TEMP_DIR_T/Skype Helper (Renderer)"

/bin/echo "ユーザーキャッシュT DONE"
############################################################
###/var/folder C
TEMP_DIR="$(/usr/bin/dirname "$TEMP_DIR_T")"
TEMP_DIR_C="${TEMP_DIR}/C"
function DO_MOVE_TO_TRASH_C() {
  if [ -e "$1" ]; then
    TRASH_DIR=$(/usr/bin/mktemp -d "/Users/$CURRENT_USER/.Trash/SKYPE.C.XXXXXXXX")
    /bin/chmod 777 "$TRASH_DIR"
    /bin/mv "$1" "$TRASH_DIR"
  fi
}
#####古いファイルをゴミ箱に
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype"
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype.Helper"
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype.Helper-(GPU)"
DO_MOVE_TO_TRASH_C "$TEMP_DIR_C/com.skype.skype.Helper-(Renderer)"
/bin/echo "ユーザーキャッシュ C DONE"

############################################################
######### DITTOコピーインストール
/bin/echo "インストール開始:DITTO:" "$CURRENT_USER"
###ディスクをマウント
/usr/bin/hdiutil attach "$USER_TEMP_DIR/$DL_FILE_NAME" -noverify -nobrowse -noautoopen
sleep 2
####コピーして
/usr/bin/ditto "/Volumes/Skype/Skype.app" "/Users/$CURRENT_USER/Applications/Skype.app"
sleep 2
###ディスクをアンマウント
/usr/bin/hdiutil detach /Volumes/Skype -force
###Dockに追加して
/usr/bin/defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$HOME/Applications/Skype.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
###反映させて
/usr/bin/killall cfprefsd
###Dockを再起動
/usr/bin/killall Dock

exit 0


|

[com.microsoft.office]バージョンチェッカー


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
com.cocolog-nifty.quicktimer.icefloe
*)
#
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application


set strURL to "https://macadmins.software/latest.xml" as text

set coidBaseURLStr to refMe's NSString's stringWithString:(strURL)
set ocidBaseURL to refMe's NSURL's URLWithString:(coidBaseURLStr)

################################################
###### URLRequest部分
################################################
set ocidURLRequest to refMe's NSMutableURLRequest's alloc()'s init()
ocidURLRequest's setHTTPMethod:"GET"
ocidURLRequest's setURL:(ocidBaseURL)
ocidURLRequest's addValue:"application/xml" forHTTPHeaderField:"Content-Type"
###ポストするデータは空
ocidURLRequest's setHTTPBody:(missing value)

################################################
###### データ取得
################################################
set ocidServerResponse to refMe's NSURLConnection's sendSynchronousRequest:(ocidURLRequest) returningResponse:(missing value) |error|:(reference)
###取得
set ocidXMLData to (item 1 of ocidServerResponse)
set listXMLDoc to refMe's NSXMLDocument's alloc()'s initWithData:ocidXMLData options:(refMe's NSXMLDocumentTidyXML) |error|:(reference)

set ocidXMLDoc to item 1 of listXMLDoc
set ocidRootElement to ocidXMLDoc's rootElement()

################################################
###### o365バージョン取得
################################################
repeat with itemRootElement in ocidRootElement's children()
  set strName to itemRootElement's |name|() as text
  if strName is "o365" then
    set ocido365ver to (ocidRootElement's childAtIndex:0)'s stringValue()
  end if
end repeat
#######
log ocido365ver as text

################################################
###### 各アプリケーションのUTI取得
################################################
set ocidPackageArray to ocidRootElement's elementsForName:"package"
repeat with itemackageArray in ocidPackageArray
  set ocidElementID to (itemackageArray's childAtIndex:0)'s stringValue()
  log ocidElementID as text
  (*
com.microsoft.office.suite.365
com.microsoft.office.suite.365.businesspro
com.microsoft.word.standalone.365
com.microsoft.excel.standalone.365
com.microsoft.powerpoint.standalone.365
com.microsoft.outlook.standalone.365
com.microsoft.outlook.standalone.365.monthly
com.microsoft.onenote.standalone.365
com.microsoft.onedrive.standalone
com.microsoft.skypeforbusiness.standalone
com.microsoft.teams.standalone
com.microsoft.intunecompanyportal.standalone
com.microsoft.edge
com.microsoft.defender.standalone
com.microsoft.remotedesktop.standalone
com.microsoft.vscode.zip
com.microsoft.autoupdate.standalone
*)
end repeat


################################################
###### 最新のバージョン
################################################
set ocidPackageArray to ocidRootElement's elementsForName:"package"
repeat with itemackageArray in ocidPackageArray
  set ocidElementID to (itemackageArray's childAtIndex:0)'s stringValue()
  if (ocidElementID as text) is "com.microsoft.teams.standalone" then
    set ocidCfbundleversionXML to (itemackageArray's childAtIndex:8)'s stringValue()
  end if
end repeat
log "XML:" & ocidCfbundleversionXML as text
################################################
###### インストール済みのパージョン
################################################
set strPlistPath to "/Applications/Microsoft Teams.app/Contents/Info.plist" as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strPlistPath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
#####PLISTの内容を読み込んで
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
set listReadPlistData to refMe's NSMutableDictionary's dictionaryWithContentsOfURL:ocidFilePathURL |error|:(reference)
set ocidPlistDict to item 1 of listReadPlistData
set ocidCfbundleversionPlist to ocidPlistDict's valueForKey:"CFBundleVersion"
log "PLIST:" & ocidCfbundleversionPlist as text
################################################
###### チェック
################################################
if ocidCfbundleversionPlist is ocidCfbundleversionXML then
return "インストールが必要です"
else
return "最新版を利用中です"
end if



|

スカイプアップデート

ダウンロード - スカイプアップデート.zip


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#キャッシュをゴミ箱に入れた後で
#最新版をコピーします
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions


property refMe : a reference to current application

set appFileManager to refMe's NSFileManager's defaultManager()

###対象のアプリケーションのUTI
set strUTI to "com.skype.skype" as text


###################################
#まずは処理するアプリケーションを終了させる
###################################
doQuitApp2UTI("com.skype.skype")

###################################
#UTIからアプリケーションのインストール先を求める
###################################

set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:strUTI
if ocidAppBundle is missing value then
  set appNSWorkspace to refMe's NSWorkspace's sharedWorkspace()
  set ocidAppBundlePathURL to (appNSWorkspace's URLForApplicationWithBundleIdentifier:strUTI)
else
  set ocidAppBundleStr to ocidAppBundle's bundlePath()
  set ocidAppBundlePath to ocidAppBundleStr's stringByStandardizingPath
  set ocidAppBundlePathURL to (refMe's NSURL's fileURLWithPath:ocidAppBundlePath)
end if
###################################
#アプリケーションをゴミ箱に
###################################
if ocidAppBundlePathURL is missing value then
  log "アプリケーションが見つかりません"
else
  set listResult to (appFileManager's trashItemAtURL:ocidAppBundlePathURL resultingItemURL:(missing value) |error|:(reference))
end if


###################################
########キャッシュを削除する
###################################
set ocidUserLibraryPath to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
###LibraryフォルダURL
set ocidLibraryPathURL to ocidUserLibraryPath's firstObject()

################################
####Caches
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Caches/com.skype.skype.ShipIt"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)

###com.apple.dt.Xcode
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Caches/com.skype.skype"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)

################################
####LOG
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Logs/Skype Helper (Renderer)"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)


#############################################
#########ユーザーApplicationSupport
#############################################
set ocidUserApplicationSupportPath to (appFileManager's URLsForDirectory:(refMe's NSApplicationSupportDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidUserApplicationSupportPathURL to ocidUserApplicationSupportPath's objectAtIndex:0

#################################
###Microsof
set ocidMicrosoftDirURL to ocidUserApplicationSupportPathURL's URLByAppendingPathComponent:"Microsoft"

set ocidChkDirURL to ocidMicrosoftDirURL's URLByAppendingPathComponent:"Skype for Desktop/Cache/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidMicrosoftDirURL's URLByAppendingPathComponent:"Skype for Desktop/GPUCache/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidMicrosoftDirURL's URLByAppendingPathComponent:"Skype for Desktop/Code Cache/"
doGo2TrashDirContentsURL(ocidChkDirURL)

###きっちりやる時はこちらも
set ocidChkDirURL to ocidMicrosoftDirURL's URLByAppendingPathComponent:"Skype for Desktop/Partitions/"
doGo2TrashDirContentsURL(ocidChkDirURL)

#################################
###テンポラリ
set ocidTempDirPathURL to appFileManager's temporaryDirectory()
set ocidChkDirURL to ocidTempDirPathURL's URLByAppendingPathComponent:"Skype/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidTempDirPathURL's URLByAppendingPathComponent:"Skype Helper/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidTempDirPathURL's URLByAppendingPathComponent:"Skype Helper (GPU)/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidTempDirPathURL's URLByAppendingPathComponent:"Skype Helper (Renderer)/"
doGo2TrashDirContentsURL(ocidChkDirURL)

#################################
###テンポラリキャッシュ
set ocidContainerDirURL to ocidTempDirPathURL's URLByDeletingLastPathComponent()
set ocidChkDirURL to ocidContainerDirURL's URLByAppendingPathComponent:"C/com.skype.skype/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidContainerDirURL's URLByAppendingPathComponent:"C/com.skype.skype.Helper/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidContainerDirURL's URLByAppendingPathComponent:"C/com.skype.skype.Helper-(GPU)/"
doGo2TrashDirContentsURL(ocidChkDirURL)
set ocidChkDirURL to ocidContainerDirURL's URLByAppendingPathComponent:"C/com.skype.skype.Helper-(Renderer)/"
doGo2TrashDirContentsURL(ocidChkDirURL)




############################################
##ユーザードメインにアプリケーションフォルダを作る
set ocidUserAllApplicationsPath to (appFileManager's URLsForDirectory:(refMe's NSAllApplicationsDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidUserAllApplicationsDir to ocidUserAllApplicationsPath's firstObject()
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
set numPermissionDem to doOct2Dem(700) as integer
ocidAttrDict's setValue:numPermissionDem forKey:(refMe's NSFilePosixPermissions)
############################
###フォルダを作る
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidUserAllApplicationsDir) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
############################
###localizedを作成
set ocidLocalizedDirPathURL to ocidUserAllApplicationsDir's URLByAppendingPathComponent:".localized" isDirectory:false
set ocidLocalizedDirPath to ocidLocalizedDirPathURL's |path|()
####空のファイルを作成する
set ocidBlankData to refMe's NSData's alloc()'s init()
set ocidAttrFile to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrFile's setValue:493 forKey:(refMe's NSFilePosixPermissions)
set boolMakeNewFile to appFileManager's createFileAtPath:ocidLocalizedDirPath |contents|:ocidBlankData attributes:ocidAttrFile

###################################
##本処理
###################################
set strDateno to doGetDateNo("yyyyMMDDhhmmss")


set strCommandText to ("/bin/mkdir -p /tmp/" & strDateno & "") as text
do shell script strCommandText

set strCommandText to ("/usr/bin/curl -L -o \"/tmp/" & strDateno & "/Skype.dmg\" \"https://go.skype.com/mac.download\" --connect-timeout 10; ") as text
do shell script strCommandText

set strCommandText to ("/usr/bin/hdiutil attach  /tmp/" & strDateno & "/Skype.dmg -noverify -nobrowse -noautoopen") as text
do shell script strCommandText

set strCommandText to ("/usr/bin/ditto \"/Volumes/Skype/Skype.app\" $HOME/Applications/Skype.app") as text
do shell script strCommandText


set strCommandText to ("/usr/bin/hdiutil detach /Volumes/Skype -force") as text
do shell script strCommandText

###################################
##Dockにアプリを登録する
###################################
set strAppFilePath to (do shell script "/bin/echo $HOME/Applications/Skype.app") as text

tell application "Finder"
  set aliasPathToMe to path to me as alias
  set aliasContainerDir to container of aliasPathToMe as alias
end tell

set strContainerDirPath to POSIX path of aliasContainerDir as text
set strBinPath to (strContainerDirPath & "bin/dockutil") as text

set strCommandText to ("\"" & strBinPath & "\" --add \"" & strAppFilePath & "\"") as text
do shell script strCommandText


###################################
########ディレクトリの中身をゴミ箱へ
###################################
on doGo2TrashDirContentsURL(ocidDirUrl)
  ###ファイルマネージャー初期化
  set appFileManager to refMe's NSFileManager's defaultManager()
  ################################
  ####渡された値がNSURL以外の場合の処理
  try
    set strClassName to class of ocidDirUrl as text
    ####渡された値がテキストだったら
    if strClassName is "text" then
      set strDirUrl to ocidDirUrl as text
      ####渡された値がエイリアスだったら
    else if strClassName is "alias" then
      set strDirPath to POSIX path of ocidDirUrl as text
    end if
    set ocidFilePath to (refMe's NSString's stringWithString:strDirPath)
    set ocidFilePathString to ocidFilePath's stringByStandardizingPath
    set ocidDirPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePathString isDirectory:true)
  on error
    ######ocid形式の値だったら
    set strClassName to ocidDirUrl's className() as text
    ###テキストなら
    if strClassName contains "NSCFString" then
      set ocidFilePathString to ocidDirUrl's stringByStandardizingPath
      set ocidDirPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePathString isDirectory:true)
      ###NSURLなら
    else if strClassName is "NSURL" then
      set ocidDirPathURL to ocidDirUrl
    else
      error "NSURLを指定してください" number -9999
      return
    end if
  end try
  ################################
  ####渡されたパスが無い場合はエラー
  set ocidFilePathString to ocidDirPathURL's |path|()
  set boolFolderExists to (appFileManager's fileExistsAtPath:ocidFilePathString isDirectory:true)
  if boolFolderExists is false then
    log "パス先が実在しません"
    ####パス先ない場合は作っておく
    set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
    ocidAttrDict's setValue:511 forKey:(refMe's NSFilePosixPermissions)
    set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
    return
  end if
  ################################
  ####ディレクトリか?の判断 ファイルならエラーで止める 
  set ocidResultArray to ocidDirPathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error|:(reference)
  if (item 3 of ocidResultArray) is not (missing value) then
    doGetErrorData(ocidNSErrorData)
  end if
  set ocidResultValue to item 2 of ocidResultArray
  -->false
  set ocidFalse to (refMe's NSNumber's numberWithBool:false)'s boolValue
  if ocidResultValue is ocidFalse then
    ##error "パス先がファイルですディレクトリを指定してください" number -9999
    log "パス先がファイルですディレクトリを指定してください"
    return
  end if
  ##################################
  ##内包リスト
  set listResult to appFileManager's contentsOfDirectoryAtURL:ocidDirPathURL includingPropertiesForKeys:{refMe's NSURLPathKey} options:0 |error|:(reference)
  ###エラー発生時
  if (item 2 of listResult) is not (missing value) then
    doGetErrorData(item 2 of listResult)
  end if
  
  ###結果
  set ocidPathArray to item 1 of listResult
  repeat with itemPathArray in ocidPathArray
    set ocidPathArrayURL to itemPathArray
    ##ゴミ箱に入れる
    set listResult to (appFileManager's trashItemAtURL:ocidPathArrayURL resultingItemURL:(missing value) |error|:(reference))
    ###エラー発生時
    if (item 2 of listResult) is not (missing value) then
      doGetErrorData(item 2 of listResult)
    end if
  end repeat
end doGo2TrashDirContentsURL


###################################
########ディレクトリの中身をゴミ箱へ サブパス指定式
###################################

to doChkDirSubPath2Trash(argChkURL, argSubPathText)
  ###ファイルマネージャー初期化
  set appFileManager to refMe's NSFileManager's defaultManager()
  ##内包リスト
  set listResult to appFileManager's contentsOfDirectoryAtURL:argChkURL includingPropertiesForKeys:{refMe's NSURLPathKey} options:0 |error|:(reference)
  ###結果
  set ocidPathArray to item 1 of listResult
  ####リストの数だけ
  repeat with itemPathArrayURL in ocidPathArray
    set ocidChkURL to (itemPathArrayURL's URLByAppendingPathComponent:argSubPathText)
    ####渡されたパスが無い場合はエラー
    set ocidFilePathString to ocidChkURL's |path|()
    set boolFolderExists to (appFileManager's fileExistsAtPath:ocidFilePathString isDirectory:true)
    if boolFolderExists is false then
      log "パス先が実在しません:\n" & (ocidFilePathString as text)
    else
      log "処理する"
      set listSubPathResult to (appFileManager's contentsOfDirectoryAtURL:ocidChkURL includingPropertiesForKeys:{refMe's NSURLPathKey} options:0 |error|:(reference))
      set ocidSubPathArray to item 1 of listSubPathResult
      repeat with itemSubPathArray in ocidSubPathArray
        set ocidItemPathArrayURL to itemSubPathArray
        ##ゴミ箱に入れる
        set listResult to (appFileManager's trashItemAtURL:ocidItemPathArrayURL resultingItemURL:(missing value) |error|:(reference))
      end repeat
      
    end if
    
  end repeat
  
end doChkDirSubPath2Trash



###################################
########アプリケーションを終了させる
###################################
to doQuitApp2UTI(argUTI)
  set strUTI to argUTI as text
  set ocidResultsArray to refMe's NSRunningApplication's runningApplicationsWithBundleIdentifier:strUTI
  set numCntArray to ocidResultsArray count
  if numCntArray ≠ 0 then
    set ocidRunApp to ocidResultsArray's objectAtIndex:0
    
    ###通常終了
    set boolDone to ocidRunApp's terminate()
    ####強制終了
    set boolDone to ocidRunApp's forceTerminate()
    
    #### killallを使う場合
    set ocidExecAppURL to ocidRunApp's executableURL()
    set ocidFileName to ocidExecAppURL's lastPathComponent()
    set strFileName to ocidFileName as text
    
    set strCommandText to ("/usr/bin/killall -z " & strFileName & "") as text
    set ocidCommandText to refMe's NSString's stringWithString:strCommandText
    set ocidTermTask to refMe's NSTask's alloc()'s init()
    ocidTermTask's setLaunchPath:"/bin/zsh"
    ocidTermTask's setArguments:({"-c", ocidCommandText})
    set listDoneReturn to ocidTermTask's launchAndReturnError:(reference)
    
    
    ####killを使う場合
    set ocidPID to ocidRunApp's processIdentifier()
    set strPID to ocidPID as text
    log strPID
    set strCommandText to ("/bin/kill -9 " & strPID & "") as text
    set ocidCommandText to refMe's NSString's stringWithString:strCommandText
    set ocidTermTask to refMe's NSTask's alloc()'s init()
    ocidTermTask's setLaunchPath:"/bin/zsh"
    ocidTermTask's setArguments:({"-c", ocidCommandText})
    set listDoneReturn to ocidTermTask's launchAndReturnError:(reference)
    
    
  end if
end doQuitApp2UTI


###################################
########エラー処理
###################################

to doGetErrorData(ocidNSErrorData)
  #####個別のエラー情報
  log "エラーコード:" & ocidNSErrorData's code() as text
  log "エラードメイン:" & ocidNSErrorData's domain() as text
  log "Description:" & ocidNSErrorData's localizedDescription() as text
  log "FailureReason:" & ocidNSErrorData's localizedFailureReason() as text
  log ocidNSErrorData's localizedRecoverySuggestion() as text
  log ocidNSErrorData's localizedRecoveryOptions() as text
  log ocidNSErrorData's recoveryAttempter() as text
  log ocidNSErrorData's helpAnchor() as text
  set ocidNSErrorUserInfo to ocidNSErrorData's userInfo()
  set ocidAllValues to ocidNSErrorUserInfo's allValues() as list
  set ocidAllKeys to ocidNSErrorUserInfo's allKeys() as list
  repeat with ocidKeys in ocidAllKeys
    if (ocidKeys as text) is "NSUnderlyingError" then
      log (ocidNSErrorUserInfo's valueForKey:ocidKeys)'s localizedDescription() as text
      log (ocidNSErrorUserInfo's valueForKey:ocidKeys)'s localizedFailureReason() as text
      log (ocidNSErrorUserInfo's valueForKey:ocidKeys)'s localizedRecoverySuggestion() as text
      log (ocidNSErrorUserInfo's valueForKey:ocidKeys)'s localizedRecoveryOptions() as text
      log (ocidNSErrorUserInfo's valueForKey:ocidKeys)'s recoveryAttempter() as text
      log (ocidNSErrorUserInfo's valueForKey:ocidKeys)'s helpAnchor() as text
    else
      ####それ以外の値はそのままテキストで読める
      log (ocidKeys as text) & ": " & (ocidNSErrorUserInfo's valueForKey:ocidKeys) as text
    end if
  end repeat
  
end doGetErrorData
###################################
#####パーミッション 8進→10進
(*
###主要なモード NSFilePosixPermissions
777-->511
775-->509
770-->504
755-->493
750-->488
700-->448
555-->365
333-->219
*)
###################################

to doOct2Dem(argOctNo)
  set strOctalText to argOctNo as text
  set num3Line to first item of strOctalText as number
  set num2Line to 2nd item of strOctalText as number
  set num1Line to last item of strOctalText as number
  set numDecimal to (num3Line * 64) + (num2Line * 8) + (num1Line * 1)
  return numDecimal as integer
end doOct2Dem




to doGetDateNo(strDateFormat)
  ####日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義
  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
  ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
  ocidNSDateFormatter's setDateFormat:strDateFormat
  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
  set strDateAndTime to ocidDateAndTime as text
  return strDateAndTime
end doGetDateNo

|

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom