Jump to content

Toggle a process on and off with a hotkey/function


Azu
 Share

Recommended Posts

HotKeySet("^+a", "_kill")

Func _kill()

$Killed = "1"

If ProcessExists("explorer.exe") Then

ProcessClose("explorer.exe")

$Killed = "0"

Else

EndIf

If $Killed = "1" & not ProcessExists("explorer.exe") Then

Run("explorer.exe")

Else

EndIf

EndFunc

It doesn't work.. pressing the hotkey once should turn it off, pressing it again should turn it back on.

But instead, pressing it simply causes it to restart.. rather then turning it off... how come?

Link to comment
Share on other sites

If you kill explorer, it will restart. windows is featured to do so.

(because it happens so often that explorer crash that microsoft's developpement team included this feature :o )

But this feature is really interesting : this is for example the best solution to move "my documents" folder with autoit : first change registry values, and then kill explorer so it restarts.

Link to comment
Share on other sites

I kill explorer.exe manuelly before playing any high-end games sence it takes up a lot of resources, especially sence I am using windows vista..

It doesn't restart when I kill it with the task manager, it also doesn't restart if I make a script that only disables it, but I want to be able to toggle it..

Also I don't want to change any registry values, I hate programs that change the registry.

Link to comment
Share on other sites

Hmm, this could cause some serious errors to the windows operating system if you do this on a regular basis.

I wouldn't recommend ending explorer like this since explorer is a vital part of the operating system. As a result, it is constantly updating registry keys and other critical files and ending it while it is doing this could cause errors.

If you want more speed, shutdown services that aren't vital, for example, error reporting and the print spooler service.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

I don't have those services start up to begin with

Explorer.exe takes up a lot of my ram

I end it on a regular basis anyways

But I'm lazy, I hate opening up task manager every time to manuelly kill it and re-open it

Which is why I want to just make it toggle able

I wish someone would just tell me how to make this work rather then telling me not to do it.. >.>

Link to comment
Share on other sites

Very well, but you have been warned.

HotKeySet("^+a", "_kill")
Func _kill()
If ProcessExists("explorer.exe") Then
    ProcessClose("explorer.exe")
Else
    Run("explorer.exe")
Endif
EndFunc

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Then it's likely windows is restarting it on its own. It should do that anyway, since explorer is pretty much the basis of everything you work with.

I just tested the single-hotkey method for toggling a process. It works fine. I used cmd.exe because it isn't nearly as important.

HotKeySet("c", "_kill")
Func _kill()
If ProcessExists("cmd.exe") Then
    ProcessClose("cmd.exe")
Else
    Run("cmd.exe")
Endif
EndFunc
While 1
    Sleep (1000)
WEnd
Edited by greenmachine
Link to comment
Share on other sites

I kill explorer.exe manuelly before playing any high-end games sence it takes up a lot of resources, especially sence I am using windows vista..

It doesn't restart when I kill it with the task manager, it also doesn't restart if I make a script that only disables it, but I want to be able to toggle it..

Also I don't want to change any registry values, I hate programs that change the registry.

using windows vista? Microsoft Has'nt released it to the PUBLIC yet... its only avaible for Beta Testers..... r u on the Microsoft Beta Team? "do u mean, Windows XP"?

Edited by CHRIS95219
Link to comment
Share on other sites

Oh and I don't have a process called "cmd.exe" running o.0

That's fine, I realize you probably don't have it running at all times. That's why the function allows you to START it as well as stop it (with the same key).

Also, for memory, killing both processes of msnmsgr.exe and firefox.exe (and taskmgr.exe, and maybe both taskeng.exe?) would do much more good than trying to kill explorer.exe. Also, if you check the "show processes from all users", you might have more stuff that is wasting memory. I have 59 processes running right now, including iTunes and firefox (both big memory drainers), and my usage is much less than yours.

Link to comment
Share on other sites

I do turn off firefox and msn messenger

Manuelly

I would just like a conveniant script for my auto-login program for turning off explorer.exe while running a fullscreen game and turning it back on afterwards

More conveniant then going into the task manager and stuff every time

The screenshot was just to show how much memory explorer.exe takes up

Edited by Azu
Link to comment
Share on other sites

Ok, my Explorer.exe takes up 8MB of RAM. Open up themes and switch your them to windows classic. Next, right click My Computer, go to Properties, then go to the Advanced tab. Once there click settings button in the Performance group box. Then click the radio button that says, "Adjust for best performance." Once you do that, reboot the system. Explorer should now be using significantly less RAM.

Hope that helps.

The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...