Jump to content

Hot key macro uses 100 % CPU?

Recommended Posts

Okay couple things - this macro isn't perfect.

First, it uses 100 percent CPU when it runs - can anyone tell me why? This isn't really acceptable for it to use that much CPU because I intend on executing this macro to run all the time. The code below accesses the window "Command Center"

Also, I'd like to be able to restore the window if it's minimized and minimize the window if it's restored with the SAME KEYSTROKE combo - Currently this isn't the case, because I haven't been able to get this to work - my work around is to use a different key stroke.

hotkeyset ("+!x", "hide")

hotkeyset ("+!d", "show")

opt("TrayIconHide", 1)

While 1


Func hide()

WinSetState ( "Command Center", "", @SW_MINIMIZE )

opt("TrayIconHide", 1)

Return 0


Func show()

$mousepos = MouseGetPos()

Opt("WinTitleMatchMode", 3)

if WinExists ("Command Center") Then

winmove("Command Center", "", $mousepos[0], $mousepos[1])


WinActivate("Command Center", "")

elseif not WinExists("Command Center") Then



opt("TrayIconHide", 1)

Return 0


Thanks for the help in advance!


Edited by gdijim
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...