Skip to content

Instantly share code, notes, and snippets.

@mwt
Last active August 18, 2022 19:14
Show Gist options
  • Save mwt/d5eccff0ef74c1c1ecd4a19911119fd7 to your computer and use it in GitHub Desktop.
Save mwt/d5eccff0ef74c1c1ecd4a19911119fd7 to your computer and use it in GitHub Desktop.
An AutoHotkey script to grade assignments in Canvas SpeedGrader quickly using Numpad keys to score the question. For example, Numpad0 gives a score of zero. Make sure NumLock is on! This is intended for use in the grade by question mode. You may need to make adjustments based on browser metrics. Made for Firefox.
SetTitleMatchMode, 2
GradeAssignment(s)
{
WinActivate SpeedGrader ; Use window with "SpeedGrader" in name
CoordMode, Click, Window
WinGetPos, winX, winY, winWidth, winHeight, A
Y := winHeight * 0.26 ; Get textbox Y coordinate
tX := winWidth * 0.57 ; Get textbox X coordinate
rX := winWidth * 0.95 ; Arbitrary coordinate on right panel
Click, %tX%, %Y% Left ; Click on score textbox for question
Click, %tX%, %Y% Left ; Click a second time to select and overwrite value
Sleep, 10
Send, {%s%} ; Type score number into box
Sleep, 10
Send, {Enter} ; Submit score for question
Sleep, 5
Click, %rX%, %Y% Left ; Click on right panel so we can go to next student
Sleep, 1050
Send, {j} ; Keyboard shortcut to move to next student
}
Numpad0::
GradeAssignment(0)
Return
Numpad1::
GradeAssignment(1)
Return
Numpad2::
GradeAssignment(2)
Return
Numpad3::
GradeAssignment(3)
Return
Numpad4::
GradeAssignment(4)
Return
Numpad5::
GradeAssignment(5)
Return
Numpad6::
GradeAssignment(6)
Return
Numpad7::
GradeAssignment(7)
Return
Numpad8::
GradeAssignment(8)
Return
Numpad9::
GradeAssignment(9)
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment