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?
Possible to check if not downloading from internet?
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: Possible to check if not downloading from internet?
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.
Re: Possible to check if not downloading from internet?
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, etcPuzzledGreatly wrote: ↑11 Apr 2019, 18:29I'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.
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.https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc753182(v%3Dws.11)
https://ss64.com/nt/typeperf.html
https://ss64.com/nt/syntax-performance-counters.html
https://www.red-gate.com/simple-talk/blogs/getting-baseline-and-performance-stats-the-easy-way/
https://www.red-gate.com/simple-talk/sql/performance/collecting-performance-data-into-a-sql-server-table/
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
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
Who is online
Users browsing this forum: JoeWinograd, Mannaia666 and 140 guests