Skip to main content
Continuing Online Operations
Loyola is continuing online operations while we prepare for reopening safely in the fall. Coronavirus resources

Blackboard Interface from LORA (Student Information System): Retrieval

Downloading WebFocus Reports

Data posted from LORA to Blackboard starts with a set of reports that are run using an online tool called WebFOCUS. WebFOCUS is designed to provide reports on demand, and does not directly support automation by scripting. It has been possible, however, to script this particular set of reports on the client side, assuming a Windows computer with the MS Office Suite installed and with a standard Windows tool called Powershell. The Powershell script can start Internet Explorer, log in to WebFOCUS, and navigate to the URLs that run the reports. A limitation in Internet Explorer makes it difficult to save the report output as simple text files, because the SAVEAS method built into IE always prompts the user for a file name, interrupting the automation flow. The workaround was to have the script create empty .txt files to hold each report, and use MS Word to open each file one at a time, copying and pasting the report from Internet Explorer into Word, then having word save the file without interrupting the automation flow.

The Powershell script is as follows:


########################################################################################
# DOWNLOAD BLACKBOARD EXTRACT REPORTS USING WEB FOCUS #
########################################################################################
#
# MAIN PROGRAM
#
Write-Host -ForegroundColor Green "Download Blackboard Extract Reports Using Web Focus."
#
# READ PARAMETERS FILE AND CHECK THAT DIRECTORIES EXIST
#
$Pipe = '|'
$Semester = ''
$WFUserName = ''
$WFPassword = ''
$HomeDir = ''
$WFDir = ''
$ParamsFileName = 'SISIntegrationParameters.txt'
If (-not (Test-Path $ParamsFileName)) {
Write-Host -foregroundcolor Red 'Paramaters File Not Found.'
Exit
}
$ParamsFile = Get-Content $ParamsFileName
ForEach ($Line in $ParamsFile) {
$Title = $Line.Split($Pipe)[0]
$Value = $Line.Split($Pipe)[1]
switch ($Title)
{
'Semester' {$Semester = $Value.Trim()}
'Username' {$WFUserName = $Value.Trim()}
'Password' {$WFPassword = $Value.Trim()}
'HomeDir' {$HomeDir = $Value.Trim()}
'WFDir' {$WFDir = $Value.Trim()}
'WFLoginURL' {$WFLoginURL = $Value.Trim()}
'WFCoursesURL' {$WFCoursesURL = $Value.Trim()}
'WFInstructorsURL' {$WFInstructorsURL = $Value.Trim()}
'WFStudentsURL' {$WFStudentsURL = $Value.Trim()}
'WFEnrollInstructorsURL' {$WFEnrollInstructorsURL = $Value.Trim()}
'WFEnrollStudentsURL' {$WFEnrollStudentsURL = $Value.Trim()}
'FNameCourses' {$FNameCourses = $Value.Trim()}
'FNameInstructors' {$FNameInstructors = $Value.Trim()}
'FNameStudents' {$FNameStudents = $Value.Trim()}
'FNameEnrollInst' {$FNameEnrollInst = $Value.Trim()}
'FNameEnrollStud' {$FNameEnrollStud = $Value.Trim()}
}
}
If (-not (Test-Path $WFDir)) {
Write-Host -foregroundcolor Red 'WebFOCUS Directory Not Found!'
Exit
}
#
# CONSTANTS (Mostly options of interop commands)
#
$PromptDefault = 0
$PromptNone = 2
$SelectAll = 17
$Copy = 12
$Paste = 13
$OpenFile = 1
$SaveFile = 3
$CloseFile = 45
$wdPasteText = 2
#
# Set Up Voice Synthesizer
#
Add-Type -AssemblyName System.speech
$Synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$Synth.Rate = 0
$Msg = "Downloading WebFOCUS reports for upload to Blackboard."
Write-Host -ForegroundColor Green $Msg
$Synth.Speak($Msg)
#
# Prepare Directory with empty text files to hold downloaded reports
#
Set-Location $WFDir
Remove-Item "*.txt"
New-Item -path . -name $FNameCourses -itemtype "file"
New-Item -path . -name $FNameInstructors -itemtype "file"
New-Item -path . -name $FNameStudents -itemtype "file"
New-Item -path . -name $FNameEnrollInst -itemtype "file"
New-Item -path . -name $FNameEnrollStud -itemtype "file"
#
# Create an MS WORD com object
#
$Msg = "Starting Microsoft Word."
Write-Host -ForegroundColor Green $Msg
$Synth.Speak($Msg)
$word = New-Object -com word.application
$word.visible = $true
$word.top = 0
$word.left = 0
#
# Create an Internet Explorer com object
#
$Msg = "Starting Internet Explorer."
Write-Host -ForegroundColor Green $Msg
$Synth.Speak($Msg)
$ie = New-Object -com internetexplorer.application
$ie.visible = $true
$ie.top = 0
$ie.left = 900
$ie.height = 800
$ie.width = 600
#
# LOG IN to WebFocus
#
$Msg = "Logging in to Web Focus."
Write-Host -ForegroundColor Green $Msg
$Synth.speak($Msg)
$ie.navigate($WFLoginURL)
Start-Sleep -m 100
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.document.getElementById(“IBIMR_user”).value = $WFUserName
$ie.document.getElementById("IBIMR_pass").value = $WFPassword
$ie.document.getElementByID("submit").click()
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
#
# Get Create Courses
#
$Msg = "Getting Batch to Create Courses."
Write-Host -ForegroundColor Green $Msg
$Synth.speak($Msg)
$ie.navigate($WFCoursesURL)
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.document.getElementByID("SEL_TERM").value = $Semester
$ie.document.getElementByID("Submit").click()
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.ExecWB($SelectAll,$PromptDefault,$null,[ref]$null)
$ie.ExecWB($Copy, $PromptDefault, $null, [ref]$null)
$doc = $word.documents.open($WFDir + $FNameCourses)
$word.selection.PasteSpecial($wdPasteText)
$doc.save()
$doc.close()
#
# Get Create Instructors
#
$Msg = "Getting Batch to Create Instructors."
Write-Host -ForegroundColor Green $Msg
$Synth.speak($Msg)
$ie.navigate($WFInstructorsURL)
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.document.getElementByID("SEL_TERM").value = $Semester
$ie.document.getElementByID("Submit").click()
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.ExecWB($SelectAll,$PromptDefault,$null,[ref]$null)
$ie.ExecWB($Copy, $PromptDefault, $null, [ref]$null)
$doc = $word.documents.open($WFDir + $FNameInstructors)
$word.selection.PasteSpecial($wdPasteText)
$doc.save()
$doc.close()
#
# Get Create Students
#
$Msg = "Getting Batch to Create Students."
Write-Host -ForegroundColor Green $Msg
$Synth.speak($Msg)
$ie.navigate($WFStudentsURL)
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.document.getElementByID("SEL_TERM").value = $Semester
$ie.document.getElementByID("Submit").click()
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.ExecWB($SelectAll,$PromptDefault,$null,[ref]$null)
$ie.ExecWB($Copy, $PromptDefault, $null, [ref]$null)
$doc = $word.documents.open($WFDir + $FNameStudents)
$word.selection.PasteSpecial($wdPasteText)
$doc.save()
$doc.close()
#
# Get Enroll Instructors
#
$Msg = "Getting Batch to Enroll Instructors."
Write-Host -ForegroundColor Green $Msg
$Synth.speak($Msg)
$ie.navigate($WFEnrollInstructorsURL)
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.document.getElementByID("SEL_TERM").value = $Semester
$ie.document.getElementByID("Submit").click()
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.ExecWB($SelectAll,$PromptDefault,$null,[ref]$null)
$ie.ExecWB($Copy, $PromptDefault, $null, [ref]$null)
$doc = $word.documents.open($WFDir + $FNameEnrollInst)
$word.selection.PasteSpecial($wdPasteText)
$doc.save()
$doc.close()
#
# Get Enroll Students
#
$Msg = "Getting Batch to Enroll Students."
Write-Host -ForegroundColor Green $Msg
$Synth.speak($Msg)
$ie.navigate($WFEnrollStudentsURL)
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.document.getElementByID("SEL_TERM").value = $Semester
$ie.document.getElementByID("Submit").click()
Start-Sleep -m 200
while ($ie.Busy -eq $true) { Start-Sleep -m 200 }
$ie.ExecWB($SelectAll,$PromptDefault,$null,[ref]$null)
$ie.ExecWB($Copy, $PromptDefault, $null, [ref]$null)
$doc = $word.documents.open($WFDir + $FNameEnrollStud)
$word.selection.PasteSpecial($wdPasteText)
$doc.save()
$doc.close()
#
# END DOWNLOAD AND CAPTURE PHASE
#
Start-Sleep -m 200
$Msg = "Closing Internet Explorer."
$Synth.Speak($Msg)
Write-Host -ForegroundColor Green $Msg
$ie.Quit()
$Msg = "Closing Microsoft Word."
$Synth.Speak($Msg)
Write-Host -ForegroundColor Green $Msg
$Word.Quit()
Get-ChildItem -Path $WFDir
Set-Location $HomeDir
$Msg = "Downloads Complete."
$Synth.Speak($Msg)
Write-Host -ForegroundColor Green $Msg

Quick Links