Jump to content

Search the Community

Showing results for tags 'limit'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 6 results

  1. I took a script written by Beege, optimized the code, and removed the global variables. Its one function, reliable, and very easy to use or modify to your needs. I decided to post it because I found it very hard to find a reliable way to get the cpu percentage of a given process. I know that there are a few different methods but I deem WMI unreliable and everything I tried before optimizing this function was to slow i.e. freezing when other CPU intensive processes were active. When monitoring a potentially CPU intensive process, I found it necessary to increase the script's priority otherwise the script/system would freeze which is exactly what I was attempting to prevent! See Beege's updated post: #NoTrayIcon #include <WinAPI.au3> HotKeySet('{ESC}', '_Exit') Func _Exit() Exit EndFunc ;==>_Exit _LimitProcessCPU("MediaServer.exe", 10, 1, 5) Func _LimitProcessCPU($vProcess, $nLimit, $nInterval = 1, $nScriptPriority = 2) Local $nProcessCpu = -1, $nOverLimit = 0 While ProcessExists($vProcess) $nProcessCpu = _ProcessCPU($vProcess, $nScriptPriority) If $nProcessCpu > 50 Then $nOverLimit += 1 Else $nOverLimit = 0 EndIf If $nOverLimit > $nLimit Then $nOverLimit = 0 ProcessClose($vProcess) ; < - Replace this with what you need. EndIf Sleep($nInterval*1000) WEnd EndFunc Func _ProcessCPU($nPID = @AutoItPID, $nScriptPriority = 2) ; Realtime priority = 5 ; Original Author: Beege -> http://www.autoitscript.com/forum/user/8949-beege/ $nPID = ProcessExists($nPID) If Not $nPID Then Return SetError(1, 0, "") EndIf Local Const $tagFILETIME = "struct;dword Lo;dword Hi;endstruct", $nStructs = 7 Local Static $aStruct[$nStructs], $aPointer[$nStructs], $aStat[4], $hProcess = _WinAPI_OpenProcess(0x1F0FFF, 0, $nPID, True), $bFirstRun = True Local Enum $nIDLETIME, $nKERNELTIME, $nUSERTIME, $nPCreationTime, $nPExitTime, $nPKernelTime, $nPUserTime, _ $nProcStartKern = 0, $nProcStartUser, $nStartKernel, $nStartUser If $bFirstRun Then For $i = 0 To $nStructs - 1 Step 1 $aStruct[$i] = DllStructCreate($tagFILETIME) $aPointer[$i] = DllStructGetPtr($aStruct[$i]) Next EndIf DllCall('Kernel32.dll', "int", "GetSystemTimes", "ptr", $aPointer[$nIDLETIME], "ptr", $aPointer[$nKERNELTIME], "ptr", $aPointer[$nUSERTIME]) DllCall('Kernel32.dll', "int", "GetProcessTimes", "hwnd", $hProcess, "ptr", $aPointer[$nPCreationTime], "ptr", $aPointer[$nPExitTime], "ptr", _ $aPointer[$nPKernelTime], "ptr", $aPointer[$nPUserTime]) Local $aTemp[4] = [DllStructGetData($aStruct[$nPKernelTime], 1), DllStructGetData($aStruct[$nPUserTime], 1), DllStructGetData($aStruct[$nKERNELTIME], 1), _ DllStructGetData($aStruct[$nUSERTIME], 1)], $tProcess, $tSystem If Not $bFirstRun Then $tProcess = ($aTemp[$nProcStartKern] - $aStat[$nProcStartKern]) + ($aTemp[$nProcStartUser] - $aStat[$nProcStartUser]) $tSystem = ($aTemp[$nStartKernel] - $aStat[$nStartKernel]) + ($aTemp[$nStartUser] - $aStat[$nStartUser]) Else ProcessSetPriority(@AutoItPID, $nScriptPriority) $bFirstRun = False EndIf $aStat = $aTemp Return Int(Round(($tProcess / $tSystem) * 100)) EndFunc ;==>_ProcessCPU Edit - To give credit for source. Anonymous
  2. Hi, simple question actually: How to disable the character limit for an edit control? Want unlimited-length (or as much as possible) I know the GUICtrlSetLimit() function but i want to disable the limit, not set one... Any ideas? I thought there was some sort of autoit constant for this or something but cant find what i'm looking for.
  3. I use a DateTimePicker control and now I saw the minimum value for the year it's 1601. Know anyone how can be changed this limit?
  4. Hi everyone. I have a question and wasn't able to find any answer for this. What is the maximum value/limit for TimerInit & TimerDiff. I mean, If I use TimerInit() in my script, how long can it 'last'? How long will I be able to read it with TimerDiff()? I realize that the result of TimerDiff isn't an Integer. It's a floating number and I am not sure what the maximum value is. I would like my program to use $Time = TimerInit() today, and then I'll be able to use TimerDiff($Time) tomorrow or even the day after. Is this possible? and what happens if TimerDiff exceeds the maximum value (if there is any)?
  5. Hi, I'm trying to create an installer that extracts about 586 files (3.2 GB) to temp directory, then executes the msi file. For this, I created a script with 586 fileinstall() functions. Script runs perfectly when executed without compiling. But when executed after compiling, only 263 (~2 GB) files are extracted to the temp directory. The remaining fileinstall() functions returned 0. Is there any limit for usage of fileinstall() in a single script. If so, any work around other than creating a separate script for the remaining files. -Roshith
  6. Is there a way to increase max recursion level? For example this code is using recursion to fill an area with a color but the job is interrupted because of reaching the recursion limit! #include <GDIPlus.au3> $sRegPath = "HKLM\SOFTWARE\AutoIt v3\AutoIt" If StringInStr("X64IA64", @OSArch) Then $sRegPath = StringReplace($sRegPath, "SOFTWARE", "SOFTWARE\Wow6432Node") _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(RegRead($sRegPath, "InstallDir") & "\Examples\GUI\logo4.gif") $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate("Test", $iW, $iH) GUISetState() $hGfx = _GDIPlus_GraphicsCreateFromHWND($hGUI) AdlibRegister("UpdateView", 10) $iColor2Fill = 0xFFFFFFFF ;~ _GDIPlus_FloodFillRec($hImage, 0, 0, 0xFF000080, 0xFFFFFF00) _GDIPlus_FloodFillRec($hImage, 82, 24, 0xFF000080, 0xFFFFFF00) _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Filled.png") ;~ ShellExecute(@ScriptDir & "\Filled.png") AdlibUnRegister("UpdateView") ConsoleWrite("Done" & @LF) Do Until GUIGetMsg() = -3 _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_Shutdown() Exit Func _GDIPlus_FloodFillRec(ByRef $hBitmap, $iX, $iY, $iColorOld, $iColorNew) ;coded by UEZ 2013-01-12 Local Static $iRec = 1 Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapGetPixel", "handle", $hBitmap, "int", $iX, "int", $iY, "uint*", 0) If $aResult[4] = "0x" & Hex($iColorOld, 8) Then DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "handle", $hBitmap, "int", $iX, "int", $iY, "uint", $iColorNew) Else Return 0 EndIf Local $iRecLimit = 3899 $aResult = DllCall($ghGDIPDll, "uint", "GdipGetImageDimension", "handle", $hBitmap, "float*", 0, "float*", 0) If ($iX + 1) < $aResult[2] + 1 Then $iRec += 1 If $iRec = $iRecLimit Then Return -1 _GDIPlus_FloodFillRec($hBitmap, $iX + 1, $iY, $iColorOld, $iColorNew) ;go east $iRec -= 1 EndIf If ($iY + 1) < $aResult[3] + 1 Then $iRec += 1 If $iRec = $iRecLimit Then Return -1 _GDIPlus_FloodFillRec($hBitmap, $iX, $iY + 1, $iColorOld, $iColorNew) ;go south $iRec -= 1 EndIf If ($iX - 1) > -1 Then $iRec += 1 If $iRec = $iRecLimit Then Return -1 _GDIPlus_FloodFillRec($hBitmap, $iX - 1, $iY, $iColorOld, $iColorNew) ;go west $iRec -= 1 EndIf If ($iY - 1) > -1 Then $iRec += 1 If $iRec = $iRecLimit Then Return -1 _GDIPlus_FloodFillRec($hBitmap, $iX, $iY - 1, $iColorOld, $iColorNew) ;go north $iRec -= 1 EndIf Return 1 EndFunc ;==>_GDIPlus_FloodFillRec Func UpdateView() _GDIPlus_GraphicsDrawImage($hGfx, $hImage, 0, 0) EndFunc Br, UEZ
  • Create New...