Sign in to follow this  
Followers 0
Azu

Toggle a process on and off with a hotkey/function

24 posts in this topic

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?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

You should try your process toggle with a less vital process. For example, cmd.exe.

Share this post


Link to post
Share on other sites

???

Same thing happens.

How do I fix it?

Share this post


Link to post
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

Share this post


Link to post
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.. >.>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

That's what I was trying before.. it doesn't work though.. it just makes it restart..

I guese I'll just have to make it two seperate hotkeys like nfwu suggested

Share this post


Link to post
Share on other sites

Him that didn't work.. it still restarts it.. no matter what I do.. gr.. x_X

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

What does cmd.exe do?

Does killing it free up a lot of ram?

Share this post


Link to post
Share on other sites

No, not at all. It's the command prompt, and it uses essentially no memory. It's just a good example.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

???

Posted Image

It takes up lots of ram makes games run slow o.0

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

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

Share this post


Link to post
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

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