Merge pull request #631 from cxd4/whitespace

whitespace
This commit is contained in:
zilmar 2015-09-26 20:48:33 +10:00
commit 074e735ccc
1 changed files with 23 additions and 23 deletions

View File

@ -31,7 +31,7 @@ Sub Wait(IE)
end if end if
end if end if
Next Next
if not complete then if not complete then
WScript.StdOut.WriteLine "Failed to wait for IE" WScript.StdOut.WriteLine "Failed to wait for IE"
WScript.Quit WScript.Quit
@ -45,7 +45,7 @@ Sub Navigate(IE, url)
End Sub End Sub
Sub ValidateLoggedIn(IE) Sub ValidateLoggedIn(IE)
WScript.StdOut.WriteLine "ValidateLoggedIn start" WScript.StdOut.WriteLine "ValidateLoggedIn start"
Navigate IE, "http://forum.pj64-emu.com/" Navigate IE, "http://forum.pj64-emu.com/"
Wait IE Wait IE
@ -117,11 +117,11 @@ Sub Login(IE)
WScript.StdOut.WriteLine "Failed to find redirect" WScript.StdOut.WriteLine "Failed to find redirect"
WScript.Quit WScript.Quit
end if end if
WScript.StdOut.WriteLine "found redirect" WScript.StdOut.WriteLine "found redirect"
Navigate IE, "http://forum.pj64-emu.com/" Navigate IE, "http://forum.pj64-emu.com/"
Wait IE Wait IE
WScript.StdOut.WriteLine "Quitting IE2" WScript.StdOut.WriteLine "Quitting IE2"
IE2.Quit IE2.Quit
ValidateLoggedIn IE ValidateLoggedIn IE
@ -133,7 +133,7 @@ Sub PostThread(IE)
WScript.StdOut.WriteLine "PostThread start" WScript.StdOut.WriteLine "PostThread start"
Navigate IE, "http://forum.pj64-emu.com/newthread.php?do=newthread&f=10" Navigate IE, "http://forum.pj64-emu.com/newthread.php?do=newthread&f=10"
Wait IE Wait IE
Set NodeList = IE.document.getElementsByTagName("input") Set NodeList = IE.document.getElementsByTagName("input")
Dim submitButton Dim submitButton
For Each Elem In NodeList For Each Elem In NodeList
@ -143,7 +143,7 @@ Sub PostThread(IE)
exit for exit for
end if end if
Next Next
if submitButton is nothing then if submitButton is nothing then
WScript.StdOut.WriteLine "failed to find submit button" WScript.StdOut.WriteLine "failed to find submit button"
WScript.Quit WScript.Quit
@ -151,7 +151,7 @@ Sub PostThread(IE)
SetPostDetails IE, WScript.Arguments(2) SetPostDetails IE, WScript.Arguments(2)
UploadFile WScript.Arguments(1) UploadFile WScript.Arguments(1)
WScript.StdOut.WriteLine "submitting" WScript.StdOut.WriteLine "submitting"
submitButton.click submitButton.click
Wait IE Wait IE
@ -213,7 +213,7 @@ Sub SetPostDetails(IE, BuildUrl)
WScript.StdOut.WriteLine "PostTitle = """ & PostTitle & """" WScript.StdOut.WriteLine "PostTitle = """ & PostTitle & """"
WScript.StdOut.WriteLine "PostContent = """ & PostContent & """" WScript.StdOut.WriteLine "PostContent = """ & PostContent & """"
Dim SetTitle Dim SetTitle
SetTitle = False SetTitle = False
Set NodeList = IE.document.getElementsByTagName("input") Set NodeList = IE.document.getElementsByTagName("input")
@ -229,7 +229,7 @@ Sub SetPostDetails(IE, BuildUrl)
WScript.StdOut.WriteLine "failed to set post title" WScript.StdOut.WriteLine "failed to set post title"
WScript.Quit WScript.Quit
end if end if
Dim SetMessage Dim SetMessage
SetMessage = False SetMessage = False
Set NodeList = IE.document.getElementsByTagName("textarea") Set NodeList = IE.document.getElementsByTagName("textarea")
@ -246,7 +246,7 @@ Sub SetPostDetails(IE, BuildUrl)
WScript.StdOut.WriteLine "failed to set post message" WScript.StdOut.WriteLine "failed to set post message"
WScript.Quit WScript.Quit
end if end if
end sub end sub
sub UploadFile(FileToUpload) sub UploadFile(FileToUpload)
@ -273,14 +273,14 @@ sub UploadFile(FileToUpload)
WScript.StdOut.WriteLine "not a zip file: " & fileName WScript.StdOut.WriteLine "not a zip file: " & fileName
WScript.Quit WScript.Quit
end if end if
set manage_attachments_button = ie.document.getelementbyid("manage_attachments_button") set manage_attachments_button = ie.document.getelementbyid("manage_attachments_button")
if manage_attachments_button is nothing then if manage_attachments_button is nothing then
WScript.StdOut.WriteLine "failed to find manage_attachments_button" WScript.StdOut.WriteLine "failed to find manage_attachments_button"
WScript.Quit WScript.Quit
end if end if
WScript.StdOut.WriteLine "InStr(1, lcase(manage_attachments_button.onclick), ""vb_attachments"") = " & InStr(1, lcase(manage_attachments_button.onclick), "vb_attachments") WScript.StdOut.WriteLine "InStr(1, lcase(manage_attachments_button.onclick), ""vb_attachments"") = " & InStr(1, lcase(manage_attachments_button.onclick), "vb_attachments")
dim startPos, endPos dim startPos, endPos
startPos = InStr(1, lcase(manage_attachments_button.onclick), "vb_attachments") startPos = InStr(1, lcase(manage_attachments_button.onclick), "vb_attachments")
@ -310,7 +310,7 @@ sub UploadFile(FileToUpload)
WScript.StdOut.WriteLine "failed to find attachement form" WScript.StdOut.WriteLine "failed to find attachement form"
WScript.Quit WScript.Quit
end if end if
Set InputList = FormList(0).getElementsByTagName("input") Set InputList = FormList(0).getElementsByTagName("input")
WScript.StdOut.WriteLine "InputList.length = " & InputList.length WScript.StdOut.WriteLine "InputList.length = " & InputList.length
@ -326,9 +326,9 @@ sub UploadFile(FileToUpload)
PreFormData = PreFormData & "Content-Type: application/zip" & vbCrLf & vbCrLf PreFormData = PreFormData & "Content-Type: application/zip" & vbCrLf & vbCrLf
PostFormData = vbCrLf & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""upload""" & vbCrLf & vbCrLf & "Upload" & vbCrLf PostFormData = vbCrLf & "--AaB03x" & vbCrLf & "Content-Disposition: form-data; name=""upload""" & vbCrLf & vbCrLf & "Upload" & vbCrLf
PostFormData = PostFormData & vbCrLf & vbCrLf & "--AaB03x--"& vbCrLf PostFormData = PostFormData & vbCrLf & vbCrLf & "--AaB03x--"& vbCrLf
WScript.StdOut.WriteLine PreFormData & PostFormData WScript.StdOut.WriteLine PreFormData & PostFormData
dim fileContents dim fileContents
fileContents = ReadBinaryFile(FileToUpload) fileContents = ReadBinaryFile(FileToUpload)
@ -339,13 +339,13 @@ sub UploadFile(FileToUpload)
Header = "Content-Type: multipart/form-data; boundary=AaB03x" & vbCrLf Header = "Content-Type: multipart/form-data; boundary=AaB03x" & vbCrLf
Const adTypeBinary = 1 Const adTypeBinary = 1
Dim DataToPOSTStream Dim DataToPOSTStream
Set DataToPOSTStream = CreateObject("ADODB.Stream") Set DataToPOSTStream = CreateObject("ADODB.Stream")
DataToPOSTStream.type=adTypeBinary DataToPOSTStream.type=adTypeBinary
DataToPOSTStream.Open DataToPOSTStream.Open
DataToPOSTStream.Write = Stream_StringToBinary(PreFormData,"us-ascii") DataToPOSTStream.Write = Stream_StringToBinary(PreFormData,"us-ascii")
DataToPOSTStream.Write = fileContents DataToPOSTStream.Write = fileContents
DataToPOSTStream.Write = Stream_StringToBinary(PostFormData,"us-ascii") DataToPOSTStream.Write = Stream_StringToBinary(PostFormData,"us-ascii")
@ -353,13 +353,13 @@ sub UploadFile(FileToUpload)
DataToPOSTStream.Type = adTypeBinary DataToPOSTStream.Type = adTypeBinary
Dim DataToPOST Dim DataToPOST
DataToPOST = DataToPOSTStream.Read DataToPOST = DataToPOSTStream.Read
Set IE3 = WScript.CreateObject("InternetExplorer.Application") Set IE3 = WScript.CreateObject("InternetExplorer.Application")
IE3.Visible = 1 IE3.Visible = 1
WScript.StdOut.WriteLine "Navigating to: " & UploadUrl WScript.StdOut.WriteLine "Navigating to: " & UploadUrl
IE3.Navigate UploadUrl, Nothing, Nothing, DataToPOST, Header IE3.Navigate UploadUrl, Nothing, Nothing, DataToPOST, Header
Wait IE3 Wait IE3
Dim UploadDone Dim UploadDone
UploadDone = False UploadDone = False
For count = 0 to 1000 For count = 0 to 1000
@ -407,10 +407,10 @@ Function Stream_StringToBinary(Text, CharSet)
End Function End Function
Function ReadBinaryFile(path) Function ReadBinaryFile(path)
Const adTypeText = 2 Const adTypeText = 2
Const adTypeBinary = 1 Const adTypeBinary = 1
dim inStream dim inStream
dim myByte,myByteValue,myCharacter dim myByte,myByteValue,myCharacter
set inStream=WScript.CreateObject("ADODB.Stream") set inStream=WScript.CreateObject("ADODB.Stream")