[file]テキストファイルの文字コードと改行コードを調べる
------ファイルを選択
set theFileAlias to (choose file) as alias
------選択したファイルのUNIXパスを取得
set theUnixPass to POSIX path of theFileAlias
------fileコマンドを整形
set theDoFileCom to "file" & " \"" & theUnixPass & "\""
----theChrCodeが文字コード
set theChrCode to do shell script theDoFileCom & " | awk -F\" \" '{print($2)}' "
----theLineTerminatorsが改行コードLFはnullなのでif文で補足しLFの値も作る
set theLineTerminators to do shell script theDoFileCom & " | awk -F\" \" '{print($6)}' "
if theLineTerminators is "" then
set theLineTerminators to "LF"
end if
| 固定リンク
「AppleScriptCharacter」カテゴリの記事
- [AppleScripts]シングルクオトのエスケープ処理(phpを使う時のお約束)(2013.05.26)
- [AppleScript]YouTubeのBloggerボタンの代わり【Google Chrome専用-その2】(2013.02.11)
- [AppleScript]ユニコードエスケープをデコードする【その2:pythonを使う】(2013.02.10)
- [AppleScript]ユニコードエスケープをデコードする【その1:phpを使う】(2013.02.10)
- [file]テキストファイルの文字コードと改行コードを調べる(2012.01.15)