Please note this is a proof of concept and I do not intend for it to be used in malicious ways.
This Program utilises Microsoft's Power Automate and is designed to automatically complete Math Pathways Modules.
From the first time I used Math Pathways I've been eager to make some sort of tool that automates the proccess of clicking through all the questions for me. I had tried multiple ways including attempting to make a browser extension, nodeJS script, and python script but all of those had some sort of limitation. This is until I came across a tool called Power Automate made by Microsoft. It allows you to automate many things including browsers (via the use of a browser extension added by the program)
Follow the steps below to set this up for yourself. Some screenshots and videos are provided for your convenience
- A Windows system
- A Microsoft account (required for Power Automate)
- Power Automate desktop program
- Chrome (for easiest setup) or any other browser
- Math Pathways account
- Decent experience with Windows and/or Programming
First and foremost, you must install Power Automate from the Microsoft store.
Once installed you'll need to login with your Microsoft account.
Simply enter the email address associated with your Microsoft Account.
For this program to work properly you'll also need the browser extension for your browser of choice
Installing the extension should be quite straightforward
Now we have everything we need setup, it's time to create the flow!
If you followed the intructions correctly you should be at the Power Automate home/dashboard, simply click "New flow" and then name your flow whatever you wish.
After creating the flow, you should see a window open that says "You don't have any actions here yet".
If you're at the right place, you're ready to add the code!
Copy the code below by either selecting it all and pressing CTRL + C / right click > copy OR clicking the copy button located at the top right corner of the code block.
SET MPClass TO $'''https://your-mathpathway-class-URL.com'''
WebAutomation.LaunchChrome.LaunchChrome Url: MPClass WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser
WAIT 2
IF (WebAutomation.IfWebPageContains.WebPageDoesNotContainText BrowserInstance: Browser Text: $'''Continue activity''') THEN
Display.ShowMessageDialog.ShowMessage Title: $'''Login''' Message: $'''Please login then click \"OK\" when done''' Icon: Display.Icon.Information Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
END
WebAutomation.GoToWebPage.GoToWebPage BrowserInstance: Browser Url: $'''%MPClass%/work''' WaitForPageToLoadTimeout: 60
WAIT 2
Display.ShowMessageDialog.ShowMessage Title: $'''MP Auto Bot ''' Message: $'''Start the MP Auto Bot by selecting \"OK\". Manually stop this flow to stop the bot''' Icon: Display.Icon.Warning Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> runbot
LOOP WHILE ($'''true''') = ($'''true''')
MouseAndKeyboard.MoveMouseToTextOnScreenWithOCR.WaitForTextToAppearAndMoveMouseToTextOnScreenWithWindowsOcr TextToFind: $'''Check''' IsRegEx: False WindowsOcrLanguage: MouseAndKeyboard.WindowsOcrLanguage.English Occurence: 1 SearchForTextOn: MouseAndKeyboard.SearchTarget.EntireScreen ImageWidthMultiplier: 1 ImageHeightMultiplier: 1 MovementStyle: MouseAndKeyboard.MovementStyle.Instant Timeout: 5 PositionRelativeToText: MouseAndKeyboard.PositionOnImage.MiddleCenter OffsetX: 0 OffsetY: 0 X=> LocationOfTextFoundX Y=> LocationOfTextFoundY Width=> WidthOfTextFound Height=> HeightOfTextFound
ON ERROR
GOTO skipclick
END
MouseAndKeyboard.SendMouseClick.Click ClickType: MouseAndKeyboard.MouseClickType.LeftClick MillisecondsDelay: 0
WAIT 1
LABEL skipclick
IF (OCR.IfTextOnScreen.TextOnScreenExistsWithWindowsOcr TextToFind: $'''fast''' IsRegex: False WindowsOcrLanguage: OCR.WindowsOcrLanguage.English SearchForTextOn: OCR.SearchTarget.EntireScreen ImageWidthMultiplier: 1 ImageHeightMultiplier: 1 TextLocationX=> LocationOfTextFoundX2 TextLocationY=> LocationOfTextFoundY2) THEN
WAIT 1
MouseAndKeyboard.MoveMouseToTextOnScreenWithOCR.WaitForTextToAppearAndMoveMouseToTextOnScreenWithWindowsOcr TextToFind: $'''Continue''' IsRegEx: False WindowsOcrLanguage: MouseAndKeyboard.WindowsOcrLanguage.English Occurence: 1 SearchForTextOn: MouseAndKeyboard.SearchTarget.EntireScreen ImageWidthMultiplier: 1 ImageHeightMultiplier: 1 MovementStyle: MouseAndKeyboard.MovementStyle.Instant Timeout: 5 PositionRelativeToText: MouseAndKeyboard.PositionOnImage.MiddleCenter OffsetX: 0 OffsetY: 0 X=> LocationOfTextFoundX Y=> LocationOfTextFoundY Width=> WidthOfTextFound Height=> HeightOfTextFound
ON ERROR
GOTO skipclick
END
MouseAndKeyboard.SendMouseClick.Click ClickType: MouseAndKeyboard.MouseClickType.LeftClick MillisecondsDelay: 0
WAIT 1
END
MouseAndKeyboard.MoveMouseToImage.ClickImage Images: [imgrepo['Image_2']] SearchForImageOn: MouseAndKeyboard.SearchTarget.EntireScreen MousePositionOnImage: MouseAndKeyboard.PositionOnImage.MiddleCenter OffsetX: 0 OffsetY: 0 Tolerance: 10 MovementStyle: MouseAndKeyboard.MovementStyle.Instant Occurence: 1 Timeout: 5 ClickType: MouseAndKeyboard.ClickType.LeftClick SecondsBeforeClick: 0 SearchAlgorithm: MouseAndKeyboard.ImageFinderAlgorithm.Legacy X=> X Y=> Y
ON ERROR
END
WAIT 1
END
DISABLE END
# [ControlRepository][PowerAutomateDesktop]
{
"ControlRepositorySymbols": [],
"ImageRepositorySymbol": {
"Name": "imgrepo",
"ImportMetadata": {},
"Repository": "{\r\n \"Folders\": [],\r\n \"Images\": [\r\n {\r\n \"Id\": \"0c8cf720-9f18-4209-91f6-1572cc1779cf\",\r\n \"Name\": \"Image_2\",\r\n \"Screenshot\": \"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAANSURBVBhXY2BYPvM/AAQrAkD6JlbeAAAAAElFTkSuQmCC\",\r\n \"ScreenshotPath\": \"imageRepo-screenshots\\\\\\\\58538345-00a5-4f81-ac27-ddf3cc6367f8.png\"\r\n }\r\n ],\r\n \"Version\": 1\r\n}"
},
"ConnectionReferences": []
}
Now we have the code copied, return to the flow you created and paste the code with CTRL + V / right click > paste
There are a few things you might want to change before you run your code.
ℹ️ It is required that you change the URL of your Math Pathways class (the URL which you use to access Math Pathways). At the top of all the code click the three dots on the right of the MPClass varible then click edit and set the URL accordingly.
If you know what you are doing you may change any of the code to meet your needs.
ℹ️ Once you've finished making any changes make sure to save your flow!
Congrats! You made it to the fun part.
To run the Bot, click the
This will launch a browser window and automaically open the URL you set as your Math Pathways class. If your're not already logged in, a message box will pop up asking you to login.
Select your user and enter your password to login, the Bot will not continue until you click "OK" on the message pop up.
When you click "OK" you should be redirected to your-mpclass.com/work and you will get another message pop up which when you are ready to start the Bot click "OK".
ℹ️ PLEASE NOTE: If you don't already have a module started, are doing the warm up for the module, or currently have a test, the Bot will not work.
ℹ️ MAKE SURE:
- If you don't have a module started, start one and complete the warm up if you have one, then you can start the bot
- If you are still in a warm up for a module, complete the warm up then start the bot
- If you have a test, stop the bot and complete the test
- The "Check my answer" and "Complete question" buttons are visible on screen at all times, as the bot uses OCR to find and click the buttons. This also means you may need to manually scroll down at times. (for the best results, maximize the browser window)
Here is a short video of the bot working on a module.
botrunning.mp4
Due to limitations of Power Automate, I couldn't make a way to easily stop the bot from running.
To stop the Math Pathways Auto Bot you'll need to switch back to your Power Automate flow and stop it from there (if the Bot is running try to do this quickly as the program will still try and move your mouse)
If you need some help and/or find any bugs create an issue at https://github.com/BamBoozledMC/MathPathwaysAutoBot/issues and I will get back to you when I can.
What if I get the "Whoa! That was fast" pop up?
I have designed the bot to go slow enough so this doesn't happen, however in the case it does, the bot should detect it and close the pop up.
More things will be added here sometime soon