Menu

Skip to content
AppleScriptの穴
  • Home
  • Products
  • Books
  • Docs
  • Events
  • Forum
  • About This Blog
  • License
  • 仕事依頼

AppleScriptの穴

Useful & Practical AppleScript archive. Click '★Click Here to Open This Script' Link to download each AppleScript

カテゴリー: drive

マウントしたディスクイメージから元のdmgファイルのパスを取得

Posted on 10月 16 by Takaaki Naganoya

マウント中のディスクイメージ(.dmg)ファイルのパスを求めるAppleScriptです。

macOS 13.7.1上で作成し、15.1上でも動作確認していますが、それほど込み入った機能は使っていないので、OSバージョン依存はないことでしょう。

実際に、オープンソースのPDFビューワー「Skim」の各バージョンのdmgファイルをダウンロードして、sdef(AppleScript用語説明)ファイルを収集してバージョンごとの変化を追う作業を行なったときに、バージョン判定を行うために元のdmgファイルのパスを求める処理を行なったものです。


▲マウントしたディスクイメージ(Skim)


▲マウント元のディスクイメージファイル


▲マウントしたディスクイメージからパス情報を取得することで、一部ファイルを取り出してコピーする際にバージョン情報を反映させた

AppleScript名:マウントしたディスクイメージから元のdmgファイルのパスを取得.scpt
—
–  Created by: Takaaki Naganoya
–  Created on: 2024/10/16
—
–  Copyright © 2024 Piyomaru Software, All Rights Reserved
—

use AppleScript
use framework "Foundation"
use scripting additions

set dName to "Skim"

–Disk Imageのマウントを確認
tell application "Finder"
  set dexRes to (get exists of disk dName)
end tell
if dexRes = false then error "指定のディスクイメージ「" & dName & "」はマウントされていません。" –マウントされていなかった

set aRes to getMountedDiskImageInfo("image-path : ") of me
–> "/Users/me/Downloads/Skim-1.4.6.dmg"

on getMountedDiskImageInfo(targMark)
  try
    set aRes to do shell script "hdiutil info"
  on error
    return false
  end try
  
  
set aResList to paragraphs of aRes
  
repeat with i in aResList
    set j to contents of i
    
if j begins with targMark then
      set aOff to offset of targMark in j
      
set aLen to length of targMark
      
set aRes to text (aLen + 1) thru -1 of j
      
return aRes
    end if
  end repeat
  
return false
end getMountedDiskImageInfo

★Click Here to Open This Script 

Posted in drive File path shell script | Tagged 13.0savvy 14.0savvy 15.0savvy | Leave a comment

光学ドライブのオープン(イジェクト)

Posted on 10月 29, 2018 by Takaaki Naganoya

光学ドライブのオープン(メディアのイジェクト)を行うAppleScriptです。

すっかり、Macのラインナップから光学ドライブ標準搭載モデルがなくなって、外付けの光学ドライブばかりというか、そもそも光学ドライブを持っていないというユーザーが増えてきたので、光学メディアでのデータ配布そのものが無意味になりつつある昨今。

光学ドライブもトレイ式(トレイ開閉が電動)のものがほぼ絶滅状態(Pioneerのみ製造?)。スリムタイプのスロットイン方式か、薄型トレイ(イジェクトしたまま戻らない)方式のみなので、光学メディアのイジェクトについて分かればよいでしょう。

drutilコマンドのほか、macOS 10.13まではDVDプレイヤーがScriptableだったので、DVDプレイヤーに対してejectコマンドを送る方法もありました(10.14でScripting機能が廃止に……アプリケーション自体を作り直したもよう)。


macOS 10.12/13:DVDプレイヤー(32bit) ファイルサイズ:6.4MB バージョン:5.8


macOS 10.14:DVDプレイヤー(64bit) ファイルサイズ:2.1MB バージョン: 6.0
注:macOS 10.14のDVDプレイヤーは/System/Library/CoreServices/Applications/にある。アプリケーションから補助ツールに格下げになった。

これまでDVDプレイヤーが担ってきた用途については、フリーの「Free Mac Media Player」で置き換えるのがよいと思われます。

AppleScript名:光学ドライブのトレイオープン(内蔵ドライブのみ)
do shell script "/usr/bin/drutil eject internal"

★Click Here to Open This Script 

AppleScript名:光学ドライブのトレイオープン(外付けドライブのみ)
do shell script "/usr/bin/drutil eject external"

★Click Here to Open This Script 

Posted in drive System | Tagged 10.11savvy 10.12savvy 10.13savvy 10.14savvy | Leave a comment

マウント中のドライブをアンマウント

Posted on 10月 7, 2018 by Takaaki Naganoya

マウント中のドライブのうち、起動ドライブを除いたものをアンマウントします。

NSWorkspace経由でアンマウントするものと、OLD Style AppleScriptでFinder経由でアンマウントするものを掲載しておきます。

ただし、Time Machineのバックアップドライブなど、NSWorkspace経由ではアンマウントできないものもあり、「どちらがいい」とも言い切れない様子です。

–> Download Blank Disk Image for test

AppleScript名:NSWorkSpace経由でアンマウント.scptd
—
–  Created by: Takaaki Naganoya
–  Created on: 2018/10/07
—
–  Copyright © 2018 Piyomaru Software, All Rights Reserved
—
use AppleScript version "2.4" — Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set aPath to retDrivePosixPath() of me
if aPath = false then return

set aWS to current application’s NSWorkspace’s sharedWorkspace()
set aRes to aWS’s unmountAndEjectDeviceAtPath:aPath

on retDrivePosixPath()
  tell application "Finder"
    set dList to properties of every disk whose startup is false and size > 0
    
    
if length of dList > 1 then
      –複数の対象ドライブがある場合にはユーザーに選択させる
      
set dnList to name of every disk whose startup is false and size > 0
      
–set dnList to name of every disk whose startup is false
      
set dRes to choose from list dnList
      
set driveProp to (properties of disk dRes)
      
set driveURL to URL of driveProp
    else if dList = {} then
      return false
    else
      set driveURL to URL of first item of dList
    end if
    
  end tell
  
  
set dPath to ((current application’s |NSURL|’s URLWithString:driveURL)’s |path|()) as string
  
return dPath
end retDrivePosixPath

★Click Here to Open This Script 

AppleScript名:OLD style AppleScriptでアンマウント可能なドライブをアンマウント
—
–  Created by: Takaaki Naganoya
–  Created on: 2018/10/07
—
–  Copyright © 2018 Piyomaru Software, All Rights Reserved
—
set dName to retEjectableDriveName() of me
if dName = false then return

tell application "Finder" to eject disk dName

on retEjectableDriveName()
  tell application "Finder"
    set dList to properties of every disk whose startup is false and size > 0
    
    
if length of dList > 1 then
      –複数の対象ドライブがある場合にはユーザーに選択させる
      
set dnList to name of every disk whose startup is false and size > 0
      
set dRes to choose from list dnList
    else if dList = {} then
      return false
    else
      set dRes to name of first item of dList
    end if
    
    
return dRes
  end tell
end retEjectableDriveName

★Click Here to Open This Script 

Posted in drive | Tagged 10.11savvy 10.12savvy 10.13savvy 10.14savvy Finder NSWorkspace | Leave a comment

Google Drive File StreamのドライブでSpotlight Indexを生成

Posted on 8月 4, 2018 by Takaaki Naganoya

Google Drive File Stream上でSpotlight Indexを生成するAppleScriptです。

Google Driveには、Gmailのオマケでついてくる個人のデバイス間で情報のシンクロを行う目的のPersonal版(DropboxのGoogle版的なもの)と、企業内やグループ内でファイル共有を行うG SuiteのGoodle Drive File Streamがあり、後者についてはGoogleによる「Google Drive File Stream」ツールが提供され、GoogleDriveをデスクトップにマウントできます。

実際にGoogle Drive File Streamを使ってみたところ、デフォルト状態だとSpotlight検索が効きませんでした。

そこで、Index生成してみたものの…既存のファイルについてはSpotlight検索できませんでした。Index生成後に、新規追加したファイルについてはSpotlight検索が有効でした。

後日談:ただ、Google Drive File Streamに対してSpotlight Indexを常時生成するようにすると、CPUに対する負荷が大きくなるため、実際の運用ではSpotlightを無効にして運用するようにしました。

AppleScript名:Google Drive File Streamでインデックス生成
do shell script "mdutil -E /Volumes/GoogleDrive/" with administrator privileges

★Click Here to Open This Script 

自分が試したのは、Google Drive File Stream内の「マイドライブ」領域のみで、

「グループドライブ」領域についてはまだテストできていません。

既存のファイルについては、mdimportコマンドでインデックス作成すれば大丈夫だと思っていますが、実際に試してみると予想外の挙動を行うのかもしれません。

AppleScript名:GDFS上でSpotlight検索
— Created 2016-06-17 by Takaaki Naganoya
— 2016 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

property NSArray : a reference to current application’s NSArray
property NSPredicate : a reference to current application’s NSPredicate
property NSSortDescriptor : a reference to current application’s NSSortDescriptor
property NSMetadataQuery : a reference to current application’s NSMetadataQuery
property NSNotificationCenter : a reference to current application’s NSNotificationCenter
property NSMetadataQueryDidUpdateNotification : a reference to current application’s NSMetadataQueryDidUpdateNotification
property NSMetadataQueryDidFinishGatheringNotification : a reference to current application’s NSMetadataQueryDidFinishGatheringNotification

property searchRes : {}

set origPath to POSIX path of (choose folder)
set aList to spotlightSearch(origPath, "kMDItemContentType == ’public.png’") of me

on spotlightSearch(origPath, aMDfindParam)
  
  
set my searchRes to {} –initialize
  
initiateSearchForFullPath(aMDfindParam, origPath) –Predicate & Scope Directory
  
  
–Waiting for the result
  
repeat while my searchRes = {}
    delay 0.01
  end repeat
  
  
set anObj to my searchRes’s firstObject() –Pick up the first one for test
  
if anObj = missing value then return {} –No Result
  
  
set resArray to {}
  
repeat with anItem in my searchRes
    set j to contents of anItem
    
set aPath to (j’s valueForAttribute:"kMDItemPath") as string
    
set the end of resArray to aPath
  end repeat
  
  
return resArray
  
end spotlightSearch

on initiateSearchForFullPath(aQueryStrings, origPath)
  
  
set aSearch to NSMetadataQuery’s alloc()’s init()
  
  
NSNotificationCenter’s defaultCenter()’s addObserver:(me) selector:"queryDidUpdate:" |name|:(NSMetadataQueryDidUpdateNotification) object:aSearch
  
NSNotificationCenter’s defaultCenter()’s addObserver:(me) selector:"initalGatherComplete:" |name|:(NSMetadataQueryDidFinishGatheringNotification) object:aSearch
  
  
set aPredicate to NSPredicate’s predicateWithFormat:aQueryStrings
  
aSearch’s setPredicate:aPredicate
  
  
set aScope to NSArray’s arrayWithObjects:{origPath}
  
aSearch’s setSearchScopes:aScope
  
  
set sortKeys to NSSortDescriptor’s sortDescriptorWithKey:"kMDItemFSName" ascending:true
  
aSearch’s setSortDescriptors:(NSArray’s arrayWithObject:sortKeys)
  
  
aSearch’s startQuery()
  
end initiateSearchForFullPath

on queryDidUpdate:sender
  log sender
  
–> (NSConcreteNotification) NSConcreteNotification 0x7fa618450820 {name = NSMetadataQueryDidFinishGatheringNotification; object = <NSMetadataQuery: 0x7fa6172c6ca0>}
end queryDidUpdate:

on initalGatherComplete:sender
  set anObject to sender’s object
  
anObject’s stopQuery()
  
NSNotificationCenter’s defaultCenter()’s removeObserver:me |name|:(NSMetadataQueryDidUpdateNotification) object:anObject
  
NSNotificationCenter’s defaultCenter()’s removeObserver:me |name|:(NSMetadataQueryDidFinishGatheringNotification) object:anObject
  
  
set my searchRes to anObject’s results()
end initalGatherComplete:

★Click Here to Open This Script 

Posted in drive file shell script Spotlight | Tagged 10.12savvy NSArray NSMetadataQuery NSNotificationCenter NSPredicate NSSortDescriptor | Leave a comment

指定パスの所属するドライブ名を取得する v2

Posted on 5月 22, 2018 by Takaaki Naganoya

指定パスの所属するドライブ名を取得するAppleScriptです。

ドライブ名さえ求めてしまえば、Finderに問い合わせてそれが起動ドライブ(startup = true)かどうか確認できるため、起動ドライブ以外であれば外付けディスクやファイルサーバーであるかの判定も行えます。

AppleScript名:指定パスの所属するドライブ名を取得する v2
— Created 2017-09-03 by Takaaki Naganoya
— 2017 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

property |NSURL| : a reference to current application’s |NSURL|
property NSURLVolumeNameKey : a reference to current application’s NSURLVolumeNameKey

set aPath to POSIX path of (choose folder)
set dRes to retDiskNameOfTheFolder(aPath) of me

on retDiskNameOfTheFolder(aPath)
  set aURL to |NSURL|’s fileURLWithPath:aPath
  
set aVlomeName to ""
  
set {aRes, driveName} to aURL’s getResourceValue:(reference) forKey:(NSURLVolumeNameKey) |error|:(missing value)
  
return driveName as string
end retDiskNameOfTheFolder

★Click Here to Open This Script 

Posted in drive File path | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

指定ボリウムをマウント

Posted on 2月 15, 2018 by Takaaki Naganoya
AppleScript名:指定ボリウムをマウント
— Created 2015-12-01 by Takaaki Naganoya
— 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aPath to current application’s |NSURL|’s URLWithString:"afp://MBA13.local/maro"
set ws to current application’s NSWorkspace’s sharedWorkspace()
ws’s openURL:aPath

★Click Here to Open This Script 

Posted in drive System | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

CocoaでDiskSpace(%)を求める

Posted on 2月 15, 2018 by Takaaki Naganoya
AppleScript名:CocoaでDiskSpace(%)を求める
— Created 2015-04-01 by Takaaki Naganoya
— 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aPath to current application’s NSString’s stringWithString:"/"
set fileAttr to current application’s NSFileManager’s defaultManager()’s attributesOfFileSystemForPath:aPath |error|:(missing value)
set fRes to (fileAttr’s objectForKey:(current application’s NSFileSystemFreeSize)) as string

set aDecNum to current application’s NSDecimalNumber’s decimalNumberWithString:fRes
set aFreeNum to aDecNum’s decimalNumberByDividingBy:(current application’s NSDecimalNumber’s decimalNumberWithString:"1000000000") –"G" Bytes for Storage
set bFreeNum to aFreeNum as real
–> 84.058387756348

★Click Here to Open This Script 

Posted in drive System | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

CocoaでDiskSpace(Bytes)を求める

Posted on 2月 15, 2018 by Takaaki Naganoya
AppleScript名:CocoaでDiskSpace(Bytes)を求める
— Created 2015-04-02 by Shane Stanley
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

usedSpace("/")
–>  8.4346003456E+10

usedSpace2("/")
–>  8.4345450496E+10

usedSpaceString("/")
–>  "84.35 GB"

usedSpaceLongString("/")
–>  "45.77 GB (45,772,857,344 bytes)"–English user environment
–>  "45.77 GB (45,772,857,344 バイト)"–Japanese user environment

tell application "Finder"
  free space of startup disk
end tell
–>  4.5784592712E+10

on usedSpace(volumePath)
  set theNSURL to current application’s class "NSURL"’s fileURLWithPath:volumePath –considering "ASOC in Xcode"
  
set {theResult, theSize} to theNSURL’s getResourceValue:(reference) forKey:(current application’s NSURLVolumeAvailableCapacityKey) |error|:(missing value)
  
  
return theSize as real — integer may be too big for AS
end usedSpace

on usedSpace2(volumePath)
  set fileAttr to current application’s NSFileManager’s defaultManager()’s attributesOfFileSystemForPath:volumePath |error|:(missing value)
  
  
return (fileAttr’s objectForKey:(current application’s NSFileSystemFreeSize)) as real — integer may be too big for AS
end usedSpace2

on usedSpaceString(volumePath)
  set fileAttr to current application’s NSFileManager’s defaultManager()’s attributesOfFileSystemForPath:volumePath |error|:(missing value)
  
set fRes to fileAttr’s objectForKey:(current application’s NSFileSystemFreeSize)
  
  
–Formatting
  
set sizeString to current application’s NSByteCountFormatter’s stringFromByteCount:fRes countStyle:(current application’s NSByteCountFormatterCountStyleDecimal)
  
  
return sizeString as text
end usedSpaceString

on usedSpaceLongString(volumePath)
  set fileAttr to current application’s NSFileManager’s defaultManager()’s attributesOfFileSystemForPath:volumePath |error|:(missing value)
  
set fRes to fileAttr’s objectForKey:(current application’s NSFileSystemFreeSize)
  
  
–Formatting
  
set theFormatter to current application’s NSByteCountFormatter’s alloc()’s init()
  
theFormatter’s setCountStyle:(current application’s NSByteCountFormatterCountStyleDecimal)
  
theFormatter’s setIncludesActualByteCount:true
  
set sizeString to theFormatter’s stringFromByteCount:fRes
  
  
return sizeString as text
end usedSpaceLongString

★Click Here to Open This Script 

Posted in drive System | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

指定フォルダが所属しているDiskの空き容量をGバイト単位で返す

Posted on 2月 15, 2018 by Takaaki Naganoya
AppleScript名:指定フォルダが所属しているDiskの空き容量をGバイト単位で返す
— Created 2015-04-02 by Shane Stanley
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aFol to choose folder
set aFolPOSIX to POSIX path of aFol

set fRes to freeStorageSpaceG(aFolPOSIX)

–指定フォルダが所属しているDiskの空き容量をGバイト単位で返す
on freeStorageSpaceG(volumePath)
  set fileAttr to current application’s NSFileManager’s defaultManager()’s attributesOfFileSystemForPath:volumePath |error|:(missing value)
  
set fileFree to (fileAttr’s objectForKey:(current application’s NSFileSystemFreeSize))
  
  
set sizeString to current application’s NSByteCountFormatter’s stringFromByteCount:fileFree countStyle:(current application’s NSByteCountFormatterCountStyleDecimal)
  
  
return sizeString as text
end freeStorageSpaceG

★Click Here to Open This Script 

Posted in drive System | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

指定ボリウム(サーバーボリウム)の空き容量を調べる

Posted on 2月 15, 2018 by Takaaki Naganoya
AppleScript名:指定ボリウム(サーバーボリウム)の空き容量を調べる
— Created 2015-05-14 by Shane Stanley
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set serverName to "maro"
set aRes to getVolumeFreeSpace(serverName) of me

on getVolumeFreeSpace(serverName)
  set anNSURL to (current application’s |NSURL|’s fileURLWithPath:"/Volumes")’s URLByAppendingPathComponent:serverName
  
set theResult to (anNSURL’s checkResourceIsReachableAndReturnError:(missing value)) as boolean
  
if not theResult then
    — not mounted, so handle error
    
return false
  end if
  
set {theResult, theSpare} to anNSURL’s getResourceValue:(reference) forKey:(current application’s NSURLVolumeAvailableCapacityKey) |error|:(missing value)
  
if theResult as boolean then
    set spareString to (current application’s NSByteCountFormatter’s stringFromByteCount:theSpare countStyle:(current application’s NSByteCountFormatterCountStyleFile)) as text
  else
    — couldn’t get the value, so handle error
    
error
  end if
end getVolumeFreeSpace

★Click Here to Open This Script 

Posted in drive System | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

SDカードを検出

Posted on 2月 15, 2018 by Takaaki Naganoya

マウントされたドライブのうちSDカードに相当するものを検出するAppleScriptです。

ただし、iMac Proで採用されたUHS‑II対応のSDカードスロット+UHS-II対応のSDカードがどのように見えるかは実機がないので確認できません。

exFATのことも考えると、「MSDOS format」を抽出条件に入れないほうがいいのかもしれません。

AppleScript名:SDカードを検出
— Created 2016-10-04 by Takaaki Naganoya
— 2016 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

tell application "Finder"
  set driveList to every disk whose format is (MSDOS format) and ejectable is true and startup is false
  
  
repeat with i in driveList
    set myDisk to disk of (first item of i)
    
set myMountPoint to POSIX path of (myDisk as alias)
    
–> "/Volumes/JVCCAM_SD/"
    
–> "/Volumes/RICOHDCX/"
    
set sdRes to detectSDCard(myMountPoint) of me
    
–> true –SD Card, false –Not SD Card
  end repeat
end tell

on detectSDCard(myMountPoint as string)
  
  
set resData to runCommandString("system_profiler -xml SPStorageDataType") of me
  
set aaDict to (readPlistFromStr(resData) of me) as list
  
set aDictList to (_items of first item of aaDict)
  
  
repeat with i in aDictList
    set j to contents of i
    
    
set aMountPoint to (mount_point of j) as string
    
–> "/Volumes/JVCCAM_SD"
    
–> "/Volumes/RICOHDCX"
    
    
if aMountPoint is not equal to "/" then
      if ((aMountPoint & "/") is equal to myMountPoint) then
        set aDevName to words of (device_name of physical_drive of j)
        
set aMediaName to words of (media_name of physical_drive of j)
        
        
–SD/SDHC/SDXCのカード検出
        
set aDevF to ("SD" is in aDevName) or ("SDHC" is in aDevName) or ("SDXC" is in aDevName)
        
set aMediaF to ("SD" is in aMediaName) or ("SDHC" is in aMediaName) or ("SDXC" is in aMediaName)
        
        
if (aDevF and aMediaF) then return true
      end if
    end if
  end repeat
  
  
return false
end detectSDCard

–文字列で与えたシェルコマンドを実行する
on runCommandString(commandStr as string)
  set aPipe to current application’s NSPipe’s pipe()
  
set aTask to current application’s NSTask’s alloc()’s init()
  
aTask’s setLaunchPath:"/bin/sh"
  
aTask’s setArguments:{"-c", current application’s NSString’s stringWithFormat_("%@", commandStr)}
  
aTask’s setStandardOutput:aPipe
  
set aFile to aPipe’s fileHandleForReading()
  
aTask’s |launch|()
  
return current application’s NSString’s alloc()’s initWithData:(aFile’s readDataToEndOfFile()) encoding:(current application’s NSUTF8StringEncoding)
end runCommandString

–stringのplistを読み込んでRecordに
on readPlistFromStr(theString)
  set aSource to current application’s NSString’s stringWithString:theString
  
set pListData to aSource’s dataUsingEncoding:(current application’s NSUTF8StringEncoding)
  
set aPlist to current application’s NSPropertyListSerialization’s propertyListFromData:pListData mutabilityOption:(current application’s NSPropertyListImmutable) |format|:(current application’s NSPropertyListFormat) errorDescription:(missing value)
  
return aPlist
end readPlistFromStr

★Click Here to Open This Script 

Posted in drive System XML | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

指定容量の指定名称のRAMディスクを作成する

Posted on 2月 15, 2018 by Takaaki Naganoya

指定容量+指定名称のRAMディスクを作成するAppleScriptです。

SSDのアクセス速度が意外と処理のボトルネックになることがあるので(並列処理時とか)、ごくまれにRAMディスクを作って処理することがあります。

ただ、ベンチマーク値では最新機種の方がこれ(↑)よりも高速なSSDを搭載していたりするので、なかなか感慨深いものがあります。実際に処理を行わせてみるとベンチマーク値ほどには差が出なかったりもします。

AppleScript名:指定容量の指定名称のRAMディスクを作成する
— Created 2017-01-24 by Takaaki Naganoya
— 2017 Piyomaru Software
–https://www.tekrevue.com/tip/how-to-create-a-4gbs-ram-disk-in-mac-os-x/
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set dName to "RAM Disk"
set dCapacity to 512 * 2 * 1000 –512MB
set aCmd to "diskutil erasevolume HFS+ ’" & dName & "’ `hdiutil attach -nomount ram://" & (dCapacity as string) & "`"
try
  do shell script aCmd
end try

★Click Here to Open This Script 

Posted in drive System | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

電子書籍(PDF)をオンラインストアで販売中!

Google Search

Popular posts

  • macOS 13.6.5 AS系のバグ、一切直らず
  • 開発機としてM2 Mac miniが来たのでガチレビュー
  • CotEditorで2つの書類の行単位での差分検出
  • Apple純正マウス、キーボードのバッテリー残量取得
  • macOS 15, Sequoia
  • Cocoa-AppleScript Appletランタイムが動かない?
  • macOS 14の変更がmacOS 13にも反映
  • ディスプレイをスリープ状態にして処理続行
  • Finder上で選択中のPDFのページ数を加算
  • 初心者がつまづきやすい「log」コマンド
  • Adobe AcrobatをAppleScriptから操作してPDF圧縮
  • 与えられた文字列の1D Listのすべての順列組み合わせパターン文字列を返す v3(ベンチマーク用)
  • 当分、macOS 14へのアップデートを見送ります
  • macOS 14、英語環境で12時間表記文字と時刻の間に不可視スペースを入れる仕様に
  • macOS 13 TTS環境の変化について
  • メキシカンハットの描画
  • 新刊発売 AppleScript最新リファレンス v2.8対応
  • Pixelmator Pro v3.6.4でAppleScriptからの操作時の挙動に違和感が
  • macOS 14, Sonoma 9月27日にリリース
  • 2023年に書いた価値あるAppleScript

Tags

10.11savvy (1101) 10.12savvy (1242) 10.13savvy (1391) 10.14savvy (586) 10.15savvy (436) 11.0savvy (280) 12.0savvy (200) 13.0savvy (121) 14.0savvy (69) 15.0savvy (36) CotEditor (62) Finder (49) iTunes (19) Keynote (108) NSAlert (60) NSArray (51) NSBezierPath (18) NSBitmapImageRep (20) NSBundle (20) NSButton (34) NSColor (51) NSDictionary (27) NSFileManager (23) NSImage (41) NSJSONSerialization (21) NSMutableArray (62) NSMutableDictionary (21) NSPredicate (36) NSRunningApplication (56) NSScreen (30) NSScrollView (22) NSString (117) NSURL (97) NSURLRequest (23) NSUTF8StringEncoding (30) NSView (33) NSWorkspace (20) Numbers (65) Pages (50) Safari (44) Script Editor (23) WKUserContentController (21) WKUserScript (20) WKWebView (23) WKWebViewConfiguration (22)

カテゴリー

  • 2D Bin Packing
  • 3D
  • AirDrop
  • AirPlay
  • Animation
  • AppleScript Application on Xcode
  • Beginner
  • Benchmark
  • beta
  • Bluetooth
  • Books
  • boolean
  • bounds
  • Bug
  • Calendar
  • call by reference
  • Clipboard
  • Code Sign
  • Color
  • Custom Class
  • dialog
  • diff
  • drive
  • exif
  • file
  • File path
  • filter
  • folder
  • Font
  • Font
  • GAME
  • geolocation
  • GUI
  • GUI Scripting
  • Hex
  • History
  • How To
  • iCloud
  • Icon
  • Image
  • Input Method
  • Internet
  • iOS App
  • JavaScript
  • JSON
  • JXA
  • Keychain
  • Keychain
  • Language
  • Library
  • list
  • Locale
  • Localize
  • Machine Learning
  • Map
  • Markdown
  • Menu
  • Metadata
  • MIDI
  • MIME
  • Natural Language Processing
  • Network
  • news
  • Noification
  • Notarization
  • Number
  • Object control
  • OCR
  • OSA
  • parallel processing
  • PDF
  • Peripheral
  • PRODUCTS
  • QR Code
  • Raw AppleEvent Code
  • Record
  • rectangle
  • recursive call
  • regexp
  • Release
  • Remote Control
  • Require Control-Command-R to run
  • REST API
  • Review
  • RTF
  • Sandbox
  • Screen Saver
  • Script Libraries
  • sdef
  • search
  • Security
  • selection
  • shell script
  • Shortcuts Workflow
  • Sort
  • Sound
  • Spellchecker
  • Spotlight
  • SVG
  • System
  • Tag
  • Telephony
  • Text
  • Text to Speech
  • timezone
  • Tools
  • Update
  • URL
  • UTI
  • Web Contents Control
  • WiFi
  • XML
  • XML-RPC
  • イベント(Event)
  • 未分類

アーカイブ

  • 2024年10月
  • 2024年9月
  • 2024年8月
  • 2024年7月
  • 2024年6月
  • 2024年5月
  • 2024年4月
  • 2024年3月
  • 2024年2月
  • 2024年1月
  • 2023年12月
  • 2023年11月
  • 2023年10月
  • 2023年9月
  • 2023年8月
  • 2023年7月
  • 2023年6月
  • 2023年5月
  • 2023年4月
  • 2023年3月
  • 2023年2月
  • 2023年1月
  • 2022年12月
  • 2022年11月
  • 2022年10月
  • 2022年9月
  • 2022年8月
  • 2022年7月
  • 2022年6月
  • 2022年5月
  • 2022年4月
  • 2022年3月
  • 2022年2月
  • 2022年1月
  • 2021年12月
  • 2021年11月
  • 2021年10月
  • 2021年9月
  • 2021年8月
  • 2021年7月
  • 2021年6月
  • 2021年5月
  • 2021年4月
  • 2021年3月
  • 2021年2月
  • 2021年1月
  • 2020年12月
  • 2020年11月
  • 2020年10月
  • 2020年9月
  • 2020年8月
  • 2020年7月
  • 2020年6月
  • 2020年5月
  • 2020年4月
  • 2020年3月
  • 2020年2月
  • 2020年1月
  • 2019年12月
  • 2019年11月
  • 2019年10月
  • 2019年9月
  • 2019年8月
  • 2019年7月
  • 2019年6月
  • 2019年5月
  • 2019年4月
  • 2019年3月
  • 2019年2月
  • 2019年1月
  • 2018年12月
  • 2018年11月
  • 2018年10月
  • 2018年9月
  • 2018年8月
  • 2018年7月
  • 2018年6月
  • 2018年5月
  • 2018年4月
  • 2018年3月
  • 2018年2月

https://piyomarusoft.booth.pm/items/301502

メタ情報

  • ログイン
  • 投稿フィード
  • コメントフィード
  • WordPress.org

Forum Posts

  • 人気のトピック
  • 返信がないトピック

メタ情報

  • ログイン
  • 投稿フィード
  • コメントフィード
  • WordPress.org
Proudly powered by WordPress
Theme: Flint by Star Verte LLC