テキストファイルをリストに読み込む簡単なコードがあります。これは、この形式のCMYK値のリストです:00, 100, 64, 33
。何らかの理由で、出力がスペースを奇妙な文字で置き換えています... "¬†"(返信と短剣?)。Applescript:スペースを置き換える奇妙な文字( "¬†")
ので、このスクリプト:
set cmykList to {}
set eachLine to paragraphs of (read POSIX file "/Users/me/Desktop/cmyk.txt")
repeat with nextLine in eachLine
if length of nextLine is greater than 0 then
copy (nextLine as text) to the end of cmykList
end if
end repeat
choose from list cmykList
リターン: 00,¬†100,¬†64,¬†33, 00,¬†00,¬†00,¬†00, 100,¬†72,¬†00, 100,¬†35,¬†00,¬†100
これは、なぜ上の任意のアイデア、そしてどのように私はこれを避けることができますか?
テキストファイルがそのようにように設定されています
00, 100, 64, 33
00, 00, 00, 00
100, 72, 00, 18
100, 35, 00, 100
00, 16, 100, 00
00, 100, 63, 29
00, 66, 100, 07
03, 00, 00, 32
100, 35, 00, 100
00, 100, 81, 04
04, 02, 00, 45
00, 00, 00, 00
03, 00, 00, 32
100, 35, 00, 100
編集:検索/置き換えをやって、この問題を解決しました:
set cmykList to {}
set eachLine to paragraphs of (read POSIX file "/Users/me/Desktop/cmyk.txt")
repeat with nextLine in eachLine
if length of nextLine is greater than 0 then
set theText to (nextLine as text)
set AppleScript's text item delimiters to " "
set theTextItems to text items of theText
set AppleScript's text item delimiters to " "
set theText to theTextItems as string
set AppleScript's text item delimiters to {""}
copy (theText as text) to the end of cmykList
end if
end repeat
set chooseList to choose from list cmykList
しかし、まだこれが最初に起こった理由としては非常に好奇心場所。