I've encountered a problem with a single file where I cannot retrieve it's Date-time. So far my code has worked well for over 30 files, but this one is a mystery I cannot debug myself due to insufficient Au3 knowledge.
In line 11 "_Date_Time_FileTimeToArray" is called and for this particular file it sets the @error to 10. I don't know what that error code means, but it's not set by the _Date functions themselves I think.
Overall, it could be a problem caused by any of the functions below, how can I properly debug this? / Does anybody know a what's causing this?
_WinAPI_CreateFile() / _Date_Time_GetFileTime() / _Date_Time_FileTimeToArray()
Func _SetFileTimes($sFilePath) Local $monthNumber = ["", "January", "February", "March", "April", "May", "Juny", "July", "August", "September", "October", "November", "December"] Local $dayNumber = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] Local $fHandle = _WinAPI_CreateFile($sFilePath, 2, 2) ; read-only ; may NOT return a valid date for some reason! TODO Local $fTagFILETIME = _Date_Time_GetFileTime($fHandle) _WinAPI_CloseHandle($fHandle) ; This will return an empty array if theres no valid date $fModTime = _Date_Time_FileTimeToArray($fTagFILETIME) ; last Modified if @error <> 10 then Local $year = $fModTime Local $month = $fModTime Local $day = $fModTime Local $hour = $fModTime Local $min = $fModTime Local $sec = $fModTime Local $ms = $fModTime Local $weekday = $fModTime Global $prettyTimestamp = StringFormat("%s, %s %d, %04d %02d:%02d:%02d", $dayNumber[$weekday], $monthNumber[$month], $day, $year, $hour, $min, $sec) Global $uploadDate = StringFormat("%04d-%02d-%02d", $year, $month, $day) $fModTime = _Date_Time_FileTimeToArray(_Date_Time_FileTimeToLocalFileTime($fTagFILETIME)) ; last Modified Local $year = $fModTime Local $month = $fModTime Local $day = $fModTime Local $hour = $fModTime Local $min = $fModTime Local $sec = $fModTime Local $ms = $fModTime Local $weekday = $fModTime ; GetUnixTime accounts for Local time, hence feed it local time Global $unixTimestamp = _GetUnixTime($year &"/"& $month &"/"& $day &" "& $hour&":"& $min &":"& $sec) else Global $prettyTimestamp = "N/A" Global $uploadDate = "" Global $unixTimestamp = "N/A" endif endfunc
_GetUnixTime returned the year 1601 start date, showing that $fModTime is probably equal 0. (But Why?)
The file reports these dates in Explorer, it's on local NTFS drive:
Created: Wednesday, 31. Januar 2018, 18:55:02
Modified: Wednesday, 10. Januar 2018, 12:39:23
Accessed: Wednesday, 10. Januar 2018, 12:39:23
The back story:
I've got a Dell XPS w/ i7-8700K. The fastest, by single core, I could get, by well known PC maker.
The problem is that the fan can get so loud, like, REALLY LOUD, I can not use the CPU at its max. clock speed.
I could leave it at 90% all the time and not use this but I want to have the full 4.x Ghz and no parked cores, at all times, if I can.
But as room temperature and CPU load changes, a set throttle, may still make fan noise.
To avoid the fan from going "airplane turbine mode", the utility gets the temp. from "Core Temp" ( you can google it )
It has a"plug-in" called "Core Temp Remote Server". The utility gets the values via TCP.
When it "feels" it's gonna get hot, drops the CPU throttle to a selected value, lets say 99% ( where is quieter ) and back up to 100% when it "feels" is ok to go back.
Now temperature can creep up to higher than expected if load is sustained or room temperature changes. So there is an "anti creep up" feature, to temporarily set the throttle even lower, 5% at a time, until the known quiet temperature is achieved.
If don't know how to find the temperature you should use, check out these videos. They will tell you how.
The end result:
Any thermal problem, is a hardware problem. No way around that, other than attending to the CPU cooling and case ventilation. Software can not fix that.
But without this utility, the PC would slow down the CPU anyway, to keep it from melting.
This software preemptively slow down the CPU, keeping the CPU related fan speeds from going to maximum RPM. Hence having a slower, but a quieter box.
Hello, I'm very stumped with finding the decimal place for the CPU %.
I found some example code online
#include <Array.au3> $aProcess_Info = GetCPU("RzSynapse") _ArrayDisplay($aProcess_Info) Func GetCPU($sProcess = "") Local $aAllProcess_Info = [], $aOneProcess_Info $oWinMgmts = ObjGet("winmgmts:\\.\root\cimv2") $aCPU_Usage = $oWinMgmts.ExecQuery("SELECT Name, IDProcess, PercentProcessorTime FROM Win32_PerfFormattedData_PerfProc_Process") For $vCPU_Info In $aCPU_Usage If $sProcess Then If $vCPU_Info.Name = $sProcess Then $aOneProcess_Info = $sProcess $aOneProcess_Info = $vCPU_Info.IDProcess $aOneProcess_Info = $vCPU_Info.PercentProcessorTime & " %" Return $aOneProcess_Info EndIf Else $aAllProcess_Info += 1 $aAllProcess_Info[$aAllProcess_Info] = $vCPU_Info.Name $aAllProcess_Info[$aAllProcess_Info] = $vCPU_Info.IDProcess $aAllProcess_Info[$aAllProcess_Info] = $vCPU_Info.PercentProcessorTime & " %.1f" EndIf Next ReDim $aAllProcess_Info[$aAllProcess_Info +1] Return $aAllProcess_Info EndFunc ;==>GetCPU Currently the code shows the CPU % as 0 % and I want to show 0.0 % I found this online for strings "%.1f" but i'm not sure how to incorporate it.
I Have clicked on save as option to save a file, while doing that I need to rename a file appending with sysdate. I have searched in google find the below one line of code:
FileMove("C:\somefile.txt", "C:\somefile1.txt"), When I am trying to append with sysdate. It is not happening. Please help me out with the small issue.
in AutoIt we have:
_WinAPI_IsProcessorFeaturePresent($iFeature) this internally just calls what is provided by microsoft: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724482(v=vs.85).aspx
unfortunately this is completely outdated as we can only check for features like MMX and up to a maximum of SSE2 or SSE3 - which have been introduced back in 2001 / 2004.
but nowadays there is stuff like AVX, AVX2, AVX-512 ...
for example see: https://en.wikipedia.org/wiki/Template:Multimedia_extensions
well, for CPP we have the FeatureDetector (by Mysticial): https://github.com/Mysticial/FeatureDetector
it calls __cpuid / __cpuidex from <intrin.h>.
for additional details see: https://msdn.microsoft.com/en-us/library/hskdteyh.aspx
has anyone tried to determine such SIMD features and related CPU capabilites with AutoIt?