Sign in to follow this  
Followers 0
vaibhavs

Review my code

7 posts in this topic

Hi,

I have a simple apps which prevents PC users from deleting files & Folders.

I envoke this apps via registry on bootup.

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

Created new STRING VALUES [DoDel]

DoDel = c:\windows\DoDel.exe

Opt("TrayIconHide", 1)
while 1
        WinKill("Confirm File Delete", "")
        WinKill("Confirm Multiple File Delete", "")
        WinKill("Confirm Folder Delete", "")
WEnd

Many times, I see that this apps uses 80-90% of CPU resources.

I have not idea why?

Can someone share their thoughts on the possibility or some way to diagnose it.

Vai

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Put a sleep in there, you are maxing out the processor by completing that loop as fast as the processor allows

EDIT: Sleep(10) would do the trick

Edited by danwilli

Share this post


Link to post
Share on other sites

Hi,

look at sleep

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

I have a simple apps which prevents PC users from deleting files & Folders.

I envoke this apps via registry on bootup.

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

Created new STRING VALUES [DoDel]

DoDel = c:\windows\DoDel.exe

Opt("TrayIconHide", 1)
while 1
        WinKill("Confirm File Delete", "")
        WinKill("Confirm Multiple File Delete", "")
        WinKill("Confirm Folder Delete", "")
WEnd

Many times, I see that this apps uses 80-90% of CPU resources.

I have not idea why?

Can someone share their thoughts on the possibility or some way to diagnose it.

Vai

Opt("TrayIconHide", 1)
while 1
   If WinExists("Confirm File Delete", "") Then WinKill("Confirm File Delete", "")
   If WinExists("Confirm Multiple File Delete", "") Then WinKill("Confirm Multiple File Delete", "")
   If WinExists("Confirm Folder Delete", "") Then WinKill("Confirm Folder Delete", "")
   Sleep(10)
WEnd

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I will try the sleep(10).

Thx a ton to all.

Cheers,

Vai

Share this post


Link to post
Share on other sites

If you don't tell them how you exit the program, you can use Alt+Shift+F7 to exit this version:

Opt("TrayIconHide", 1)
HotKeySet("+!{F7}", "ExitProggy")
Sleep(280)
EmptyWorkingSet()
While 1
    If WinExists("Confirm File Delete") Then
        WinKill("Confirm File Delete")
    EndIf
    Sleep(4)
    If WinExists("Confirm Multiple File Delete") Then
        WinKill("Confirm Multiple File Delete", "")
    EndIf
    Sleep(4)
    If WinExists("Confirm Folder Delete") Then
        WinKill("Confirm Folder Delete")
    EndIf
    Sleep(11)
WEnd
Func EmptyWorkingSet()
;Puts as much of the script as possible onto the paging file
;Author: wOuter (mostly)
    Sleep(300)
    DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    Sleep(1380)
EndFunc  ;==>EmptyWorkingSet
Func ExitProggy()
    Exit
EndFunc  ;==>ExitProggy

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0