今更ながら JavaScript で半角 → 全角

まあ、半角・全角という表現がアレなのはおいておいてください。

最近、郵送にクリックポストという手段を使うのですが、ヤマトのメール便に似た感じのサービスで、A4 サイズ、3cm までの厚みのものが安価に送れます。

ウェブで送り先などを入力して、ラベルを作成するんですが、ある程度の数になると、それが結構面倒臭いんですよね。

需要があるのか、さっぱりわかりませんが、重松は住所録ソフトは筆まめを使っているんですが、その筆まめの住所データーをいちいち Windows と Mac とを切り替えながらコピペするのも面倒くさいので、自動化しました。

その時、住所は半角があってはいけないので、変換する必要があるんですが、以前は、Script Managaer を使って変換していたんですけど、もう OSAX がどっかに行ってしまっているし、JavaScript でやることにしました。

以下のページを参考にしました。

tell application "Finder"
    set myText to the clipboard
end tell

tell application "Safari"
    set myClickPostDocument to 0
    
    set myNumOfDocuments to count every document
    repeat with myDocumentNum from 1 to myNumOfDocuments
        set theDocumentTitle to do JavaScript "document.title" in document myDocumentNum
        if theDocumentTitle contains "新規発送" then
            set myClickPostDocument to myDocumentNum
            exit repeat
        end if
    end repeat
    
    if myClickPostDocument is 0 then
        say "click post document was not found"
        return
    end if
    
    tell application "Finder" to set myClip to the clipboard
    set buf to AppleScript's text item delimiters
    set AppleScript's text item delimiters to " "
    set myData to every text item of myClip
    set AppleScript's text item delimiters to buf
        
    set myName to item 4 of myData
    set myZip to item 67 of myData
    set myAddr to item 68 of myData
    if 0 < (length of (item 69 of myData)) then set myAddr to myAddr & item 69 of myData
    
    tell document myClickPostDocument
        do JavaScript "
document.querySelector('div.edit_panel input[name$=id39]').value='おふだ';
document.querySelector('div.edit_panel input[name$=no_missive]').checked=true;
document.querySelector('div.edit_panel input[name$=checked_pack_size]').checked=true;

myZip = '" & myZip & "';

document.querySelector('div.edit_panel input[name$=zip1]').value = myZip.substr(0,3);
document.querySelector('div.edit_panel input[name$=zip2]').value = myZip.substr(4,4);

myAddr = '" & myAddr & "'.replace(/[!-~]/g, function(s) {
    return String.fromCharCode(s.charCodeAt(0) + 0xFEE0);
});
myAddr = myAddr.replace(/^愛媛県/,'');
document.querySelector('div.edit_panel textarea[name$=receiver_address]').value = myAddr;

myName = '" & myName & "';
document.querySelector('div.edit_panel input[name$=receiver_name]').value = myName;
"
    end tell
end tell

サブウーファーを買ったんですが…

2015-08-07 22.48.22

ヤマハの YST-SW010(B)、サブウーファーを買ったんです。
9,110 円ですが、ポイント 10% なので、まあ、8,000 円強でしょうか。

キャンターにウーファーをつけたら、やはりあるのが当たり前の気がしてきて、家のミニコンポの音が薄く感じてしまうんですよね。
Bluetooth で Mac や、iPhone なんかの外部スピーカーとしても使っているんですが、実は、買っただけでずっと使ってなかった nasne を iPad に入れた torne mobile で使うようになったので、少しでもいい環境にしたくて。

とはいえ、倉庫にしまってある糞でかいテレビを屋根裏にもってあがって、シアターシステムを使えるようにするためには、まず階段を作らないといけないと思うんで、まあ、それはいつの事になるかわからないので、それまでのつなぎとしてサブウーファーを追加することにしたんです。

2015-08-07 22.49.00で、まあ、サブウーファーですからね、普通に電源を繋いで、サブウーファー出力に RCA ケーブルで繋ぐ以外にすることはないと思うんですが、鳴らないんです。

故障か、それとも、ボリュームを絞り過ぎかと、いろいろ試すんですが、全く鳴らない。

普通に LINE OUT に繋ぐとなるので、サブウーファー出力から出力されてないとしか思えないのです。

重い腰を上げて、マニュアルを読むと、どうやらリモコンで設定する必要があるようなんです。

が、リモコン、行方不明…

とりあえず、週末はメーカが休みだったので、今日、電話をしてリモコン無しで設定することができないか確認してみようと思います。