Jump to content

PeterlFF

Active Members
  • Posts

    65
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

PeterlFF's Achievements

Wayfarer

Wayfarer (2/7)

1

Reputation

  1. I know how to write to the event viewer, but I'm not sure if that is the same as event tracing for Windows (ETW). Is it? If not, is it possible to write to the ETW from AutoIT? I haven't found a way yet.
  2. @pixelsearch thanks for your time looking into this. I really appreciate it.
  3. Thanks @pixelsearch for the suggestions about making sure I am getting the sensor status window. When I load it from the command prompt using the command in my script I only get the sensor status window. Send("%comspec% /k " & '"' & "hwinfo64.exe -lTestLog2.csv" & '"' ) It's weird that it doesn't accept the hotkey when the window has focus but I can work around that.
  4. @pixelsearchThat partially worked for me. Lower case q is what I need but I also had to not make the HIwinfo window active. If another window has focus then the q hotkey works. That's not the case if I manually press q so that's strange.
  5. I have a script that starts HWinfo in sensor logging mode and I want to use a hotkey to stop logging. I configured the HWinfo to use a key to toggle logging on/off. When I send the key in AutoIT it doesn't toggle the logging. I have configured different key combinations for the hotkey in HWinfo and none of them work with autoit. They work fine when I press them on my keyboard. The HWinfo window doesn't even need focus for it to work when I press hotkey on keyboard. I have done hotkeys before with autoit without an issue. Is there something else I need to do? Local $cmd = "C:\Windows\System32\cmd.exe" Local $pid = Run('"' & $cmd & '"') Sleep(2000) Send("%comspec% /k " & '"' & "hwinfo64.exe -lTestLog2.csv" & '"' ) Send("{ENTER}") Sleep(4000) WinWaitActive("HWiNFO64") Local $hWnd = WinGetHandle("HWiNFO64") WinClose($cmd) Sleep(5000) WinActivate($hWnd) Sleep(2000) Send("Q") Sleep(2000) WinClose($hWnd)
  6. @rsnThanks for taking an interest. I was trying to time how long certain actions took in Power BI. I looked into using processes trying to find one that started/ended when it was done rendering the visuals but couldn't find a way to make it work. I ended up using PixelChecksum to compare the app window to itself until there were no longer any pixel changes. Had it loop for an extra 8 seconds in case there were any late pixel changes. It works well for me so I stopped looking into the events/process stuff.
  7. @rsn That works. Thank you so much for helping with this. Thanks to @Jfish for your help as well.
  8. @rsn The command line ran successfully on the same laptop.
  9. @rsn That looks great but not working for me. The AutoIT code doesn't return anything. I download the WMI Explorer, connected to the laptop, found the BatteryStatus class and executed the SELECT * FROM BatteryStatus query inside WMIExplorer and it said it completed successfully and retrieved 0 instances. I tried the other Battery related classes I found there and all were the same as BatteryStatus. I tried it with the laptop plugged in and unplugged.
  10. @rsnThanks for checking it out. I don't think Design capacity will work for me because it measures the capacity of the battery. I need to note the difference in watt hours from the start of some tasks and then at the end of those tasks. The BatteryReport API would work but I don't know how to connect to it. I tried this below but it doesn't return anything. Not even the "RemainingCapacityInMilliwattHours" header text so I don't think it even found that property or really connected to the BatteryReport API. Any ideas what I am doing wrong? #include <MsgBoxConstants.au3> Dim $info $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") $objBatt = $objWMIservice.ExecQuery ("Select * from BatteryReport") For $object In $objBatt $info &= 'RemainingCapacityInMilliwattHours: ' & $object.RemainingCapacityInMilliwattHours & @CRLF Next MsgBox($MB_SYSTEMMODAL, "battery", $info & $objDisks)
  11. @JfishThe laptop is unplugged and around 90% on battery. I am not using an emulator. It is a dell laptop with windows 10 on it.
  12. @Jfish I mispoke. from the description of DesignCapacity it sounds like it the total capacity of the battery and not the amount of milliwatt-hours of charge left on the battery. I tried Win32_battery but the value for DesignCapacity is blank (ran code on my laptop which has a battery) and the value comes back as null. I tried other fields to make sure I was getting something. I get values for Availability, BatteryStatus, and Caption. Here is the code I am using: #include <MsgBoxConstants.au3> Dim $info $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") $objBatt = $objWMIservice.ExecQuery ("Select * from Win32_Battery") For $object In $objBatt $info &= 'Availability: ' & $object.Availability & @CRLF $info &= 'BatteryRechargeTime: ' & $object.BatteryRechargeTime & @CRLF $info &= 'BatteryStatus: ' & $object.BatteryStatus & @CRLF $info &= 'DesignCapacity: ' & $object.DesignCapacity & @CRLF $info &= 'FullChargeCapacity: ' & $object.FullChargeCapacity & @CRLF $info &= 'TimeOnBattery: ' & $object.TimeOnBattery & @CRLF $info &= 'TimeToFullCharge: ' & $object.TimeToFullCharge & @CRLF $info &= 'Caption: ' & $object.Caption & @CRLF Next MsgBox($MB_SYSTEMMODAL, "battery", $info)
  13. I want to capture the watt hours capacity and percentage used (using the difference of battery charge level at 2 points in time). _WinAPI_GetSystemPowerStatus should work for the percentage used. I have used Win32_Battery but that doesn't have the data I want. This below looks like it might work for watt hours but I don't know how to get autoit to talk to a windows Namespace. Any suggestions? https://learn.microsoft.com/en-us/uwp/api/windows.devices.power.batteryreport.remainingcapacityinmilliwatthours?view=winrt-22621
  14. Thanks @Danp2. That worked. Will remember that in the future.
×
×
  • Create New...