Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/15/2011 in all areas

  1. Zedna

    From tip to Progress

    This is quick solution. It can be improved to be called according to timers. #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> Global $iProcessCPU_prev = '' #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 129, 192, 124) $Progress1 = GUICtrlCreateProgress(32, 16, 545, 89) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;~ $array = ProcessList("explorer.exe") ;~ $iPID = $array[1][1] ;~ $sProcess = $iPID ;PID number for test process name $sProcess = "Idle" ;Other test process names ;~ $sProcess = "_Total" ;funny one ;~ $sProcess = "ntvdm" ;DOS process ;~ $sProcess = "AutoIt3" ;do not assign .exe to process name While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $iProcessCPU = _ProcessGetCPU($sProcess, 300 ) If $iProcessCPU <> $iProcessCPU_prev Then GUICtrlSetData($Progress1, $iProcessCPU) $iProcessCPU_prev = $iProcessCPU ;~ $sTip = "Process " & $sProcess & " CPU: " & $iProcessCPU & "%" ;~ traytip("", $sTip ,1) EndIf WEnd Func _ProcessGetCPU($strProcess = "Idle", $iSampleTime = 10, $sComputerName = @ComputerName) ;~ All Parameters are optional: ;~ - Idle process will be measured if first parameter is not set ;~ - 500 ms is default sample time ;~ - This computer will be measured by default ;~ Process could be string ("Name") or PID number (1234) ;~ When more processes are runing with identical name, then the last opened is measured (use PID for other) ;~ For NORMAL MODE(one time measuring): set Sample value to more than 0 ms ;~ ( average CPU usage will be measured during sleep time within function) ;~ For LOOP MODE (continuous measuring): set Sample value to 0 ms ;~ ( average CPU usage will be measured between two function calls ) ;~ Total CPU usage is: ( 100 - _ProcessGetCPU()) ;~ Success: Returns process CPU usage in percent ;~ (Sample times below 100ms may return inaccurate results) ;~ (First result in Loop Mode may be inaccurate, ;~ because first call in Loop Mode is only used to trigger counters) ;~ Failure: Returns -1 ( wrong process name or PID ) ;~ : Returns -2 ( WMI service not found or Computer not found) if $strProcess = "" then $strProcess = "Idle" if $iSampleTime = "" AND IsString($iSampleTime) then $iSampleTime = 500 if $sComputerName = "" then $sComputerName = @ComputerName if not IsDeclared("iP1") AND $iSampleTime = 0 then ;first time in loop mode $bFirstTimeInLoopMode = 1 else $bFirstTimeInLoopMode = 0 endif if not IsDeclared("iP1") then assign("iP1", 0, 2) ;forced global declaration first time assign("iT1", 0, 2) endif $objWMIService = ObjGet("winmgmts:" & $sComputerName & "rootCIMV2") if @error then return -2 if number($strProcess) then $strProcess = " WHERE IDProcess = '" & $strProcess & "'" else $strProcess = " WHERE Name = '" & $strProcess & "'" endif if $iSampleTime OR $bFirstTimeInLoopMode = 1 then ;skip if Loop Mode, but not First time $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfRawData_PerfProc_Process" & $strProcess) For $objItem In $colItems $iT1 = $objItem.TimeStamp_Sys100NS $iP1 = $objItem.PercentProcessorTime next if $objItem = "" then return -1 ;process not found sleep($iSampleTime) endif $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfRawData_PerfProc_Process" & $strProcess) For $objItem In $colItems $iP2 = $objItem.PercentProcessorTime $iT2 = $objItem.TimeStamp_Sys100NS next if $objItem = "" then return -1 ;process not found $iPP = ($iP2 - $iP1) $iTT = ($iT2 - $iT1) if $iTT = 0 Then return 100 ;do not divide by 0 $iCPU = round( ($iPP/$iTT) * 100, 0) $iP1 = $iP2 $iT1 = $iT2 Return $iCPU EndFunc ;==>_ProcessGetCPU() by novaTek ...ver 0.11
    1 point
  2. trancexx

    Help with PHP

    So you changed cool avatar with boring one and kept your nick name.I hope you weren't making any important RL decisions yesterday.
    1 point
  3. It's all pixels, you are just doing the math wrong. Not sure what you want, maybe this? WinMove($Form2,"", $frm1pos[0] - $frm2pos[2], $frm1pos[1] + $frm1pos[3] - $frm2pos[3])
    1 point
  4. Skitty

    Help with PHP

    Close, it was actually "The worst thing about censorship is ████████" Anyway, I figured I'd just include the javascript code by obtaining it from an external source which works, but being able to change things in it with php would still be good..
    1 point
  5. Mat

    Help with PHP

    The old avatar said: "The best thing about censorship is ████████"
    1 point
  6. iloveautoits

    how i hack

    how do i hack some one
    1 point
  7. iloveautoits

    how i hack

    it sad windows cant fin 'hack'
    1 point
  8. monoceres

    how i hack

    Open console then type "hack -n PERSONTOHACK -hide -override"All done
    1 point
×
×
  • Create New...