{"id":3637,"date":"2012-03-20T09:38:23","date_gmt":"2012-03-20T15:38:23","guid":{"rendered":"http:\/\/gregsowell.com\/?p=3637"},"modified":"2012-03-20T09:38:23","modified_gmt":"2012-03-20T15:38:23","slug":"autoit-script-to-measure-file-download-or-page-load-time","status":"publish","type":"post","link":"https:\/\/gregsowell.com\/?p=3637","title":{"rendered":"Autoit Script To Measure File Download Or Page Load Time"},"content":{"rendered":"<p>Schedule this program to run at whatever interval you like.  It creates a folder for Year and Month.  It then saves the statistical information in a CSV file via the name of the day.<\/p>\n<p>To change what URL you are accessing and the file to save it as, edit the config.txt file \ud83d\ude42<\/p>\n<p>It records the poll time and the time in milliseconds it took to load the file&#8230;wwwwwwweeeeeeeeeee<\/p>\n<p>Download compiled files here: <div class=\"wp-block-button\">\n<a  data-e-Disable-Page-Transition=\"true\" class=\"dlm-download-link dlm-download-default wp-block-button__link wp-element-button\" title=\"\" href=\"https:\/\/gregsowell.com?download=5717&amp;tmstv=1784657187\" rel=\"nofollow\" id=\"download-link-5717\" data-redirect=\"false\" >\n\tDownloadTimer\t(1807 downloads\t)\n<\/a>\n<\/div>\n<\/p>\n<pre class=\"gs-code\"><code class=\"language-plaintext\">#Region ;**** Directives created by AutoIt3Wrapper_GUI ****\r\n#AutoIt3Wrapper_UseX64=n\r\n#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****\r\n; Advanced example - downloading in the background\r\n#include &lt;file.au3&gt;\r\n\r\n$timer = 0\r\n$timeout = 0\r\n\r\n;open config.txt and load our page and file name\r\nDim $aConfig\r\nIf Not _FileReadToArray(@ScriptDir &amp; &quot;\\config.txt&quot;,$aConfig) Then\r\n   MsgBox(4096,&quot;Error&quot;, &quot; Error reading log to Array     error:&quot; &amp; @error)\r\n   Exit\r\nEndIf\r\n$URL = $aConfig[1]\r\n$File = $aConfig[2]\r\n\r\n;create our output folders.\r\nDirCreate(@ScriptDir &amp; &quot;\\&quot; &amp; @YEAR)\r\nDirCreate(@ScriptDir &amp; &quot;\\&quot; &amp; @YEAR &amp; &quot;\\&quot; &amp; @MON)\r\n\r\n;pull file\r\nLocal $hDownload = InetGet($URL, @ScriptDir &amp; &quot;\\&quot; &amp; $File, 1, 1)\r\nDo\r\n\t$timer = $timer + 5\r\n\tSleep(5)\r\n\tif $timer &gt; 40000 Then\r\n\t\t;ran over 40 seconds kill it.\r\n\t\t$timeout = 1\r\n\t\t_WriteFile()\r\n\t\tExit\r\n\tEndIf\r\nUntil InetGetInfo($hDownload, 2)\t; Check if the download is complete.\r\nLocal $nBytes = InetGetInfo($hDownload, 0)\r\nInetClose($hDownload)\t; Close the handle to release resourcs.\r\n_WriteFile() ;call function to write file.\r\n\r\n\r\n\r\nFunc _WriteFile()\r\n\t$fData = FileOpen(@ScriptDir &amp; &quot;\\&quot; &amp; @YEAR &amp; &quot;\\&quot; &amp; @MON &amp; &quot;\\&quot; &amp; @MDAY &amp; &quot;.csv&quot;, 1)\r\n\r\n\t; Check if file opened for writing OK\r\n\tIf $fData = -1 Then\r\n\t\tMsgBox(0, &quot;Error&quot;, &quot;Unable to open file.  Make sure excel doesn&#039;t have it open.&quot;, 5)\r\n\t\tExit\r\n\tEndIf\r\n\r\n\tif $timeout == 0 Then\r\n\t\tFileWriteLine($fData, @HOUR &amp; &quot;:&quot; &amp; @MIN &amp; &quot;:&quot; &amp; @SEC &amp; &quot;,&quot; &amp; $timer &amp; @CRLF)\r\n\tElse\r\n\t\tFileWriteLine($fData, @HOUR &amp; &quot;:&quot; &amp; @MIN &amp; &quot;:&quot; &amp; @SEC &amp; &quot;,timeout&quot; &amp; @CRLF)\r\n\tEndIf\r\n\r\n\tFileClose($fData)\r\n\r\nEndFunc<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Schedule this program to run at whatever interval you like. It creates a folder for Year and Month. It then saves the statistical information\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,7],"tags":[],"class_list":["post-3637","post","type-post","status-publish","format-standard","hentry","category-autoit","category-programmingscripting"],"_links":{"self":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3637","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3637"}],"version-history":[{"count":6,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3637\/revisions"}],"predecessor-version":[{"id":3643,"href":"https:\/\/gregsowell.com\/index.php?rest_route=\/wp\/v2\/posts\/3637\/revisions\/3643"}],"wp:attachment":[{"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gregsowell.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}