February 16, 2009

Random Font Size

窗邊飛來 了三隻小雀
它們似乎告訴我要好好放輕鬆
夏天的味道像肉桂香般如此甜美
看著大街上女孩們開心的玩著跳繩
也許 有時候
做自己其實也沒什麼不好ㄚ
物換星移
但舊愛還是最美
好啦,別再胡思亂想了

將txt檔案中所有中文字,隨機取字設任意大小(html 格式)
執行結果如下:

rfs.JPG


Dim p,s,re
If Wscript.Arguments.Count=0 Then
Msgbox "將文件拖到圖示上!"
Wscript.Quit
End If
For i= 0 to Wscript.Arguments.Count - 1
p=Wscript.Arguments(i)
With CreateObject("Adodb.Stream")
.Type=2
.Charset="BIG5"'"GB2312"
.Open
.LoadFromFile=p
s=.ReadText
Set re =New RegExp
re.Pattern= "[^\x00-\xff]"
re.Global = True
If Not re.Test(s) Then
Msgbox "檔案無內容"
Wscript.Quit
End If
Set Matches = re.Execute(s)
s=""
For Each Match In Matches
Randomize
size = abs(Int((6 - 13) * Rnd))
if size > abs(Int((6 - 13) * Rnd)) then
s=s & "" & Match.Value & ""
else
s=s & Match.Value
end if
Next
.Position=0
.setEOS
.WriteText s
.SaveToFile p & "'s resize.html",2
.Close
End With
Next
Msgbox "DONE!"

---------------------------------
Script 首發!!

Recent Entries

  1. Random Font Size