Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetBatchLines, -1
- min := 1 ; Course minimum
- , max := 999 ; Course maximun
- , limit := 5 ; Record limit (Cero means no limit)
- , codeList := A_Desktop "\list.txt" ; List of codes
- , results := A_Desktop "\results.csv" ; Results file
- , out := "Code,Course,Assign 1" "`n" ; Headings of the file
- , courses := ["PHE7", "PHE9", "PHE10", "PHE11", "PHE13"] ; Courses
- , URL := "https://gradecard.ignou.ac.in/gradecardB/Result.asp?eno=#&program=BSC&hidden_submit=OK"
- loop, read, % codeList
- {
- if (limit && A_Index >= limit)
- {
- break
- }
- html := getUrl(StrReplace(URL, "#", A_LoopReadline))
- for i,code in courses
- {
- if (RegExMatch(html, "(" code ").+>(\d+)<", match))
- {
- line := A_LoopReadline ","
- if (match)
- {
- if match2 between %min% and %max%
- {
- line .= match1 "," match2 "`n"
- }
- }
- out .= line
- }
- }
- }
- loop {
- if (!fileObj := FileOpen(results, "w-"))
- {
- MsgBox, 0x40010, ERROR, Could not update the file, please close any open instance of the document and click OK
- }
- fileObj.Write(out)
- if (!ErrorLevel)
- {
- MsgBox, 0x40040, Finished, Task Completed!
- }
- fileObj.Close()
- } until (!ErrorLevel)
- getUrl(URL)
- {
- whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
- whr.Open("GET", URL, true)
- whr.Send()
- whr.WaitForResponse()
- return whr.ResponseText
- }
- #SingleInstance, force
Add Comment
Please, Sign In to add comment