Set post title based on param

This commit is contained in:
zilmar 2015-09-30 10:18:37 +10:00
parent e27adf67ac
commit c4dcb45381
1 changed files with 9 additions and 12 deletions

View File

@ -1,8 +1,8 @@
' On Error Resume Next ' On Error Resume Next
if WScript.Arguments.Count < 3 then if WScript.Arguments.Count < 4 then
WScript.StdOut.WriteLine "Missing parameters" WScript.StdOut.WriteLine "Missing parameters"
WScript.StdOut.WriteLine "[password] [file to upload] [BuildUrl]" WScript.StdOut.WriteLine "[password] [file to upload] [BuildUrl] [Posttitle]"
WScript.Quit WScript.Quit
end if end if
@ -108,7 +108,7 @@ Sub Navigate(IE, url)
WScript.StdOut.WriteLine "Navigating (" & IE.HWND & ") to: " & url WScript.StdOut.WriteLine "Navigating (" & IE.HWND & ") to: " & url
IE.Navigate url IE.Navigate url
WScript.Sleep 100 WScript.Sleep 100
set IE = FindIeWindow(ieID) ' set IE = FindIeWindow(ieID)
Wait IE Wait IE
End Sub End Sub
@ -237,18 +237,18 @@ Sub PostThread(IE)
dim ieId dim ieId
ieID = IE.HWND ieID = IE.HWND
SetPostDetails IE, WScript.Arguments(2) SetPostDetails IE, WScript.Arguments(2), WScript.Arguments(3)
UploadFile WScript.Arguments(1) UploadFile WScript.Arguments(1)
WScript.StdOut.WriteLine "submitting" WScript.StdOut.WriteLine "submitting"
submitButton.click submitButton.click
WScript.Sleep 100 WScript.Sleep 100
set IE = FindIeWindow(ieID) ' set IE = FindIeWindow(ieID)
Wait IE Wait IE
WScript.StdOut.WriteLine "PostThread Finished" WScript.StdOut.WriteLine "PostThread Finished"
End Sub End Sub
Sub SetPostDetails(IE, BuildUrl) Sub SetPostDetails(IE, BuildUrl, PostTitle)
WScript.StdOut.WriteLine "Posting Details" WScript.StdOut.WriteLine "Posting Details"
Dim oReq Dim oReq
Set oReq = CreateObject("MSXML2.XMLHTTP") Set oReq = CreateObject("MSXML2.XMLHTTP")
@ -264,14 +264,11 @@ Sub SetPostDetails(IE, BuildUrl)
Set xmlDoc = oReq.responseXML Set xmlDoc = oReq.responseXML
Set objLst = xmlDoc.getElementsByTagName("freeStyleBuild") Set objLst = xmlDoc.getElementsByTagName("freeStyleBuild")
Dim PostTitle, PostContent Dim PostContent
For each elem in objLst For each elem in objLst
set childNodes = elem.childNodes set childNodes = elem.childNodes
for each node in childNodes for each node in childNodes
if lcase(node.nodeName)="fulldisplayname" then if lcase(node.nodeName)="changeset" then
PostTitle = node.text
end if
if lcase(node.nodeName)="changeset" then
for each item in node.childNodes for each item in node.childNodes
dim commitId, comment dim commitId, comment
@ -451,7 +448,7 @@ sub UploadFile(FileToUpload)
WScript.StdOut.WriteLine "Uploading form to: " & UploadUrl WScript.StdOut.WriteLine "Uploading form to: " & UploadUrl
IE3.Navigate UploadUrl, Nothing, Nothing, DataToPOST, Header IE3.Navigate UploadUrl, Nothing, Nothing, DataToPOST, Header
WScript.Sleep 100 WScript.Sleep 100
set IE3 = FindIeWindow(ieID) 'set IE3 = FindIeWindow(ieID)
Wait IE3 Wait IE3
Dim UploadDone Dim UploadDone