Created
July 11, 2017 02:34
-
-
Save uchcode/b8fef9ddfbcfcd26503e4edabd6018bf to your computer and use it in GitHub Desktop.
UTF-8 テキストファイルを読み込む ref: http://qiita.com/tom-u/items/a076a77b0cc023a29f65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function app_read(handle, scpt='') { | |
| let a = Application.currentApplication() | |
| a.includeStandardAdditions = true | |
| return a.runScript(`on run argv | |
| read (item 1 of argv) ${scpt} | |
| end`, {in:'AppleScript', withParameters:handle}) | |
| } | |
| app = Application.currentApplication() | |
| app.includeStandardAdditions = true | |
| p = '/Users/uchcode/Desktop/example.txt' | |
| h = app.openForAccess(p) | |
| r = app_read(h,'as «class utf8»') | |
| app.closeAccess(p) | |
| console.log(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment