AppleScript SRT

[SRT]テキストファイルを縦書き用SRTファイルに変換する


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

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

################################
###設定項目
################################
(*
listTime
1項目:時間
2項目:分間
3項目:秒間
4項目:ミリ秒間
*)
set listTime to {0, 0, 0, 0} as list
###秒のカウントアップ値 1
set numCntUpSc to 3 as number

################################
###ダイアログ
################################
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDesktopPath to (ocidDesktopDirPathURL's absoluteURL()) as alias

####UTIリスト public.plain-textのみ
set listUTI to {"public.plain-text"} as list

####ダイアログを出す
set aliasFilePath to (choose file with prompt "ファイルを選んでください" default location (aliasDesktopPath) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

################################
###ファイル処理
################################
set strFilePath to POSIX path of aliasFilePath as text
####ドキュメントのパスをNSString
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
####ドキュメントのパスをNSURLに
set ocidNSUrlPath to refMe's NSURL's fileURLWithPath:ocidFilePath
####ファイル名
set ocidFileName to ocidNSUrlPath's lastPathComponent
####拡張子を除いたファイル名
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
################################
###テキスト読み込み
################################
####ファイルを読み取る
set listResults to refMe's NSString's stringWithContentsOfURL:ocidNSUrlPath encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)
set ocidReadText to item 1 of listResults
###可変テキスト初期化
set ocidReadData to refMe's NSMutableString's alloc()'s initWithCapacity:0
ocidReadData's setString:ocidReadText
###↑文字数を数える
set numCntSampleText to ocidReadData's |length|()
###↑文字数全部でレンジにする
set ocidNsRange to {location:0, |length|:numCntSampleText}
###改行コード置き換え(CR/LF)
ocidReadData's replaceOccurrencesOfString:"\r\n" withString:"\n" options:0 range:ocidNsRange
###↑文字数を数える
set numCntSampleText to ocidReadData's |length|()
###↑文字数全部でレンジにする
set ocidNsRange to {location:0, |length|:numCntSampleText}
###改行コード置き換え(CR)
ocidReadData's replaceOccurrencesOfString:"\r" withString:"\n" options:0 range:ocidNsRange
###改行でリストにする
set ocidReadDataNSArray to ocidReadData's componentsSeparatedByString:"\n"
################################
###本処理
################################
set numLineNo to 0 as number
set strOutData to "" as text
#####
repeat with objReadDataNSArray in ocidReadDataNSArray
  ###テキストに
  set strReadDataNSArray to objReadDataNSArray as text
  ###行カウントアップ
  set numLineNo to numLineNo + 1 as number
  ###スタートタイム
  set strStartTime to doHMSms(listTime)
  
  ##まず秒が加算されるといくつになるか?
  set numChkDigUp to (item 3 of listTime) + numCntUpSc
  ###↑この結果が59より大きければ繰り上がる
  if numChkDigUp ≥ 60 then
    set (item 3 of listTime) to numChkDigUp - 60
    if (item 2 of listTime) = 59 then
      set (item 2 of listTime) to 0
      ####修正箇所
      #### set (item 1 of listTime) to (item 1 of listTime) + 1
      set (item 1 of listTime) to (item 1 of listTime)
    else
      set (item 2 of listTime) to (item 2 of listTime) + 1
    end if
  else
    set (item 3 of listTime) to (item 3 of listTime) + numCntUpSc
  end if
  set (item 4 of listTime) to 0
  ####エンドタイム
  set strEndTime to doHMSms(listTime)
  
  ###テキスト整形 行番号
  set strOutData to strOutData & numLineNo & "\n" as text
  ###テキスト整形 タイムライン
  set strOutData to strOutData & strStartTime & " --> " & strEndTime & "\n" as text
  ###テキスト整形 コンテンツ
  ###1文字毎のリストに
  set listReadLineData to every text item of strReadDataNSArray
  ###出力テキスト初期化
  set strLineText to ("") as text
  ###リストの数だけ繰り返し
  repeat with itemChar in listReadLineData
    set strLineText to strLineText & itemChar & "\n"
  end repeat
  set strOutData to strOutData & strLineText & "\n" as text
end repeat

################################################
###処理が終わったテキスト
set ocidTempText to refMe's NSString's stringWithString:strOutData
######################
###フォルダのパス
###デスクトップフォルダのパス
set aliasDirPath to (path to desktop folder from user domain) as alias
set strDirPath to POSIX path of aliasDirPath as text
####作りたいファイル名(ここは今日の日付)
set strDateAndTimeJp to (my dateFormatterWithFormat:"yyyyMMdd-HHmm")
set strDistFilePath to ("" & strDirPath & ocidPrefixName & "-" & strDateAndTimeJp & ".srt")

###NSStringテキスト ファイルのパス
set objDistFilePath to refMe's NSString's stringWithString:strDistFilePath

###ファイルを作る
set boolMakeNewFile to (appFileManager's createFileAtPath:objDistFilePath |contents|:ocidTempText attributes:(missing value))
####内容を書き込む UTF8で書き込む
set boolFileWrite to (ocidTempText's writeToFile:objDistFilePath atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(missing value))

log boolMakeNewFile
log boolFileWrite
-->true or false

###############
###日付
###############
on dateFormatterWithFormat:classDateFormat
  set formatter to refMe's NSDateFormatter's alloc()'s init()
formatter's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
formatter's setDateFormat:(classDateFormat as string)
  set theString to (formatter's stringFromDate:(current date)) as text
end dateFormatterWithFormat:

###############
###時間テキストに
###############
on doHMSms(listTime)
  set strH to item 1 of listTime
  set strM to item 2 of listTime
  set strS to item 3 of listTime
  set strMs to item 4 of listTime
return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS) & "," & doAfterPadding3Dig(strMs)
end doHMSms

###############
###2桁ゼロサプレス
###############
on doPadding2Dig(numNO)
  set strNO to ("0" & numNO) as text
return text -2 thru -1 of strNO
end doPadding2Dig

###############
###3桁『逆』ゼロサブレス
###############
on doAfterPadding3Dig(numNO)
  set strNO to (numNO & "00") as text
return text 1 thru 3 of strNO
end doAfterPadding3Dig





|

[SRT]カウントダウン字幕(SRT)


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

#!/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 strFilePath to "~/Desktop/カウントアップ.srt" 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 ocidOutPutStrings to refMe's NSMutableString's alloc()'s initWithCapacity:0
###################################
##### 日付コンポーネント(タイムライン用)
###################################
###コンポーネント整理
set ocidDateComponents to refMe's NSDateComponents's alloc()'s init()
ocidDateComponents's setHour:1
ocidDateComponents's setMinute:0
ocidDateComponents's setSecond:0
###カレンダー初期化
set ocidCalendar to refMe's NSCalendar's currentCalendar()
###↑の時間をセット
set ocidData to ocidCalendar's dateFromComponents:(ocidDateComponents)

###################################
##### 日付コンポーネント(字幕表示用)
###################################
###コンポーネント整理
set ocidDateComponents4Str to refMe's NSDateComponents's alloc()'s init()
ocidDateComponents4Str's setHour:1
ocidDateComponents4Str's setMinute:30
ocidDateComponents4Str's setSecond:0
###カレンダー初期化
set ocidCalendar4Str to refMe's NSCalendar's currentCalendar()
###↑の時間をセット
set ocidData4Str to ocidCalendar4Str's dateFromComponents:(ocidDateComponents4Str)

###################################
###カウントダウン用(字幕表示用)
###################################
###カウントアップ値(10分の1秒)
set numTimeInterval4Str to -(100 / 1000)


###################################
###日付コンポーネントを利用したカウントアップ用
###################################
###カウントアップ値(10分の1秒)
set numTimeInterval to (100 / 1000)
###SRTカウンター用の値
set numCntLine to 1 as integer
###繰返しカウントアップ
##18000=60x30x10=30分
repeat 18002 times
  
  #####################srtのスタート時間
  ###日付時間の書式設定
  set ocidDateFormatterForBegin to refMe's NSDateFormatter's alloc()'s init()
  ##ocidDateFormatterForBegin's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
ocidDateFormatterForBegin's setDateFormat:"H:mm:ss,S00"
  set ocidDateStringsBegin to ocidDateFormatterForBegin's stringFromDate:(ocidData)
  set strDateStringsBegin to ocidDateStringsBegin as text
  
  #####################srtの表示用のテキストとして
  ###日付時間の書式設定
  set ocidDateFormatterForText to refMe's NSDateFormatter's alloc()'s init()
  ##ocidDateFormatterForText's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
  ##時間が必要な場合はこちら
  ## ocidDateFormatterForText's setDateFormat:"H:mm:ss.S"
  ##時間不要な場合はこちら
ocidDateFormatterForText's setDateFormat:"mm:ss.S"
  ###書式でテキスト化
  set ocidDateStrings to ocidDateFormatterForText's stringFromDate:(ocidData4Str)
  set strDateStrings to ocidDateStrings as text
  
  ########################
  ###次のカウントアップ用に、カウントアップした値をセット
  ###タイムインターバルをセット
  set ocidNewDate to ocidData's dateByAddingTimeInterval:(numTimeInterval)
  set ocidNewDate4Str to ocidData4Str's dateByAddingTimeInterval:(numTimeInterval4Str)
  
  
  #####################srtのエンド時間用
  ###日付時間の書式設定
  set ocidDateFormatterForEnd to refMe's NSDateFormatter's alloc()'s init()
  ##ocidDateFormatterForEnd's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
ocidDateFormatterForEnd's setDateFormat:"H:mm:ss,S00"
  set ocidDateStringsEnd to ocidDateFormatterForEnd's stringFromDate:(ocidNewDate)
  set strDateStringsEnd to ocidDateStringsEnd as text
  
  #####################SRTファイルの出力用テキスト
  ##出力用テキストは前からappendString
  set strLineText to (numCntLine & "\n") as text
  set strLineText to strLineText & (strDateStringsBegin & " --> " & strDateStringsEnd & "\n") as text
  set strLineText to strLineText & (strDateStrings & "\n") as text
  set strLineText to strLineText & ("\n") as text
ocidOutPutStrings's appendString:(strLineText)
  
  ####次のリピート用に加算された時間をセットする
  set ocidData to ocidNewDate
  set ocidData4Str to ocidNewDate4Str
  ####SRTファイル用のカウンターのカウントアップ
  set numCntLine to numCntLine + 1 as integer
end repeat

####出来上がったデータをテキスト保存する
set listDone to ocidOutPutStrings's writeToURL:ocidFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)





|

[SRT]カウントアップ字幕(SRT)


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

#!/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 strFilePath to "~/Desktop/output.srt" 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 ocidOutPutStrings to refMe's NSMutableString's alloc()'s initWithCapacity:0
###################################
##### 日付コンポーネント
###################################
###コンポーネント整理
set ocidDateComponents to refMe's NSDateComponents's alloc()'s init()
ocidDateComponents's setHour:1
ocidDateComponents's setMinute:0
ocidDateComponents's setSecond:0
###カレンダー初期化
set ocidCalendar to refMe's NSCalendar's currentCalendar()
###↑の時間をセット
set ocidData to ocidCalendar's dateFromComponents:(ocidDateComponents)

###################################
###日付コンポーネントを利用したカウントアップ
###################################
###カウントアップ値(10分の1秒)
set numTimeInterval to (100 / 1000)
###SRTカウンター用の値
set numCntLine to 1 as integer
###繰返しカウントアップ
##18000=60x30x10=30分
repeat 18002 times
  
  #####################srtのスタート時間
  ###日付時間の書式設定
  set ocidDateFormatterForBegin to refMe's NSDateFormatter's alloc()'s init()
  ##ocidDateFormatterForBegin's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
ocidDateFormatterForBegin's setDateFormat:"H:mm:ss,S00"
  set ocidDateStringsBegin to ocidDateFormatterForBegin's stringFromDate:(ocidData)
  set strDateStringsBegin to ocidDateStringsBegin as text
  
  #####################srtの表示用のテキストとして
  ###日付時間の書式設定
  set ocidDateFormatterForText to refMe's NSDateFormatter's alloc()'s init()
  ##ocidDateFormatterForText's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
  ##時間が必要な場合はこちら
  ## ocidDateFormatterForText's setDateFormat:"H:mm:ss.S"
  ##時間不要な場合はこちら
ocidDateFormatterForText's setDateFormat:"mm:ss.S"
  ###書式でテキスト化
  set ocidDateStrings to ocidDateFormatterForText's stringFromDate:(ocidData)
  set strDateStrings to ocidDateStrings as text
  
  ########################
  ###次のカウントアップ用に、カウントアップした値をセット
  ###タイムインターバルをセット
  set ocidNewDate to ocidData's dateByAddingTimeInterval:(numTimeInterval)
  
  #####################srtのエンド時間用
  ###日付時間の書式設定
  set ocidDateFormatterForEnd to refMe's NSDateFormatter's alloc()'s init()
  ##ocidDateFormatterForEnd's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"en_US")
ocidDateFormatterForEnd's setDateFormat:"H:mm:ss,S00"
  set ocidDateStringsEnd to ocidDateFormatterForEnd's stringFromDate:(ocidNewDate)
  set strDateStringsEnd to ocidDateStringsEnd as text
  
  #####################SRTファイルの出力用テキスト
  ##出力用テキストは前からappendString
  set strLineText to (numCntLine & "\n") as text
  set strLineText to strLineText & (strDateStringsBegin & " --> " & strDateStringsEnd & "\n") as text
  set strLineText to strLineText & (strDateStrings & "\n") as text
  set strLineText to strLineText & ("\n") as text
ocidOutPutStrings's appendString:(strLineText)
  
  ####次のリピート用に加算された時間をセットする
  set ocidData to ocidNewDate
  
  ####SRTファイル用のカウンターのカウントアップ
  set numCntLine to numCntLine + 1 as integer
end repeat

####出来上がったデータをテキスト保存する
set listDone to ocidOutPutStrings's writeToURL:ocidFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)





|

[SRT]SRTファイルをLRCファイルに変換する

#!/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
property refNSString : a reference to refMe's NSString
property refNSMutableString : a reference to refMe's NSMutableString
property refNSArray : a reference to refMe's NSArray
property refNSMutableArray : a reference to refMe's NSMutableArray
property refNSURL : a reference to refMe's NSURL


##############################################
## ファイルパス関連
##############################################
####ダイアログで使うデフォルトロケーション
tell application "Finder"
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell
####UTIリスト PDFのみ
set listUTI to {"org.niltsh.mplayerx-subrip"}
####プロンプトテキスト
set strPromptText to "SRTファイルを選んでください" as text
####ダイアログを出す
set aliasFilePath to (choose file with prompt strPromptText 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 as text
####ドキュメントのパスをNSString
set ocidFilePath to refNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidFilePathURL to refNSURL's fileURLWithPath:ocidFilePath

###ファイル名
set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
set strBaseFileName to (ocidBaseFilePathURL's lastPathComponent()) as text

####################################
#####LRCファイル保存先
####################################

set aliasDefaultLocation to (path to desktop folder from user domain) as alias
set strDefaultName to (strBaseFileName & ".lrc") as text
set strPromptText to "名前を決めてください"

set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
set strSaveFilePath to POSIX path of aliasSaveFilePath as text

####ドキュメントのパスをNSString
set ocidSaveFilePath to refNSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURL
set ocidSaveFilePathURL to refNSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not "lrc" then
set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:"lrc"
end if


####################################
#####ファイル読み込み
####################################
####LRCデータ読み取り
set listReadDataString to refNSString's stringWithContentsOfURL:ocidFilePathURL encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)
#####データ部
set ocidReadString to item 1 of listReadDataString
####エラー部
set ocidNSErrorData to item 2 of listReadDataString
if ocidNSErrorData is not (missing value) then
doGetErrorData(ocidNSErrorData)
end if
######Arrayの初期化
set ocidReadArray to refNSMutableArray's alloc()'s initWithCapacity:0
######改行毎のリストにして格納
set ocidReadArray to (ocidReadString's componentsSeparatedByString:"\n\n")
###行数
set numCntArrayItem to (count of ocidReadArray) as integer

##############################################
## 本処理
##############################################
####出力用のテキスト
set ocidOutPutString to refNSMutableString's alloc()'s initWithCapacity:0
set numCntLineNO to 0 as number
#####本処理
repeat (numCntArrayItem - 1) times
set objArrayItem to ocidReadArray's objectAtIndex:numCntLineNO
######Arrayの初期化
set ocidLineArray to refNSMutableArray's alloc()'s initWithCapacity:0
######改行毎のリストにして格納
set ocidLineArray to (objArrayItem's componentsSeparatedByString:"\n")
set ocidStartAndEndTime to (ocidLineArray's objectAtIndex:1)

######Arrayの初期化
set ocidTimeArray to refNSMutableArray's alloc()'s initWithCapacity:0
######リストにして格納
set ocidTimeArray to (ocidStartAndEndTime's componentsSeparatedByString:" ")
set strStartTime to (ocidTimeArray's objectAtIndex:0) as text
####出力用に整形
set strOutPutTime to ("[" & strStartTime & "]") as text
####時間挿入
(ocidOutPutString's appendString:strOutPutTime)
####テキスト取得
set strStringValue to (ocidLineArray's objectAtIndex:2) as text

####テキスト挿入
(ocidOutPutString's appendString:strStringValue)
#####改行
(ocidOutPutString's appendString:"\n")
###初期化
set ocidLineArray to {}
set ocidLineArray to {}
####カウントアップ
set numCntLineNO to numCntLineNO + 1 as number
end repeat

(ocidOutPutString's appendString:"\n")


##############################################
##ファイル出力
##############################################
###別名出力
set listWritetoUrlArray to ocidOutPutString's writeToURL:ocidSaveFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)
#####データ部
set boolDoneOK to item 1 of listWritetoUrlArray
log boolDoneOK
####エラー部
set ocidNSErrorData to item 2 of listWritetoUrlArray
if ocidNSErrorData is not (missing value) then
doGetErrorData(ocidNSErrorData)
end if

##############################################
## エラー発生時のログ用
##############################################


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

|

[LRC]LRCファイルをSRTファイルに変換する(DaVinci Resolve対応修正版)

#!/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
property refNSString : a reference to refMe's NSString
property refNSArray : a reference to refMe's NSArray
property refNSMutableString : a reference to refMe's NSMutableString
property refNSMutableArray : a reference to refMe's NSMutableArray

property refNSURL : a reference to refMe's NSURL

##############################################
## ファイルパス関連
##############################################
####ダイアログで使うデフォルトロケーション
tell application "Finder"
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell
####UTIリスト PDFのみ
set listUTI to {"dyn.ah62d4rv4ge8026xd", "public.lrc", "public.text"}
####プロンプトテキスト
set strPromptText to "TTMLファイルを選んでください" as text
####ダイアログを出す
set aliasLRCFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

####ファイルパス
set strFilePath to POSIX path of aliasLRCFilePath as text
####ドキュメントのパスをNSString
set ocidFilePath to refNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidFilePathURL to refNSURL's fileURLWithPath:ocidFilePath
###ファイル名
set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
set strBaseFileName to (ocidBaseFilePathURL's lastPathComponent()) as text

####################################
#####SRTファイル保存先
####################################

set aliasDefaultLocation to (path to desktop folder from user domain) as alias
set strDefaultName to (strBaseFileName & ".srt") as text
set strPromptText to "名前を決めてください"

set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
set strSaveFilePath to POSIX path of aliasSaveFilePath as text

####ドキュメントのパスをNSString
set ocidSaveFilePath to refNSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURL
set ocidSaveFilePathURL to refNSURL's fileURLWithPath:ocidSaveFilePath


####################################
#####LRCファイル処理
####################################
####LRCデータ読み取り
set listReadDataString to refNSString's stringWithContentsOfURL:ocidFilePathURL encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)
#####データ部
set ocidReadString to item 1 of listReadDataString
####エラー部
set ocidNSErrorData to item 2 of listReadDataString
if ocidNSErrorData is not (missing value) then
doGetErrorData(ocidNSErrorData)
end if
######Arrayの初期化
set ocidReadArray to refNSMutableArray's alloc()'s initWithCapacity:0
######改行毎のリストにして格納
set ocidReadArray to (ocidReadString's componentsSeparatedByString:"\n")

####################################
#####出力用テキスト
####################################
#####出力用テキストの初期化
set ocidOutPutString to refNSMutableString's alloc()'s initWithCapacity:0
#####読み取ったリストの個数を確認
set numCntReadLineNo to (count of ocidReadArray) as integer
set numCntLineNo to 0 as integer
set strSRTlineNo to 0 as integer
repeat (numCntReadLineNo - 1) times
###行番号

set objArrayItem to ocidReadArray's objectAtIndex:numCntLineNo

set strReadArrayItem to objArrayItem as text
if (text 1 through 11 of strReadArrayItem) is "[00:00.000]" then
log "情報部"

else if (text 1 through 10 of strReadArrayItem) is "[00:00.00]" then
log "タイトル部"

else
set strSRTlineNo to strSRTlineNo + 1 as text
(ocidOutPutString's appendString:strSRTlineNo)
(ocidOutPutString's appendString:"\n")
set AppleScript's text item delimiters to "]"
set listReadArrayItem to every text item of strReadArrayItem
set AppleScript's text item delimiters to ""
set strLyric to text item 2 of listReadArrayItem as text

set numOffset to (offset in strReadArrayItem of "]") as integer

set strReadArrayItemTime to (text 1 through numOffset of strReadArrayItem) as text

###########################
set strReadArrayItemTime to doReplace(strReadArrayItemTime, "[", "")
set strReadArrayItemTime to doReplace(strReadArrayItemTime, "]", "")
###########################
set strReadArrayItemTimeAdd to "00:" & strReadArrayItemTime as text
set strReadArrayItemTimeAdd to doReplace(strReadArrayItemTimeAdd, ".", ",") as text
(ocidOutPutString's appendString:strReadArrayItemTimeAdd)


(ocidOutPutString's appendString:" --> ")
set objNextArrayItem to ocidReadArray's objectAtIndex:(numCntLineNo + 1)
set strNextReadArrayItem to objNextArrayItem as text
if strNextReadArrayItem is "" then
set strNextReadArrayItem to doReplace(strReadArrayItemTime, "[", "") as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "]", "") as text
set AppleScript's text item delimiters to ":"
set listNextTime to every text item of strNextReadArrayItem
set AppleScript's text item delimiters to ""
set strSec to text item 2 of listNextTime as text
set numSec to strSec as number
set numSec to strSec + 3 as number
if numSec < 10 then
set strSec to (text 1 through 2 of ("0" & numSec) as text) & ".00" as text
else
set strSec to numSec as text
end if
set strNextReadArrayItem to (text item 1 of listNextTime as text) & ":" & strSec as text
set strNextReadArrayItem to "00:" & strNextReadArrayItem as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, ".", ",") as text
(ocidOutPutString's appendString:strNextReadArrayItem)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:strLyric)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:"\n")
exit repeat
else
set numOffset to (offset in strNextReadArrayItem of "]") as integer
set strNextReadArrayItem to (text 1 through numOffset of strNextReadArrayItem) as text
###########################
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "[", "") as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "]", "") as text
set strNextReadArrayItem to "00:" & strNextReadArrayItem as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, ".", ",") as text
###########################
(ocidOutPutString's appendString:strNextReadArrayItem)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:strLyric)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:"\n")
end if
end if

set numCntLineNo to numCntLineNo + 1 as number
end repeat
(ocidOutPutString's appendString:"\n")


log ocidOutPutString as text

####################################
#####保存
####################################
set boolWritetoUrlArray to ocidOutPutString's writeToURL:ocidSaveFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)


####################################
#####文字の置き換え
####################################

to doReplace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end doReplace

|

[SRT]テキストファイルから字幕用SRTファイルを作成する(DaVinci Resolve対応修正版)

DaVinci Resolveに対応した


#!/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 objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSMutableString : a reference to objMe's NSMutableString
property objNSURL : a reference to objMe's NSURL
property objNSMutableArray : a reference to objMe's NSMutableArray

set objFileManager to objMe's NSFileManager's defaultManager()

######ログ表示
##doLogView()

################################
###設定項目
################################

(*
listTime
1項目:時間
2項目:分間
3項目:秒間
4項目:ミリ秒間
*)
set listTime to {0, 0, 0, 0} as list
###秒のカウントアップ値 1
set numCntUpSc to 3 as number

################################
###ダイアログ
################################
####ダイアログで使うデフォルトロケーション
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(objMe's NSDesktopDirectory) inDomains:(objMe's NSUserDomainMask)) as alias

####UTIリスト public.plain-textのみ
set listUTI to {"public.plain-text"} as list

####ダイアログを出す
set aliasFilePath to (choose file with prompt "ファイルを選んでください" default location (ocidUserDesktopPath) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

################################
###ファイル処理
################################
set strFilePath to POSIX path of aliasFilePath as text
####ドキュメントのパスをNSString
set ocidFilePath to objNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidNSUrlPath to objNSURL's fileURLWithPath:ocidFilePath
####ファイル名
set ocidFileName to ocidNSUrlPath's lastPathComponent
####拡張子を除いたファイル名
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
################################
###テキスト読み込み
################################
####ファイルを読み取る
set strReadData to (objNSString's stringWithContentsOfFile:ocidFilePath encoding:(objMe's NSUTF8StringEncoding) |error|:(missing value)) as text
###可変テキスト初期化
set ocidReadData to objNSMutableString's alloc()'s initWithCapacity:0
###テキストデータを流し込み
ocidReadData's setString:strReadData
###↑文字数を数える
set numCntSampleText to ocidReadData's |length|()
###↑文字数全部でレンジにする
set ocidNsRange to {location:0, |length|:numCntSampleText}
###改行コード置き換え(CR/LF)
ocidReadData's replaceOccurrencesOfString:"\r\n" withString:"\n" options:0 range:ocidNsRange
###↑文字数を数える
set numCntSampleText to ocidReadData's |length|()
###↑文字数全部でレンジにする
set ocidNsRange to {location:0, |length|:numCntSampleText}
###改行コード置き換え(CR)
ocidReadData's replaceOccurrencesOfString:"\r" withString:"\n" options:0 range:ocidNsRange
###改行でリストにする
set ocidReadDataNSArray to ocidReadData's componentsSeparatedByString:"\n"
################################
###本処理
################################
set numLineNo to 0 as number
set strOutData to "" as text
#####
repeat with objReadDataNSArray in ocidReadDataNSArray
###テキストに
set strReadDataNSArray to objReadDataNSArray as text
###行カウントアップ
set numLineNo to numLineNo + 1 as number
###スタートタイム
set strStartTime to doHMSms(listTime)

##まず秒が加算されるといくつになるか?
set numChkDigUp to (item 3 of listTime) + numCntUpSc
###↑この結果が59より大きければ繰り上がる
if numChkDigUp60 then
set (item 3 of listTime) to numChkDigUp - 60
if (item 2 of listTime) = 59 then
set (item 2 of listTime) to 0
####修正箇所
####set (item 1 of listTime) to (item 1 of listTime) + 1
set (item 1 of listTime) to (item 1 of listTime)
else
set (item 2 of listTime) to (item 2 of listTime) + 1
end if
else
set (item 3 of listTime) to (item 3 of listTime) + numCntUpSc
end if
set (item 4 of listTime) to 0
####エンドタイム
set strEndTime to doHMSms(listTime)

###テキスト整形 行番号
set strOutData to strOutData & numLineNo & "\n" as text
###テキスト整形 タイムライン
set strOutData to strOutData & strStartTime & " --> " & strEndTime & "\n" as text
###テキスト整形 コンテンツ
set strOutData to strOutData & strReadDataNSArray & "\n\n" as text
end repeat

################################################
###処理が終わったテキスト
set ocidTempText to objNSString's stringWithString:strOutData
######################
###フォルダのパス
###デスクトップフォルダのパス
set aliasDirPath to (path to desktop folder from user domain) as alias
set strDirPath to POSIX path of aliasDirPath as text
####作りたいファイル名(ここは今日の日付)
set strDateAndTimeJp to (my dateFormatterWithFormat:"yyyyMMdd-HHmm")
set strDistFilePath to ("" & strDirPath & ocidPrefixName & "-" & strDateAndTimeJp & ".srt")

###NSStringテキスト ファイルのパス
set objDistFilePath to objNSString's stringWithString:strDistFilePath

###ファイルを作る
set boolMakeNewFile to (objFileManager's createFileAtPath:objDistFilePath |contents|:ocidTempText attributes:(missing value))
####内容を書き込む UTF8で書き込む
set boolFileWrite to (ocidTempText's writeToFile:objDistFilePath atomically:false encoding:(objMe's NSUTF8StringEncoding) |error|:(missing value))

log boolMakeNewFile
log boolFileWrite
-->true or false





###日付のサブ
on dateFormatterWithFormat:classDateFormat
set formatter to objMe's NSDateFormatter's alloc()'s init()
formatter's setLocale:(objMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
formatter's setDateFormat:(classDateFormat as string)
set theString to (formatter's stringFromDate:(current date)) as text
end dateFormatterWithFormat:



on doHMSms(listTime)
set strH to item 1 of listTime
set strM to item 2 of listTime
set strS to item 3 of listTime
set strMs to item 4 of listTime
return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS) & "," & doAfterPadding3Dig(strMs)
end doHMSms

###2桁ゼロサプレス
on doPadding2Dig(numNO)
set strNO to ("0" & numNO) as text
return text -2 thru -1 of strNO
end doPadding2Dig

###3桁逆ゼロサブレス
on doAfterPadding3Dig(numNO)
set strNO to (numNO & "00") as text
return text 1 thru 3 of strNO
end doAfterPadding3Dig





#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat

end doLogView
#########################

|

[LRC]LRCファイルをSRTファイルに変換する

#!/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
property refNSString : a reference to refMe's NSString
property refNSArray : a reference to refMe's NSArray
property refNSMutableString : a reference to refMe's NSMutableString
property refNSMutableArray : a reference to refMe's NSMutableArray

property refNSURL : a reference to refMe's NSURL

##############################################
## ファイルパス関連
##############################################
####ダイアログで使うデフォルトロケーション
tell application "Finder"
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell
####UTIリスト PDFのみ
set listUTI to {"dyn.ah62d4rv4ge8026xd", "public.lrc", "public.text"}
####プロンプトテキスト
set strPromptText to "TTMLファイルを選んでください" as text
####ダイアログを出す
set aliasLRCFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

####ファイルパス
set strFilePath to POSIX path of aliasLRCFilePath as text
####ドキュメントのパスをNSString
set ocidFilePath to refNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidFilePathURL to refNSURL's fileURLWithPath:ocidFilePath
###ファイル名
set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
set strBaseFileName to (ocidBaseFilePathURL's lastPathComponent()) as text

####################################
#####SRTファイル保存先
####################################

set aliasDefaultLocation to (path to desktop folder from user domain) as alias
set strDefaultName to (strBaseFileName & ".srt") as text
set strPromptText to "名前を決めてください"

set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
set strSaveFilePath to POSIX path of aliasSaveFilePath as text

####ドキュメントのパスをNSString
set ocidSaveFilePath to refNSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURL
set ocidSaveFilePathURL to refNSURL's fileURLWithPath:ocidSaveFilePath


####################################
#####LRCファイル処理
####################################
####LRCデータ読み取り
set listReadDataString to refNSString's stringWithContentsOfURL:ocidFilePathURL encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)
#####データ部
set ocidReadString to item 1 of listReadDataString
####エラー部
set ocidNSErrorData to item 2 of listReadDataString
if ocidNSErrorData is not (missing value) then
doGetErrorData(ocidNSErrorData)
end if
######Arrayの初期化
set ocidReadArray to refNSMutableArray's alloc()'s initWithCapacity:0
######改行毎のリストにして格納
set ocidReadArray to (ocidReadString's componentsSeparatedByString:"\n")

####################################
#####出力用テキスト
####################################
#####出力用テキストの初期化
set ocidOutPutString to refNSMutableString's alloc()'s initWithCapacity:0
#####読み取ったリストの個数を確認
set numCntReadLineNo to (count of ocidReadArray) as integer
set numCntLineNo to 0 as integer
set strSRTlineNo to 0 as integer
repeat (numCntReadLineNo - 1) times
###行番号

set objArrayItem to ocidReadArray's objectAtIndex:numCntLineNo

set strReadArrayItem to objArrayItem as text
if (text 1 through 11 of strReadArrayItem) is "[00:00.000]" then
log "情報部"

else if (text 1 through 10 of strReadArrayItem) is "[00:00.00]" then
log "タイトル部"

else
set strSRTlineNo to strSRTlineNo + 1 as text
(ocidOutPutString's appendString:strSRTlineNo)
(ocidOutPutString's appendString:"\n")
set AppleScript's text item delimiters to "]"
set listReadArrayItem to every text item of strReadArrayItem
set AppleScript's text item delimiters to ""
set strLyric to text item 2 of listReadArrayItem as text

set strReadArrayItemTime to (text 1 through 11 of strReadArrayItem) as text

###########################
set strReadArrayItemTime to doReplace(strReadArrayItemTime, "[", "")
set strReadArrayItemTime to doReplace(strReadArrayItemTime, "]", "")
set strReadArrayItemTime to doReplace(strReadArrayItemTime, "L", "0")
###########################
(ocidOutPutString's appendString:strReadArrayItemTime)
(ocidOutPutString's appendString:" --> ")
set objNextArrayItem to ocidReadArray's objectAtIndex:(numCntLineNo + 1)
set strNextReadArrayItem to objNextArrayItem as text
if strNextReadArrayItem is "" then
set strNextReadArrayItem to doReplace(strReadArrayItemTime, "[", "") as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "]", "") as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "L", "0") as text
set AppleScript's text item delimiters to ":"
set listNextTime to every text item of strNextReadArrayItem
set AppleScript's text item delimiters to ""
set strSec to text item 2 of listNextTime as text
set numSec to strSec as number
set numSec to strSec + 3 as number
set strSec to (text -1 through -6 of ("0" & numSec) as text) as text
set strNextReadArrayItem to (text item 1 of listNextTime as text) & ":" & strSec as text
(ocidOutPutString's appendString:strNextReadArrayItem)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:strLyric)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:"\n")
exit repeat
else
set strNextReadArrayItem to (text 1 through 11 of strNextReadArrayItem) as text
###########################
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "[", "") as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "]", "") as text
set strNextReadArrayItem to doReplace(strNextReadArrayItem, "L", "0") as text
###########################
(ocidOutPutString's appendString:strNextReadArrayItem)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:strLyric)
(ocidOutPutString's appendString:"\n")
(ocidOutPutString's appendString:"\n")
end if
end if

set numCntLineNo to numCntLineNo + 1 as number
end repeat
(ocidOutPutString's appendString:"\n")


log ocidOutPutString as text

####################################
#####保存
####################################
set boolWritetoUrlArray to ocidOutPutString's writeToURL:ocidSaveFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)


####################################
#####文字の置き換え
####################################

to doReplace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end doReplace

|

[SRT]2分カウントダウン(1/10MS毎)

使ったSRTファイル

ダウンロード - 2mincountdowntimeline.srt


DaVinci ResolveからのTTML

ダウンロード - 2mincountdowntimeline.srt.ttml





#!/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
property refNSString : a reference to refMe's NSString
property refNSArray : a reference to refMe's NSArray
property refNSMutableString : a reference to refMe's NSMutableString
property refNSMutableArray : a reference to refMe's NSMutableArray

property refNSURL : a reference to refMe's NSURL

####################################
#####設定
####################################

(*
listTime
1項目:時間
2項目:分間
3項目:秒間
4項目:ミリ秒間 3桁ですが実処理として1/10秒までが処理の限界
*)
set listTime to {0, 0, 0, 0} as list

###時のカウントアップ値 023
set numCntUpH to 0 as integer
###分のカウントアップ値 059
set numCntUpM to 0 as integer
###秒のカウントアップ値 059
set numCntUpS to 0 as integer
###ミリ秒のカウントアップ値 0999
set numCntUpMs to 100 as integer

####ミリ秒の区切りテキスト
-->SRTはカンマ
-->TTMLはドット
set strSepMS to "," as text
####繰り返し数(600で1分)
set numRepeatTimes to 1200 as integer



####################################
#####SRTファイル保存先
####################################

set aliasDefaultLocation to (path to desktop folder from user domain) as alias
set strDefaultName to "TimeLine.srt" as text
set strPromptText to "名前を決めてください"

set aliasPath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
set strFilePath to POSIX path of aliasPath as text

####ドキュメントのパスをNSString
set ocidFilePath to refNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidFilePathURL to refNSURL's fileURLWithPath:ocidFilePath


####################################
#####逆順の処理用
####################################

####時間用のリストの初期化
set ocidRevTimeArray to refNSMutableArray's alloc()'s initWithCapacity:0


####################################
#####逆順用リスト処理
####################################

####時間用のリストの初期化
set ocidTimeArray to refNSMutableArray's alloc()'s initWithArray:listTime copyItems:true
####項番初期化
set numCntLineNo to 1 as integer

###サンプル200回繰り返し
repeat numRepeatTimes times


####################################
######エンドタイム
####################################
#########ミリ秒の処理
set numMS2Add to (item 4 of ocidTimeArray as integer) + numCntUpMs as integer
if numMS2Add > 999 then
set numEndMS to (numMS2Add - 1000) as integer
set strEndMS to doAfterPadding3Dig(numEndMS) as text
####秒に繰り上がり
set numEndAddS to 1 as integer
else
set numEndMS to numMS2Add as integer
set strEndMS to doAfterPadding3Dig(numEndMS) as text
###繰り上がり無し
set numEndAddS to 0 as integer
end if

####################################
#########秒の処理
set numS2Add to (item 3 of ocidTimeArray as integer) + numCntUpS + numEndAddS as integer

if numS2Add > 59 then
set numEndS to (numS2Add - 60) as integer
set strEndS to doPadding2Dig(numEndS) as text
####分に繰り上がり
set numEndAddM to 1 as integer
else
set numEndS to numS2Add as integer
set strEndS to doPadding2Dig(numEndS) as text
set numEndAddM to 0 as integer
end if

####################################
#########分の処理
set numM2Add to (item 2 of ocidTimeArray as integer) + numCntUpM + numEndAddM as integer
if numM2Add > 59 then
set numEndM to (numM2Add - 60) as integer
set strEndM to doPadding2Dig(numEndM) as text
####時に繰り上がり
set numEndAddH to 1 as integer
else
set numEndM to numM2Add as integer
set strEndM to doPadding2Dig(numEndM) as text
set numEndAddH to 0 as integer
end if

####################################
#########時の処理
set numH2Add to (item 1 of ocidTimeArray as integer) + numCntUpH + numEndAddH as integer

if numH2Add > 23 then
return "エラー 24時間を超える値は処理対象外"
else
set numEndH to numH2Add as integer
set strEndH to doPadding2Dig(numEndH) as text
end if

##########逆順テキスト
set str1Dig to doPadding1Dig(strEndMS)
set strCntentsTime to ("" & strEndM & ":" & strEndS & ":" & str1Dig & "") as text
ocidRevTimeArray's insertObject:strCntentsTime atIndex:0


####################################
####リストの値を更新
ocidTimeArray's replaceObjectAtIndex:3 withObject:numEndMS
ocidTimeArray's replaceObjectAtIndex:2 withObject:numEndS
ocidTimeArray's replaceObjectAtIndex:1 withObject:numEndM
ocidTimeArray's replaceObjectAtIndex:0 withObject:numEndH

##項番カウントアップ
set numCntLineNo to numCntLineNo + 1 as number
end repeat


####################################
#####処理
####################################
####時間用のリストの初期化
set ocidTimeArray to refNSMutableArray's alloc()'s initWithArray:listTime copyItems:true
####出力用のテキスト
set ocidOutPutString to refNSMutableString's alloc()'s initWithCapacity:0
####項番カウント初期化
set numCntLineNo to 1 as integer
#####逆順リストのカウント初期化
set numRevCntLineNo to 0 as integer

###サンプル200回繰り返し
repeat numRepeatTimes times
####################################
#####項番の処理
####################################
(ocidOutPutString's appendString:(numCntLineNo as text))
(ocidOutPutString's appendString:"\n")
####################################
######スタートタイム
####################################
set strStartH to (doPadding2Dig(item 1 of ocidTimeArray as integer)) as text
set strStartM to (doPadding2Dig(item 2 of ocidTimeArray as integer)) as text
set strStartS to (doPadding2Dig(item 3 of ocidTimeArray as integer)) as text
set strStartMS to (doAfterPadding3Dig(item 4 of ocidTimeArray as integer)) as text
set strStartTime to ("" & strStartH & ":" & strStartM & ":" & strStartS & strSepMS & strStartMS & "") as text

####################################
######エンドタイム
####################################
#########ミリ秒の処理
set numMS2Add to (item 4 of ocidTimeArray as integer) + numCntUpMs as integer
if numMS2Add > 999 then
set numEndMS to (numMS2Add - 1000) as integer
set strEndMS to doAfterPadding3Dig(numEndMS) as text
####秒に繰り上がり
set numEndAddS to 1 as integer
else
set numEndMS to numMS2Add as integer
set strEndMS to doAfterPadding3Dig(numEndMS) as text
###繰り上がり無し
set numEndAddS to 0 as integer
end if

####################################
#########秒の処理
set numS2Add to (item 3 of ocidTimeArray as integer) + numCntUpS + numEndAddS as integer

if numS2Add > 59 then
set numEndS to (numS2Add - 60) as integer
set strEndS to doPadding2Dig(numEndS) as text
####分に繰り上がり
set numEndAddM to 1 as integer
else
set numEndS to numS2Add as integer
set strEndS to doPadding2Dig(numEndS) as text
set numEndAddM to 0 as integer
end if

####################################
#########分の処理
set numM2Add to (item 2 of ocidTimeArray as integer) + numCntUpM + numEndAddM as integer
if numM2Add > 59 then
set numEndM to (numM2Add - 60) as integer
set strEndM to doPadding2Dig(numEndM) as text
####時に繰り上がり
set numEndAddH to 1 as integer
else
set numEndM to numM2Add as integer
set strEndM to doPadding2Dig(numEndM) as text
set numEndAddH to 0 as integer
end if

####################################
#########時の処理
set numH2Add to (item 1 of ocidTimeArray as integer) + numCntUpH + numEndAddH as integer

if numH2Add > 23 then
return "エラー 24時間を超える値は処理対象外"
else
set numEndH to numH2Add as integer
set strEndH to doPadding2Dig(numEndH) as text
end if
####################################
#########テキスト整形
set strEndTime to ("" & strEndH & ":" & strEndM & ":" & strEndS & strSepMS & strEndMS & "") as text
set strTimeCode to ("" & strStartTime & " --> " & strEndTime) as text
(ocidOutPutString's appendString:strTimeCode)
(ocidOutPutString's appendString:"\n")

####################################
#########テキスト部を追加する場合はここに

set ocidArrayOfIndex to ocidRevTimeArray's objectAtIndex:numRevCntLineNo
set strTimeCode to ocidArrayOfIndex as text
set numRevCntLineNo to numRevCntLineNo + 1 as integer

(ocidOutPutString's appendString:strTimeCode)
(ocidOutPutString's appendString:"\n")


####################################
####リストの値を更新
ocidTimeArray's replaceObjectAtIndex:3 withObject:numEndMS
ocidTimeArray's replaceObjectAtIndex:2 withObject:numEndS
ocidTimeArray's replaceObjectAtIndex:1 withObject:numEndM
ocidTimeArray's replaceObjectAtIndex:0 withObject:numEndH

#####項目区切り
(ocidOutPutString's appendString:"\n")
##項番カウントアップ
set numCntLineNo to numCntLineNo + 1 as number
end repeat

log ocidOutPutString as text
###別名出力
set boolWritetoUrlArray to ocidOutPutString's writeToURL:ocidFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)



on doHMSms(listTime)
set strH to item 1 of listTime
set strM to item 2 of listTime
set strS to item 3 of listTime
set strMS to item 4 of listTime
return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS) & "," & doAfterPadding3Dig(strMS)
end doHMSms

###先頭の1桁を取得
on doPadding1Dig(numNO)
set strNO to numNO as text
set strNO to first character of strNO as text
return strNO
end doPadding1Dig

###2桁ゼロサプレス
on doPadding2Dig(numNO)
set strNO to ("0" & numNO) as text
return text -2 thru -1 of strNO
end doPadding2Dig

###3桁逆ゼロサブレス
on doAfterPadding3Dig(numNO)
set strNO to numNO as text
set strNO to (strNO & "00") as text
set strReturnText to (text 1 thru 3 of strNO) as text
return strReturnText
end doAfterPadding3Dig

|

[SRT]1分カウントアップ(1/10MS毎)

使ったSRTファイル

ダウンロード - 1m.srt


DaVinci ResolveからのTTML

ダウンロード - 1m.ttml




#!/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
property refNSString : a reference to refMe's NSString
property refNSArray : a reference to refMe's NSArray
property refNSMutableString : a reference to refMe's NSMutableString
property refNSMutableArray : a reference to refMe's NSMutableArray

property refNSURL : a reference to refMe's NSURL

####################################
#####設定
####################################

(*
listTime
1項目:時間
2項目:分間
3項目:秒間
4項目:ミリ秒間 3桁ですが実処理として1/10秒までが処理の限界
*)
set listTime to {0, 0, 0, 0} as list

###時のカウントアップ値 023
set numCntUpH to 0 as integer
###分のカウントアップ値 059
set numCntUpM to 0 as integer
###秒のカウントアップ値 059
set numCntUpS to 0 as integer
###ミリ秒のカウントアップ値 0999
set numCntUpMs to 100 as integer

####ミリ秒の区切りテキスト
-->SRTはカンマ
-->TTMLはドット
set strSepMS to "," as text
####繰り返し数
set numRepeatTimes to 600 as integer



####################################
#####SRTファイル保存先
####################################

set aliasDefaultLocation to (path to desktop folder from user domain) as alias
set strDefaultName to "TimeLine.srt" as text
set strPromptText to "名前を決めてください"

set aliasPath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
set strFilePath to POSIX path of aliasPath as text

####ドキュメントのパスをNSString
set ocidFilePath to refNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidFilePathURL to refNSURL's fileURLWithPath:ocidFilePath



####################################
#####処理
####################################
####時間用のリストの初期化
set ocidTimeArray to refNSMutableArray's alloc()'s initWithArray:listTime copyItems:true
####出力用のテキスト
set ocidOutPutString to refNSMutableString's alloc()'s initWithCapacity:0
####項番初期化
set numCntLineNo to 1 as integer



###サンプル200回繰り返し
repeat numRepeatTimes times
####################################
#####項番の処理
####################################
(ocidOutPutString's appendString:(numCntLineNo as text))
(ocidOutPutString's appendString:"\n")
####################################
######スタートタイム
####################################
set strStartH to (doPadding2Dig(item 1 of ocidTimeArray as integer)) as text
set strStartM to (doPadding2Dig(item 2 of ocidTimeArray as integer)) as text
set strStartS to (doPadding2Dig(item 3 of ocidTimeArray as integer)) as text
set strStartMS to (doAfterPadding3Dig(item 4 of ocidTimeArray as integer)) as text
set strStartTime to ("" & strStartH & ":" & strStartM & ":" & strStartS & strSepMS & strStartMS & "") as text

####################################
######エンドタイム
####################################
#########ミリ秒の処理
set numMS2Add to (item 4 of ocidTimeArray as integer) + numCntUpMs as integer
if numMS2Add > 999 then
set numEndMS to (numMS2Add - 1000) as integer
set strEndMS to doAfterPadding3Dig(numEndMS) as text
####秒に繰り上がり
set numEndAddS to 1 as integer
else
set numEndMS to numMS2Add as integer
set strEndMS to doAfterPadding3Dig(numEndMS) as text
###繰り上がり無し
set numEndAddS to 0 as integer
end if

####################################
#########秒の処理
set numS2Add to (item 3 of ocidTimeArray as integer) + numCntUpS + numEndAddS as integer

if numS2Add > 59 then
set numEndS to (numS2Add - 60) as integer
set strEndS to doPadding2Dig(numEndS) as text
####分に繰り上がり
set numEndAddM to 1 as integer
else
set numEndS to numS2Add as integer
set strEndS to doPadding2Dig(numEndS) as text
set numEndAddM to 0 as integer
end if

####################################
#########分の処理
set numM2Add to (item 2 of ocidTimeArray as integer) + numCntUpM + numEndAddM as integer
if numM2Add > 59 then
set numEndM to (numM2Add - 60) as integer
set strEndM to doPadding2Dig(numEndM) as text
####時に繰り上がり
set numEndAddH to 1 as integer
else
set numEndM to numM2Add as integer
set strEndM to doPadding2Dig(numEndM) as text
set numEndAddH to 0 as integer
end if

####################################
#########時の処理
set numH2Add to (item 1 of ocidTimeArray as integer) + numCntUpH + numEndAddH as integer

if numH2Add > 23 then
return "エラー 24時間を超える値は処理対象外"
else
set numEndH to numH2Add as integer
set strEndH to doPadding2Dig(numEndH) as text
end if


####################################
#########テキスト整形
set strEndTime to ("" & strEndH & ":" & strEndM & ":" & strEndS & strSepMS & strEndMS & "") as text
set strTimeCode to ("" & strStartTime & " --> " & strEndTime) as text
(ocidOutPutString's appendString:strTimeCode)
(ocidOutPutString's appendString:"\n")

####################################
#########テキスト部を追加する場合はここに

set str1Dig to doPadding1Dig(strEndMS)
set strCntentsTime to ("" & strEndM & ":" & strEndS & ":" & str1Dig & "") as text
(ocidOutPutString's appendString:strCntentsTime)
(ocidOutPutString's appendString:"\n")

####################################
####リストの値を更新
ocidTimeArray's replaceObjectAtIndex:3 withObject:numEndMS
ocidTimeArray's replaceObjectAtIndex:2 withObject:numEndS
ocidTimeArray's replaceObjectAtIndex:1 withObject:numEndM
ocidTimeArray's replaceObjectAtIndex:0 withObject:numEndH

#####項目区切り
(ocidOutPutString's appendString:"\n")
##項番カウントアップ
set numCntLineNo to numCntLineNo + 1 as number
end repeat

log ocidOutPutString as text
###別名出力
set boolWritetoUrlArray to ocidOutPutString's writeToURL:ocidFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)



on doHMSms(listTime)
set strH to item 1 of listTime
set strM to item 2 of listTime
set strS to item 3 of listTime
set strMS to item 4 of listTime
return doPadding2Dig(strH) & ":" & doPadding2Dig(strM) & ":" & doPadding2Dig(strS) & "," & doAfterPadding3Dig(strMS)
end doHMSms

###先頭の1桁を取得
on doPadding1Dig(numNO)
set strNO to numNO as text
set strNO to first character of strNO as text
return strNO
end doPadding1Dig

###2桁ゼロサプレス
on doPadding2Dig(numNO)
set strNO to ("0" & numNO) as text
return text -2 thru -1 of strNO
end doPadding2Dig

###3桁逆ゼロサブレス
on doAfterPadding3Dig(numNO)
set strNO to numNO as text
set strNO to (strNO & "00") as text
set strReturnText to (text 1 thru 3 of strNO) as text
return strReturnText
end doAfterPadding3Dig

|

[srt] srt字幕ファイルからYoutube用のチャプターテキストを作成する

#!/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
property refNSString : a reference to refMe's NSString
property refNSMutableString : a reference to refMe's NSMutableString
property refNSMutableArray : a reference to refMe's NSMutableArray

property refNSURL : a reference to refMe's NSURL


##############################################
## ファイルパス関連
##############################################
####ダイアログで使うデフォルトロケーション
tell application "Finder"
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell
####UTIリスト PDFのみ
set listUTI to {"org.niltsh.mplayerx-subrip", "public.txt"}
####プロンプトテキスト
set strPromptText to "SRTファイルを選んでください" as text
####ダイアログを出す
set aliasFilePath to (choose file with prompt strPromptText 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
####ドキュメントのパスをNSString
set ocidFilePath to refNSString's stringWithString:strFilePath
####ドキュメントのパスをNSURL
set ocidFilePathURL to refNSURL's fileURLWithPath:ocidFilePath


##############################################
## データ読み取り
##############################################
####テキストで読み込み
set listReadDataString to (refNSString's stringWithContentsOfURL:ocidFilePathURL encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))

#####データ部
set ocidReadString to item 1 of listReadDataString
####エラー部
set ocidNSErrorData to item 2 of listReadDataString
if ocidNSErrorData is not (missing value) then
doGetErrorData(ocidNSErrorData)
end if





##############################################
## テキスト加工部
##############################################
###可変テキスト初期化
set ocidReadData to refNSMutableString's alloc()'s initWithCapacity:0
###テキストデータを流し込み
ocidReadData's setString:ocidReadString
###########################
###↑文字数を数える
set numCntSampleText to ocidReadData's |length|()
###↑文字数全部でレンジにする
set ocidNsRange to {location:0, |length|:numCntSampleText}
###改行コード置き換え(CR/LF)
ocidReadData's replaceOccurrencesOfString:"\r\n" withString:"\n" options:0 range:ocidNsRange
###########################
###↑文字数を数える
set numCntSampleText to ocidReadData's |length|()
###↑文字数全部でレンジにする
set ocidNsRange to {location:0, |length|:numCntSampleText}
###改行コード置き換え(CR/LF)
ocidReadData's replaceOccurrencesOfString:"\r" withString:"\n" options:0 range:ocidNsRange
#####並び替え用のリストの初期化
set ocidMutableArray to refNSMutableArray's alloc()'s initWithCapacity:0
#####テキストをリストに格納
set ocidMutableArray to ocidReadString's componentsSeparatedByString:"\n\n"

set strOutPut to "" as text

repeat with objArray in ocidMutableArray
if (objArray as text) is "" then
exit repeat
end if
set ocidObjArrayLine to (objArray's componentsSeparatedByString:"\n")
set strLineNo to (item 1 of ocidObjArrayLine) as text
set strLineNo to (text -2 through -1 of ("00" & strLineNo)) as text
set strOutPut to strOutPut & strLineNo & " " as text
set ocidTimeArray to ((item 2 of ocidObjArrayLine)'s componentsSeparatedByString:" ")
set ocidTimeArrayLong to ((item 1 of ocidTimeArray)'s componentsSeparatedByString:",")
set ocidTimeArrayItem to ((item 1 of ocidTimeArrayLong)'s componentsSeparatedByString:":")
set strNUMH to item 1 of ocidTimeArrayItem as text
set numH to strNUMH as number
set numH to numH - 1 as number
set strH to (text -2 through -1 of ("00" & numH)) as text
set strOutPut to strOutPut & strH & ":" & (item 2 of ocidTimeArrayItem as text) & ":" & (item 3 of ocidTimeArrayItem as text) & " "
set strOutPut to strOutPut & (item 3 of ocidObjArrayLine)
set strOutPut to strOutPut & "\n"
end repeat

set ocidOutPut to refNSString's stringWithString:strOutPut

##########################
####ドキュメントのパスをNSString
set ocidFilePath to refNSString's stringWithString:strFilePath
#####出力ファイル名付与
set ocidOutFilePath to ocidFilePath's stringByAppendingString:".out.text"
#####NSURL
set ocidSaveFilePathURL to refNSURL's alloc()'s initFileURLWithPath:ocidOutFilePath
###別名出力
set boolWritetoUrlArray to ocidOutPut's writeToURL:ocidSaveFilePathURL atomically:true encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)


##############################################
## エラー発生時のログ用
##############################################


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

|

その他のカテゴリー

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