目的
山手線の路線図っぽいものを作ろうと思って作りました。
池袋
大塚
巣鴨
駒込
…
というテキストを、
■─■─■─■─ …
池 大 巣 駒 …
袋 塚 鴨 込
と変換してくれます。
あ。等幅フォントじゃないとずれるw
別に山手線じゃなくてもできます。
駅名を羅列したテキストを用意すれば。
使い方
- プログラムをhenkan.vbsとかそんなファイル名(拡張子.vbs)で保存する。
- 変換したい駅名群をコピーして、クリップボードに取り込む。
- 1で保存したプログラムをダブルクリックで実行。
とやると、クリップボードに変換された状態で格納されます。
あとはメモ帳かなんかに貼り付けるなりしてください。
ファイル
henkan.vbs
山手線駅名.txt
ResultSample.txt
プログラム
' ----------------------------------- クリップボードからテキストを取得
Dim objIE
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
Do Until objIE.ReadyState = 4
WScript.Sleep 10
Loop
Dim stations
stations = objIE.Document.parentWindow.clipboardData.getData("text")
' ----------------------------------- テキストを改行で分割して配列化
Dim stationArray
stationArray = Split(stations, vbCrLf)
' ----------------------------------- 一番長い行の長さを取得する
Dim max
max = 0
for i = 0 to UBound(stationArray)
if len(stationArray(i)) > max then max = len(stationArray(i))
next
' ----------------------------------- 縦横変換する
Dim result
for i= 0 to Ubound(stationArray)
result = result + "■"
if i < Ubound(stationArray) then result = result + "─"
next
result = result + vbCrLf
for j = 0 to max - 1
for i = 0 to UBound(stationArray)
if j < len(stationArray(i)) then
result = result + mid(stationArray(i), j+1, 1)
else
result = result + " "
end if
if i < UBound(stationArray) then result = result + " "
next
result = result + vbCrLf
next
' ----------------------------------- 出来上がった文字列をクリップボードへ
objIE.Document.parentWindow.clipboardData.setData "text", result
' ----------------------------------- 終了メッセージ
msgbox "できたよ"
objIE.Quit
おためし用(山手線駅名)
新宿
新大久保
高田馬場
目白
池袋
大塚
巣鴨
駒込
田端
西日暮里
日暮里
鶯谷
上野
御徒町
秋葉原
神田
東京
有楽町
新橋
浜松町
田町
品川
大崎
五反田
目黒
恵比寿
渋谷
原宿
代々木
トータル : -
今日 : -
昨日 : -
.
最終更新:2010年07月25日 18:01