'Date: 2012/6/19
'Author: test
'Description: 

Dim IE

IE_title = "工作紀錄產生器"
Set IE = WScript.CreateObject("InternetExplorer.Application","IE_")
IE.Navigate "about:blank"
IE.ToolBar = False
IE.StatusBar = False
IE.Resizable = False
IE.Height = 450
IE.Width = 450
Set screen = IE.Document.parentWindow.screen
IE.Top = Int((screen.height - IE.Height) / 2)
IE.Left = Int((screen.width - IE.Width) / 2)
IE.Visible = True
With IE.Document
.writeln "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">"
.writeln "<html xmlns=""http://www.w3.org/1999/xhtml"">"
.writeln "<head>"
.writeln "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />"
.writeln "<title>"& IE_title &"</title>"
.writeln "</head>"
.writeln "<body>"
.writeln "<span>工作紀錄</span><br />"
.writeln "<textarea name=""record"" id=""record"" style='border: 1px solid black;width:100%;' rows=15 onpropertychange='this.style.posHeight=this.scrollHeight' onfocus='textarea.style.posHeight=this.scrollHeight'></textarea>"
.writeln "<br />"
.writeln "<span>結果:</span><br />"
.writeln "<textarea name=""output"" id=""output"" style='border: 1px solid black;width:100%;' rows=15 onpropertychange='this.style.posHeight=this.scrollHeight' onfocus='textarea.style.posHeight=this.scrollHeight'></textarea>"
.writeln "<input type=""button"" name=""copy"" id=""copy"" value=""Copy to Clipboard"" style=""width:120px;"" />"
.writeln "</body>"
.writeln "</html>"
End With

'IE.Document.getElementById("calculate").onclick = GetRef("calculate_youku_rss")
IE.Document.getElementById("record").onkeyup = GetRef("calculate_youku_rss")
'IE.Document.getElementById("copy").onclick = GetRef("copy")

Do
WScript.Sleep 1000
Loop

'Sub IE_OnQuit()
Sub IE_OnQuit()
WScript.Quit
End Sub

'Sub copy()
Sub copy()
Dim output : output = Trim(IE.Document.getElementById("output").value)
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
objIE.document.parentwindow.clipboardData.SetData "text", output
objIE.Quit
End Sub


Sub calculate_youku_rss()

Dim record : record = Trim(IE.Document.getElementById("record").value)
Dim result

If record = "" Then
Exit Sub
IE.Document.getElementById("output").value = ""
End If
output = "#開始# "& Year(Now)&"/"&Month(Now)&"/"&Day(Now) &" "& Hour(Now)-1 &":00:00 #/開始#" & vbCRLF & vbCRLF
output = output & record
output = output & vbCRLF & vbCRLF & "#結束# "& Year(Now)&"/"&Month(Now)&"/"&Day(Now) &" "& Hour(Now) &":"& Minute(Now) &":"& Second(Now) &" #/結束#"

IE.Document.getElementById("output").value = output

End Sub

arrow
arrow
    全站熱搜

    abort 發表在 痞客邦 留言(0) 人氣()