Jump to content
ur

How to suspend a process for some time

Recommended Posts

ur

with the below code, I am keeping waiting for a particular file and waiting in the background.

While $i <> 10
 Sleep(60000)
    If FileExists(@ScriptDir&"\Binaries.ini") then
        --some processing--
        $i = 10
    endif
WEnd

I thought keeping the Sleep will freeze the process from resources but the CPU being uilized.But it is taking 47%.

How to free this CPU usage also.?

123.PNG

Share this post


Link to post
Share on other sites
careca

There must be more to that script, to cause that cpu usage. The code you have  there shouldn't use that much cpu.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
ur
1 hour ago, careca said:

There must be more to that script, to cause that cpu usage. The code you have  there shouldn't use that much cpu.

But it should release the resources atleast during the Sleep time right.
But it isn't.

Share this post


Link to post
Share on other sites
Earthshine

it depends but we can't tell because we can't see it


My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
careca
51 minutes ago, ur said:

But it should release the resources

resources, now ur talking RAM usage. Cpu is all about processing stuff. is there any adlib funcs for instance?


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
ur

THis is my script.

 

Local $i = 0
While $i <> 10
    Sleep(60000);1min
    If FileExists(@ScriptDir&"\Binaries.ini") then
        
        WaitForINICompletion(@ScriptDir&"\Binaries.ini")
        SendMail("Binaries copied to Installshield machine","Got Binaries.ini: Will initmate once Install creation started")
         Sleep(5000)
        
        ;MsgBox($MB_SYSTEMMODAL, "", "Value of $i is: " & $i)
        ChangeWin32(@ScriptDir&"\Binaries.ini")
        CheckZip(@ScriptDir&"\Binaries.ini")
        AppendBinaries(@ScriptDir&"\Binaries.ini",@ScriptDir&"\BinaryDetails.ini")
        if(FileExists(@ScriptDir&"\copy.exe")) then
            Local $iReturn = Runwait(@ScriptDir&"\copy.exe", "", @SW_MAXIMIZE)
            if not @error Then
                ;Logging("execution completed successfully with Return Code: " & $iReturn,4)
            Else
                ;Logging("execution failed with Return Code: " & $iReturn,4)
            EndIf
            ;FileMove(@ScriptDir&"\BinaryDetails.ini", @ScriptDir&"\BinaryDetails_old.ini", 0)
            ;MsgBox($MB_SYSTEMMODAL, "", "The return code from CreateSetup was: " & $iReturn)
        EndIf
        if(FileExists(@ScriptDir&"\CreateSetup.exe")) then
            Local $iReturn = Runwait(@ScriptDir&"\CreateSetup.exe", "", @SW_MAXIMIZE)
            if not @error Then
                ;Logging("execution completed successfully with Return Code: " & $iReturn,4)
            Else
                ;Logging("execution failed with Return Code: " & $iReturn,4)
            EndIf
            ;FileMove(@ScriptDir&"\BinaryDetails.ini", @ScriptDir&"\BinaryDetails_old.ini", 0)
            ;MsgBox($MB_SYSTEMMODAL, "", "The return code from CreateSetup was: " & $iReturn)
        EndIf
    EndIf

WEnd
Func Logging($sMessage,$sLogFile=@ScriptDir&"\Logging.log")
    If $sMessage = "" Then
        FileWriteLine($sLogFile, "")
    Else
        FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF)
    EndIf
EndFunc

 

Share this post


Link to post
Share on other sites
JLogan3o13

@ur as usual it is like pulling teeth with you. How are we supposed to help you narrow down the problem when you have, by my count, 5 custom functions (WaitForINICompletion, SendMail, ChangeWin32, CheckZip, AppendBinaries) in there that you are not sharing with us?

Edited by JLogan3o13
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Earthshine

did you miss the CreateSetup.exe stuff? lol

InstallShield comes with isbuild, you can automate your builds that.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
ur

Sorry @JLogan3o13

These are the au3 files.And the dependent library.au3

Createsetup.exe and copy.exe are tirdparty ones and we don't have source code with us.

But anyway, the issue is before entering the if blocks.
 

BackroundforBinaries.au3

Library.au3

Share this post


Link to post
Share on other sites
careca

copy and createsetup exe's running in background?

I was late, but what do you mean before entering the if blocks?

a sleep inside a loop doesnt use cpu at all.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
ur

No, I kept wait for the Binaries.ini file in the background.

Only when the file appears or copied from another machine in the network to this folder, then the createsetup and copy exe file will run.

But the CPU is 97% when it is still waiting

Share this post


Link to post
Share on other sites
Earthshine

that's probably not the whole script either. i'm done. have fun. i would look at it using ProcessViewer and see what resources it is using. That will probably answer your question.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
ur

Sorry @Earthshine, these are the main scripts.

Are you getting any error during compilation?

If it is for .ps1 files, just keep some dummy files, I don't have them also, they need for other fumctions in the library.au3 which we are not using here.

Edited by ur

Share this post


Link to post
Share on other sites
Earthshine

ProcessExplorer from SysInternals is your friend. click on your running process that you think is sleeping and look at the dlls and other resources it uses.

I do not believe that sleeping should release allocated resources.

https://live.sysinternals.com/procexp64.exe

https://live.sysinternals.com/procexp.exe

you could also use ProcMon to see what's getting hit, registry, file system, etc..

https://live.sysinternals.com/Procmon.exe

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
careca

Yea, this is not going anywhere.

Comment functions one by one until you see a reduction in cpu usage, then you can focus on that specific function to see what's up.

Good luck


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
Jos
1 hour ago, ur said:

Sorry @JLogan3o13

These are the au3 files.And the dependent library.au3

Createsetup.exe and copy.exe are tirdparty ones and we don't have source code with us.

But anyway, the issue is before entering the if blocks.
 

BackroundforBinaries.au3

Library.au3

Unlike the others shooting from the hip at your lack of info provided: What did your debugging reveal?
You can't come in here posting constantly these questions without having done some basic debugging yourself. (I am pretty sure I am repeating myself to you now!)

You should know how to do this debugging by now, so start thinking for a change and doing the work yourself! Come back when you have more to show for.

Jos

 

 

  • Like 1

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
careca
2 hours ago, Jos said:

...shooting from the hip

 

 

nice analogy ;)


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
Earthshine

Yeah.  Never post results from the console even. My current hypothesis is that us, he isn’t sleeping it’s doing something and he’s not aware of it because there’s no logging and he doesn’t know what the he k is going on 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • Miliardsto
      By Miliardsto
      I want to detect if exact process or window uses directx or opengl or maybe something else library used in applications.
      Thats becouse there could be many windows with same names and different names and the same with process. I got so much process names I want to my script works with all, so i want standardize.
      All of this processes uses DirectX or OpenGL so then If I check this window/process uses these libraries I will be sure thats the right process
    • TryWare90Days
      By TryWare90Days
      I'm trying to kill a malware process, that I can't remove with my www.sophus.com/hom antivirus.

      The malware is known as coinminer,config and my Sophus only creates popups of blocking the malware.

      I know that the malware is constantly launching a svchost *32.exe processes, where the svchost.exe processes are from my Windows 7 operating system.
      I have with no luck tried to do this:
      Global $_bStatus = False
      While $_bStatus = False
                 Global $_iPid
                 Global $_sActiveTitleNew = "svchost *32.exe"
                 $_iPid = WinGetProcess($_sActiveTitleNew)
                 If $_iPid <> -1 Then $_bStatus = ProcessClose($_iPid)   
      Wend
      EXIT
       
      But the $_iPid doesn't ever show anything else than  -1, even if I can see the svchost *32.exe process in my TaskManager
       
      YES - I know I shouldn't EXIT after killing the first malware detection, but it is easier to explain the above for you, so I can get a solution.
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an inquiry after your permission
      I found a function to get the special line commands for any operation
      It requires the name of the process to be searched
      I want to use it to know the process
      Is this possible with this function
      Here is the code
       
      Func commandLineGet($proc, $strComputer=".")
      dim $array[1]
      local $ArrayNumber
      local $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
      local $oProcessColl = $oWMI.ExecQuery("Select * from Win32_Process where Name= " & '"'& $Proc & '"')
      local $Process
      For $Process In $oProcessColl
      $Process = $Process.Commandline
          ReDim $Array[UBound($Array)+1]
      $ArrayNumber = UBound($Array)-1
      $array[$ArrayNumber] = $Process
      Next
      $ArrayNumber = UBound($Array)-1
      $array[0] = $ArrayNumber
      return $array
      EndFunc
    • simy8891
      By simy8891
      Hi guys,
      It's been a while since I wrote my last message here and a while since I used AutoIt. I'm currently sort of desperate and I'm trying to find some help in regards of getting the network usage per process!
      I'm not interested in the total network usage of the NIC, but only on a specific PID's network utilization. They idea is to collect the amount of traffic uploaded and downloaded by a list of specific processes. So far Process Hacker and Process Explorer are capable of getting what I need, but I need to use these numbers in another script so they're sort of useless to me. I can't seem to find a way around it.
      Any idea, help is greatly appreciated.
      Thanks
    • ur
      By ur
      With  ProcessList ( ["name"] )  we are able to get the running process list from the local machine.
       
      Is there anyway to get the list from Remote machine, more precisely to get to know the status whether a particular application is running or not on remote machine using AutoIT?
       
      We can implement through PSList.exe, but again we need to parse the text of it to read the output.
      Is there any direct UDF in AutoIT?
×