Optimizing scripts for page load times

Get help with using AutoHotkey and its commands and hotkeys
balbect
Posts: 1
Joined: 13 Oct 2019, 14:56
GitHub: balbect

Optimizing scripts for page load times

08 Nov 2019, 12:14

Hello,

I would like some advice on how to optimize this script. Its’ function is to automate my workflow within Ellucian Colleague (web-based, 3rd party software accessed through chrome, mozilla, etc.) that involves moving between certain screen by clicking a fixed button and typing comments. This script working successfully however, I am hoping it can be made to run with greater efficiency.

There are also plans to use/implement this script with another I’m currently writing that will “decide” to send either #NumPad1 or #NumPad2. I’ll be posting on the support page on that one soon.


Thank you for taking a look!

The Code
The code is only slightly different between #NumPad1 and #NumPad2 with #NumPad2 contining some extra steps.

Code: Select all

^!p::Pause    ; Pause script with Ctrl+Alt+P
^!s::Suspend  ; Suspend script with Ctrl+Alt+S
^!r::Reload   ; Reload script with Ctrl+Alt+R

#SingleInstance, force


;BOBG (APPROVAL)

#NumPad1::
;This changes the location from DST to ABC and leaves the mouse on the first award-line on the aide screen.

	Click, 208, 784	;Clicks to the Aide screen from BOGW screen.
	sleep, 2000
	Click,130, 759 	; clicks "AtP" button on the bottom left.
		Sleep, 8000 	; waits 8 seconds (for page to load).
	Click,684, 320 	; clicks textbox next to the Current location label.
		Sleep, 1000	; waits second. 
	Send, ABC			; types ABC. 
	Click,663, 225 	; clicks the save button.
		Sleep, 9000 	; waits for procesing.
	Click,123, 435 	; clicks the first award line in aide screen.
	
	;This sends "BOGB" to the first line award line on the aide screen. Then sets action collum to "A"
	Send, bogb
		sleep, 800
	Click, 461, 437
		sleep, 1000
	Send, a
	
	;This opens the Awarding Comments box. Timestamps, writes an approval message and saves out of the Awarding Comments box.

	Click,504, 756 	; Clicks the Cmnt box in the AIDE screen
		Sleep, 1000
	Send `n
	Click,411, 197 	; clicks the timestamp
	Send, 19-20... Approved based on income standards.`n=`n ;Change this message to your needs
	Click, 256, 198 	; Clicks save on the comment screen (next to the timestamp)
	
	
Return

;DBOGW (DENIAL)

	;This changes the location from DST to ABC and leaves the mouse on the first award-line on the aide screen.
#NumPad2::
	Click, 208, 784	;Clicks to the Aide screen from BOGW screen.
	sleep, 2000
	Click,130, 759 	; clicks "AtP" button on the bottom left.
		Sleep, 8000 	; waits 8 seconds (for page to load).
	Click,684, 320 	; clicks textbox next to the Current location label.
		Sleep, 1000	; waits before typing 
	Send, ABC			; types ABC. 
	Click,663, 225 	; clicks the save button.
		Sleep, 9000 	; waits for procesing.
	Click,123, 435 	; clicks the first award line in aide screen.
	
	;This sends "DBOGW" to the first line award line on the aide screen. Generates term information. Then sets action column to "A".
	Send, dbogw
		sleep, 1000
	Click, 402, 438
	
	;Generates information by awarding a "1" in the amount, clicking out of the amount line, and replacing that "1" with a "0".
		sleep, 1600
	send, 1
	click, 404, 851
		sleep, 1600
	Click,392, 439
	Send, 0
	
	;Sets action column to "A"		
	Click, 461, 437	;Clicks action column
		sleep, 1000
	Send, a			;Sends "a" in the action column
	

	;This opens the Awarding Comments box. Timestamps, writes a denial message, then saves out of the Awarding Comments box.

	Click,504, 756 	; Clicks the Cmnt box in the AIDE screen
		Sleep, 1000
	Send `n
	Click,411, 197 	; clicks the timestamp
	Send, 19-20... Denied based on income standards.`n=`n ;Change this message to your needs
	Click, 256, 198 	; Clicks save on the comment screen (next to the timestamp)
	
	
Return
The Problem

In a nutshell, colleague does not have set/predictable load times between screens. My "solution" has been to set the sleep time for the longest known load time and that time adds up.

Possible Solutions

I think my best solution may be to use ImageSearch to search for the lack of a loading screen during certain sections of the script.

I think that these may be some other ways I could also go about it.
  • Similar to the ImageSearch; use PixelSearch.
  • WinWait waits for the window to exist but the window/url doesn't change between screens.
  • Use COM. I am wholly unfamiliar with COM; have no clue where to start. Most of the documentation form post are about 10 years old. Not even sure if its viable to use it.

Return to “Ask For Help”

Who is online

Users browsing this forum: Fluxilient, Google [Bot], kyuuuri, MannyKSoSo, shawnway, TAC109 and 70 guests