Possible to check if not downloading from internet?

Get help with using AutoHotkey and its commands and hotkeys
KilliK
Posts: 224
Joined: 10 Mar 2016, 21:19

Possible to check if not downloading from internet?

11 Apr 2019, 11:56

Hello.

I have created a script which opens all my game clients whenever I need to update all my games. The clients open in a sequential order with a 10s gap between each loading.
Unfortunately, the file size of the updates are too big and eventually the hdd/network/system clogs by the workload.
I cant increase the time period between each loading of the client, because the time it takes for each update to finish varies from a few seconds to a few minutes.

So I was wondering if it possible to somehow inform AHK that my internet download remains below a value (500kb) for a whole time period (10s). If this condition is met, then that means the update is completed and AHK can start loading hte next game client.
I searched the forum but I only found scripts to alert the user when the internet is online/offline.

So can this be done? or is there any other better alternative solution for my problem?
User avatar
PuzzledGreatly
Posts: 746
Joined: 29 Sep 2013, 22:18

Re: Possible to check if not downloading from internet?

11 Apr 2019, 18:29

I'd be interested to know an answer too. Currently I monitor the download directories using a timer and look for files with a .part extension. If there are no such files then I know the download has completed.
KilliK
Posts: 224
Joined: 10 Mar 2016, 21:19

Re: Possible to check if not downloading from internet?

10 May 2019, 20:13

PuzzledGreatly wrote:
11 Apr 2019, 18:29
I'd be interested to know an answer too. Currently I monitor the download directories using a timer and look for files with a .part extension. If there are no such files then I know the download has completed.
after some googling, I found a solution. Windows has a native command typeperf which is the command line version of the Performance Monitor GUI. It offers a multitude of counters to monitor various parts of your system, like memory, hdd, network adapters, etc. The best thing is that the command itself offers various options like how long you want to run the monitoring, if you want to record the results in a file, if you want to use more than one counter, etc
here is some links with more info and examples:
I created a script which runs the command to monitor and record the download speed every 10s, gets the results from the file and finds the average speed. if the average download speed is above 1MB/s, it repeats the loop until the speed falls equal or less than 1MB/s. You can have the command to monitor and record more counters at the same time, and use them in your own script.

AHK script

Code: Select all

start:
Run, %comspec% /c "D:\Management\System\Scripts\Data\typeperf.bat",,min
WinWait, typeperf ahk_class ConsoleWindowClass ahk_exe cmd.exe
WinWaitClose, typeperf ahk_class ConsoleWindowClass ahk_exe cmd.exe
csvfile:="D:\Management\System\Scripts\Data\typeperf.csv"
sum:=0
Loop, read, %csvfile%
{
if (A_Index=1) || (A_Index=2)
continue
array:= StrSplit(A_LoopReadLine , ",", " "" ")
sum:=sum+array[2]
}
speedv:= Round(sum/10/1024/1024)
if speedv > 1
goto start
Return
Batch file

Code: Select all

@echo off
title typeperf
typeperf "\Network Interface(*)\Bytes Received/sec" -y -sc 11 -o "D:\Management\System\Scripts\Data\typeperf.csv"
exit
So far it works pretty well, and now I can use it with my main script.

Return to “Ask For Help”

Who is online

Users browsing this forum: georgedx, kookuei and 229 guests