Pot.js で利用可能。 PotLite.js では利用できません。
引数 s を AppleScript としてエスケープします。
" が \" に変換されます。
Pot.globalize() が適応されている場合、Pot.escapeAppleScriptString() が escapeAppleScriptString() で実行できます。
エスケープされた文字列が返ります。
var file = Pot.escapeAppleScriptString('ヾ("ゝω・")ノ"');
var command = [
'tell application "Finder"',
' get exists of file "' + file + '" of desktop',
'end tell'
].join('\n');
Pot.debug(command);
// tell application "Finder"
// get exists of file "ヾ(\"ゝω・\")ノ\"" of desktop
// end tell