Jump to content

Recommended Posts

Posted (edited)

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.

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

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

opt("TrayIconHide", 1)

While 1

WEnd

Func hide()

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

opt("TrayIconHide", 1)

Return 0

EndFunc

Func show()

$mousepos = MouseGetPos()

Opt("WinTitleMatchMode", 3)

if WinExists ("Command Center") Then

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

sleep(10)

WinActivate("Command Center", "")

elseif not WinExists("Command Center") Then

exit

EndIf

opt("TrayIconHide", 1)

Return 0

EndFunc

Thanks for the help in advance!

Jim

Edited by gdijim

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
×
×
  • Create New...