Admin Device Management

TB Default Item Identifiers(com.apple.finder.plist)

昔からあって専用のアイコンが用意されているのは4つ(他にもあるかも?ですが) Screen_2

<key>TB Default Item Identifiers</key>
<array>
戻る/進む <string>com.apple.finder.BACK</string>
ビュー <string>com.apple.finder.SWCH</string>
個別 <string>com.apple.finder.loc </string>
情報 <string>com.apple.finder.INFO</string>
ゴミ箱 <string>com.apple.finder.TRSH</string>
検索 <string>com.apple.finder.SRCH</string>
新規フォルダ <string>com.apple.finder.NFLD</string>
プロパティパネル <string>com.apple.finder.PTGL</string>
アクション <string>com.apple.finder.ACTN</string>
クイックルック <string>com.apple.finder.QUIK</string>

エアードロップ <string>com.apple.finder.AirD</string>
クラウド <string>com.apple.finder.AddP</string>
ホーム <string>com.apple.finder.HOME</string>
アプリケーション <string>com.apple.finder.APPS</string>
パス <string>com.apple.finder.PATH</string>
並び替え <string>com.apple.finder.ARNG</string>
書類フォルダ <string>com.apple.finder.DOCS</string>
パブリック <string>com.apple.finder.PBLC</string>
接続 <string>com.apple.finder.CNCT</string>
ディスク焼き <string>com.apple.finder.BURN</string>
イジェクト <string>com.apple.finder.EJCT</string>
ラベル <string>com.apple.finder.LABL</string>

非推奨 iDiskと設定
<string>com.apple.finder.IDSK</string>
<string>NSToolbarCustomizeToolbarItem</string>
</array>

|

[profiles] profiles コマンド書き出したバックアップを各ファイルに書き出す


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
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()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDocumentDirPathURL to ocidURLsArray's firstObject()
set ocidSaveDirPathURL to ocidDocumentDirPathURL's URLByAppendingPathComponent:("Mobileconfig/Bakup")
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# 777-->511 755-->493 700-->448 766-->502
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
set aliasDefaultLocation to (ocidSaveDirPathURL's absoluteURL()) as alias

#############################
###ダイアログ
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
############UTIリスト
set listUTI to {"com.apple.property-list"}
set strMes to ("ファイルを選んでください") as text
set strPrompt to ("ファイルを選んでください") as text
try
  ### ファイル選択時
  set aliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias
on error
  log "エラーしました"
return "エラーしました"
end try

set strFilePath to (POSIX path of aliasFilePath) as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
###書き出し先
set ocidSaveFileDirPathURL to ocidFilePathURL's URLByDeletingPathExtension()
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveFileDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)

#####################################
### plist読み込み
#####################################
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
set listResults to refMe's NSMutableDictionary's dictionaryWithContentsOfURL:(ocidFilePathURL) |error|:(reference)
set ocidPlistDict to item 1 of listResults
#####################################
### PLISTのROOT項目=ユーザー名を取得
#####################################
set ocidUserName to refMe's NSUserName()
set arrayPlistRoot to ocidPlistDict's objectForKey:(ocidUserName)
##
repeat with itemPlistRoot in arrayPlistRoot
  set ocidDisplayName to (itemPlistRoot's valueForKey:("ProfileDisplayName"))
  set ocidBaseFilePathURL to (ocidSaveFileDirPathURL's URLByAppendingPathComponent:(ocidDisplayName))
  set ocidSaveFilePathURL to (ocidBaseFilePathURL's URLByAppendingPathExtension:("mobileconfig"))
  
  set listDone to (itemPlistRoot's writeToURL:(ocidSaveFilePathURL) atomically:true)
end repeat




return


|

[profiles]現在のユーザー・プロファイル設定をバックアップ


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# OS14対応
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
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()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDocumentDirPathURL to ocidURLsArray's firstObject()
##保存先
set ocidSaveDirPathURL to ocidDocumentDirPathURL's URLByAppendingPathComponent:("Mobileconfig/Bakup")
##フォルダ作成
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# 777-->511 755-->493 700-->448 766-->502
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
###日付取得
set strDateNo to doGetDateNo("yyyyMMdd") as text
##
set strSaveFileName to (strDateNo & ".plist") as text
##
set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName)
set appFileManager to refMe's NSFileManager's defaultManager()
##ファイルの有無チェック
set boolFileExists to (appFileManager's fileExistsAtPath:(ocidSaveFilePathURL's |path|) isDirectory:false)
if boolFileExists is true then
  ###すでにある場合はゴミ箱に
  set appFileManager to refMe's NSFileManager's defaultManager()
  set listResult to (appFileManager's trashItemAtURL:(ocidSaveFilePathURL) resultingItemURL:(ocidSaveFilePathURL) |error|:(reference))
  set strSaveFilePath to ocidSaveFilePathURL's |path| as text
else
  set strSaveFilePath to ocidSaveFilePathURL's |path| as text
end if
##ユーザー名取得
set ocidUserName to refMe's NSUserName()
set strUserName to ocidUserName as text
##コマンド整形
set strCommandText to ("/usr/bin/profiles show -user " & strUserName & " -type configuration -output \"" & strSaveFilePath & "\"") as text
###実行
set strResponse to (do shell script strCommandText) as text
###保存先を開く
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's selectFile:(strSaveFilePath) inFileViewerRootedAtPath:(ocidSaveDirPathURL's |path|())
###エラーならファインダーで開く
if boolDone is false then
  set aliasFilePath to (ocidSaveFilePathURL's absoluteURL()) as alias
  tell application "Finder"
    open folder aliasCameraRawDirPathURL
  end tell
return "エラーしました"
end if


#####
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


|

[MDM]profilesコマンド基本


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

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
##################################################
###管理者インストールしているか?チェック

##ユーザー対象のプロファイルリスト
/usr/bin/profiles list
##_computerlevelのみ
/usr/bin/sudo /usr/bin/profiles list
##全プロファイルリスト
/usr/bin/sudo /usr/bin/profiles list -all
##特定ユーザーのみ
/usr/bin/sudo /usr/bin/profiles list -user ユーザーショート名

#登録内容 ユーザー
/usr/bin/profiles show
#登録内容 システム
/usr/bin/sudo /usr/bin/profiles show
#全部
/usr/bin/sudo /usr/bin/profiles show -all
##特定ユーザーのみ
/usr/bin/sudo /usr/bin/profiles show -user ユーザーショート名
##configurationのみ
/usr/bin/profiles show -type configuration
## enrollmentのみ
/usr/bin/sudo /usr/bin/profiles show -type enrollment
## provisioningのみ
/usr/bin/sudo /usr/bin/profiles show -type provisioning

##【削除】
##PayloadScope USERで登録してあるもの
/usr/bin/profiles remove -identifier com.cocolog-nifty.quicktimer.6DCFF6B7-XXXX-XXXX-XXXX-10BD96C39B49

##PayloadScope SYSTEMで登録してあるもの
/usr/bin/sudo /usr/bin/profiles remove -identifier com.cocolog-nifty.quicktimer.6DCFF6B7-XXXX-XXXX-XXXX-10BD96C39B49

#登録済みのバックアップ ユーザー名指定 configurationのみ対象
CONSOLE_USER=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/ { print $3 }')
/bin/mkdir -p "$HOME/Documents/Mobileconfig/OutPut"
STR_DATE_TIME=$(/bin/date +'%Y%m%d%H%M%S')
/usr/bin/profiles show -user "$CONSOLE_USER" -type configuration -output "$HOME/Documents/Mobileconfig/OutPut/""$STR_DATE_TIME"".plist"


##シンク
/usr/bin/sudo /usr/bin/profiles sync


exit 0


|

[自分用]edgeとChromの定型のお気に入り

少し更新した com.google.Chrome.ManagedBookmarks com.microsoft.edgemac.ManagedFavorites を更新 SafariとFirefoxはhtml管理している

ダウンロード - browsermanagedfavorites.zip

|

[SPConfigurationProfileData]システム情報 DBの内容をダイアログ表示して取得


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

#!/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()

#####################################
######ファイル保存先
#####################################
set ocidUserLibraryPathArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidFilePathURL to ocidUserLibraryPathArray's objectAtIndex:0
set ocidSaveDirPathURL to ocidFilePathURL's URLByAppendingPathComponent:"Apple/system_profiler"
############################
#####属性
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:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
#####################################
######PLISTパス
#####################################
set ocidFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:"SPConfigurationProfileDataType.json"
set strFilePath to (ocidFilePathURL's |path|()) as text
###古いファイルはゴミ箱に
set boolResults to (appFileManager's trashItemAtURL:ocidFilePathURL resultingItemURL:(missing value) |error|:(reference))
#####################################
######コマンド実行
#####################################
set strCommandText to "/usr/sbin/system_profiler SPConfigurationProfileDataType -json"
set strReadString to (do shell script strCommandText) as text
###戻り値をストリングに
set ocidReadString to refMe's NSString's stringWithString:(strReadString)
###NSDATAにして
set ocidReadData to ocidReadString's dataUsingEncoding:(refMe's NSUTF8StringEncoding)
###ファイルに書き込み(使い回し用)-->不要な場合は削除して
ocidReadData's writeToURL:(ocidFilePathURL) atomically:true
#####################################
######JOSN をDictで処理
#####################################
set listJSONSerialization to (refMe's NSJSONSerialization's JSONObjectWithData:(ocidReadData) options:0 |error|:(reference))
set ocidJsonData to item 1 of listJSONSerialization
set ocidJsonRootDict to (refMe's NSDictionary's alloc()'s initWithDictionary:(ocidJsonData))
set ocidDataTypeArray to (ocidJsonRootDict's objectForKey:("SPConfigurationProfileDataType"))
set strUserOutPutText to ("Userプロファイル:\n") as text
set strDeviceOutPutText to ("Deveiceプロファイル:\n") as text
repeat with itemDataTypeArray in ocidDataTypeArray
  set strName to (itemDataTypeArray's valueForKey:("_name")) as text
  set ocidItemArray to (itemDataTypeArray's objectForKey:("_items"))
  repeat with itemItemArray in ocidItemArray
    ###とりあえずプロファイル名のみ
    set strProfileName to (itemItemArray's valueForKey:("_name")) as text
    ##必要に応じて項目を追加するといいね
    # set strProfileUUID to (itemItemArray's valueForKey:("spconfigprofile_profile_uuid")) as text
    # set strProfileID to (itemItemArray's valueForKey:("spconfigprofile_profile_identifier")) as text
    if strName is "spconfigprofile_section_userconfigprofiles" then
      set strUserOutPutText to (strUserOutPutText & strProfileName & "\n")
    else if strName is "spconfigprofile_section_deviceconfigprofiles" then
      set strDeviceOutPutText to (strDeviceOutPutText & strProfileName & "\n") as text
    end if
  end repeat
end repeat
log strUserOutPutText
log strDeviceOutPutText

set strOutPutText to (strUserOutPutText & "\n" & strDeviceOutPutText) as text

#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set strIconPath to "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/FinderIcon.icns" as text
set aliasIconPath to POSIX file strIconPath as alias
###ダイアログ
set recordResult to (display dialog " 戻り値です\rコピーしてメールかメッセージを送ってください" with title "SPConfigurationProfileDataType" default answer strOutPutText buttons {"クリップボードにコピー", "キャンセル", "OK"} default button "OK" giving up after 30 with icon aliasIconPath without hidden answer)
###クリップボードコピー
if button returned of recordResult is "クリップボードにコピー" then
  set strText to text returned of recordResult as text
  ####ペーストボード宣言
  set appPasteboard to refMe's NSPasteboard's generalPasteboard()
  set ocidText to (refMe's NSString's stringWithString:(strOutPutText))
appPasteboard's clearContents()
appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString)
end if

|

[mobileconfig]Githubからダウンロードして設定パネルでmobileconfigを開く

サンプルはスクリプトメニュー

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

#!/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 framework "UniformTypeIdentifiers"
use scripting additions

property refMe : a reference to current application

###【1】URL
set strFileURL to "https://raw.githubusercontent.com/force4u/AppleScript/main/Script%20Menu/Applications/Script%20Editor/Script%20Menu/Mobileconfig/Mobileconfig/com.apple.scriptmenu.mobileconfig" as text

set ocidFileURLStr to refMe's NSString's stringWithString:(strFileURL)
set ocidFileURL to refMe's NSURL's URLWithString:(ocidFileURLStr)
#保存用にファイル名取っておく
set ocidFileName to ocidFileURL's lastPathComponent()
#%エンコードされたファイル名は戻しておく
set ocidSaveFileName to ocidFileName's stringByRemovingPercentEncoding

###【2】URL読み込み
#【2-1】NSdataに読み込む(エラー制御したいため-->いきなりNSMutableDictionaryでもOK)
set ocidOption to refMe's NSDataReadingMappedIfSafe
set listReadData to refMe's NSData's alloc()'s initWithContentsOfURL:(ocidFileURL) options:(ocidOption) |error|:(reference)
log "【2-1】" & (item 2 of listReadData)
set ocidPlistData to (item 1 of listReadData)
#【2-2】NSdataをNSPropertyListSerializationしてNSMutableDictionaryに格納する
set ocidXmlPlist to refMe's NSPropertyListXMLFormat_v1_0
set ocidPlistSerial to refMe's NSPropertyListSerialization
set ocidOption to refMe's NSPropertyListMutableContainers
set listPlistSerial to ocidPlistSerial's propertyListWithData:(ocidPlistData) options:(ocidOption) format:(ocidXmlPlist) |error|:(reference)
log "【2-2】" & (item 2 of listPlistSerial)
set ocidPlistSerial to (item 1 of listPlistSerial)
##
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidPlistDict's setDictionary:ocidPlistSerial

###【3】値を変更したい場合はここで
set ocidPayloadArray to ocidPlistDict's objectForKey:("PayloadContent")





###【4】ファイルの保存先(書類フォルダ)
###保存先ディレクトリ
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidUserDocumentPathArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDocumentPathURL to ocidUserDocumentPathArray's firstObject()
#保存先ディレクトリを作る 700
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set ocidSaveDirPathURL to ocidDocumentPathURL's URLByAppendingPathComponent:("Mobileconfig") isDirectory:false
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
log "【4】" & (item 1 of listBoolMakeDir)
##保存ファイルのパス
set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidSaveFileName)

###【5】保存
set boolDone to ocidPlistDict's writeToURL:(ocidSaveFilePathURL) atomically:true
log "【5】" & boolDone

###【6】登録実行
tell application id "com.apple.systempreferences" to launch
tell application id "com.apple.systempreferences"
  activate
reveal anchor "Main" of pane id "com.apple.Profiles-Settings.extension"
end tell

###FinderのURL
set appShardWorkspace to refMe's NSWorkspace's sharedWorkspace()
set strBundleID to "com.apple.finder" as text
set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:(strBundleID)
if ocidAppBundle is not (missing value) then
  set ocidAppPathURL to ocidAppBundle's bundleURL()
else
  set ocidAppPathURL to appShardWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID)
end if
###パネルのURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("x-apple.systempreferences")
ocidURLComponents's setPath:("com.apple.preferences.configurationprofiles")
set ocidOpenAppURL to ocidURLComponents's |URL|
set strOpenAppURL to ocidOpenAppURL's absoluteString() as text
###ファイルURLとパネルのURLをArrayにしておく
set ocidOpenUrlArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
ocidOpenUrlArray's insertObject:(ocidSaveFilePathURL) atIndex:0
ocidOpenUrlArray's insertObject:(ocidOpenAppURL) atIndex:1
tell current application
  set strName to name as text
end tell
if strName is "osascript" then
  set theCmdCom to ("open \"" & strFilePath & "\" | open \"" & strOpenAppURL & "\"") as text
  do shell script theCmdCom
else
  ###FinderでファイルとURLを同時に開く
  set ocidOpenConfig to refMe's NSWorkspaceOpenConfiguration's configuration
ocidOpenConfig's setActivates:(refMe's NSNumber's numberWithBool:true)
appShardWorkspace's openURLs:(ocidOpenUrlArray) withApplicationAtURL:(ocidAppPathURL) configuration:(ocidOpenConfig) completionHandler:(missing value)
end if
log "【6】Done"

###【7】保存ファイル表示
#選択状態で開く
set boolDone to appShardWorkspace's selectFile:(ocidSaveFilePathURL's |path|) inFileViewerRootedAtPath:(ocidDocumentPathURL's |path|)
log "【7】" & boolDone

###【8】システム設定を前面に
###システム設定を前面に
set ocidRunningApp to refMe's NSRunningApplication
set ocidAppArray to (ocidRunningApp's runningApplicationsWithBundleIdentifier:("com.apple.systempreferences"))
set ocidApp to ocidAppArray's firstObject()
ocidApp's activateWithOptions:(refMe's NSApplicationActivateAllWindows)
set boolDone to ocidApp's active
log "【8】" & boolDone


|

mobileconfigファイルをシステム設定で開く


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

set theCmdCom to ("open \"" & strFilePath & "\" | open \"x-apple.systempreferences:com.apple.preferences.configurationprofiles\"") as text
  do shell script theCmdCom

↑これをAppleScriptでやります↓

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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "UniformTypeIdentifiers"
use scripting additions

property refMe : a reference to current application


####ダイアログで使うデフォルトロケーション
tell application "Finder"
  set aliasDefaultLocation to (path to documents folder from user domain) as alias
end tell

####UTIリスト PDFのみ
set listUTI to {"com.apple.mobileconfig"}

set strMes to ("モバイルコンフィグファイルを選んでください") as text
set strPrompt to ("モバイルコンフィグファイルを選んでください") as text

####ダイアログを出す
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set aliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias
###パス
set strFilePath to POSIX path of aliasFilePath
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)

###起動はさせておく
tell application id "com.apple.systempreferences" to launch
tell application id "com.apple.systempreferences"
  activate
reveal anchor "Main" of pane id "com.apple.Profiles-Settings.extension"
end tell

###FinderのURL
set appShardWorkspace to refMe's NSWorkspace's sharedWorkspace()
set strBundleID to "com.apple.finder" as text
set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:(strBundleID)
if ocidAppBundle is not (missing value) then
  set ocidAppPathURL to ocidAppBundle's bundleURL()
else
  set ocidAppPathURL to appShardWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID)
end if
###パネルのURL
set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
ocidURLComponents's setScheme:("x-apple.systempreferences")
ocidURLComponents's setPath:("com.apple.preferences.configurationprofiles")
set ocidOpenAppURL to ocidURLComponents's |URL|
###ファイルURLとパネルのURLをArrayにしておく
set ocidOpenUrlArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
ocidOpenUrlArray's insertObject:(ocidFilePathURL) atIndex:0
ocidOpenUrlArray's insertObject:(ocidOpenAppURL) atIndex:1
###FinderでファイルとURLを同時に開く
set ocidOpenConfig to refMe's NSWorkspaceOpenConfiguration's configuration
ocidOpenConfig's setActivates:(refMe's NSNumber's numberWithBool:true)
appShardWorkspace's openURLs:({ocidFilePathURL, ocidOpenAppURL}) withApplicationAtURL:(ocidAppPathURL) configuration:(ocidOpenConfig) completionHandler:(missing value)
###システム設定を前面に
set ocidRunningApp to refMe's NSRunningApplication
set ocidAppArray to (ocidRunningApp's runningApplicationsWithBundleIdentifier:("com.apple.systempreferences"))
set ocidApp to ocidAppArray's firstObject()
ocidApp's active

|

[bash]CPUでの処理分岐


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

#!/bin/bash
###
ARCHITEC=$(/usr/bin/arch)
if [ "$ARCHITEC" == "arm64" ]; then
      /bin/echo "arch:" "ARM"
else
      /bin/echo "arch:" "INTEL"
fi
##########################################
UNAME=$(/usr/bin/uname -m)
if [ "$UNAME" == "arm64" ]; then
      /bin/echo "uname" "ARM arm64"
elif [ "$UNAME" == "x86_64" ];then
      /bin/echo "uname" "INTEL x86_64"
fi
##########################################
CPUTYPE=$(/usr/sbin/sysctl -n hw.cputype)
if [ "$CPUTYPE" == "16777228" ]; then
      /bin/echo "hw.cputype:" "ARM"
elif [ "$CPUTYPE" == "16777223" ];then
      /bin/echo "hw.cputype:" "INTEL"
fi

|

物理メモリーを調べる


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.6"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

set ocidProcessInfo to refMe's NSProcessInfo's processInfo()
set realMemoryByte to ocidProcessInfo's physicalMemory() as real
set realGB to "1073741824" as real
set intPhysicalMemory to realMemoryByte / realGB as integer
log intPhysicalMemory


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

#!/bin/bash
###
NUM_PHYSICAL_MEMORY=$(/usr/sbin/sysctl -n hw.memsize) 
GB_PHYSICAL_MEMORY=$(/usr/bin/bc <<< "scale=0; $NUM_PHYSICAL_MEMORY/1073741824")
/bin/echo "$GB_PHYSICAL_MEMORY"

|

その他のカテゴリー

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