Jump to content


Photo

Disabling Buttons


  • Please log in to reply
5 replies to this topic

#1 Apezdr

Apezdr
  • Members
  • 10 posts

Posted 16 July 2012 - 11:37 PM

How would I go about doing this?
Gui, Add, Button, x24 y289 w100 h30 gGuiClose, Exit
      Gui, Add, Button, x132 y30 w90 h30 gHWoW, Run H-WoW
      Gui, Font, S3 CDefault, Verdana
      Gui, Font, S5 CDefault, Verdana
      Gui, Add, GroupBox, x22 y100 w200 h70 , Choose One
      Gui, Show, x266 y125 h338 w235, H-WoW Hotkeys
      Return

GuiClose:
ExitApp

HWoW:
Run H-WoW.exe
I just want it to disable when the program is open, (H-WoW.exe), and enable when it isn't.
I know I'm not the only one wondering this! Please help! Thanks in advance

#2 MasterFocus

MasterFocus
  • Moderators
  • 4132 posts

Posted 17 July 2012 - 12:44 AM

Please don't create a new topic unnecessarily.
You already have a topic for this issue, in which I provided some links.
If you read those and this one as well, you'll be able to do what you want.

#3 DethKlok

DethKlok
  • Members
  • 322 posts

Posted 17 July 2012 - 01:50 AM

SetTimer Did the trick with notepad.exe, You will need to change the Notepad.exe to H-WoW.exe and the ahk_class notepad parts to whatever ahk_class H-WoW has.
LoadGui:
   Gui, Add, Button, x24 y289 w100 h30 gGuiClose, Exit
   Gui, Add, Button, x132 y30 w90 h30 gHWoW, Run H-WoW
   Gui, Font, S3 CDefault, Verdana
   Gui, Font, S5 CDefault, Verdana
   Gui, Add, GroupBox, x22 y100 w200 h70 , Choose One
   Gui, Show, x266 y125 h338 w235, H-WoW Hotkeys
Return

GuiClose:
ExitApp

HWoW:
   Gui, Destroy
   Run, Notepad.exe  [color=RED]; Change This to H-WoW.exe[/color]
   WinWait, ahk_class Notepad  [color=RED]; Change This to your H-WoW ahk_class.[/color]
   SetTimer, Timer, 100
Return

Timer:
IfWinNotExist, ahk_class Notepad  [color=RED]; Change This again to your H-WoW ahk_class.[/color]
   {
   SetTimer, Timer, Off
   Gosub, LoadGui
   }
Return
Tell Me if this works the way you need it.

#4 Apezdr

Apezdr
  • Members
  • 10 posts

Posted 17 July 2012 - 03:00 AM

SetTimer Did the trick with notepad.exe, You will need to change the Notepad.exe to H-WoW.exe and the ahk_class notepad parts to whatever ahk_class H-WoW has.

LoadGui:
   Gui, Add, Button, x24 y289 w100 h30 gGuiClose, Exit
   Gui, Add, Button, x132 y30 w90 h30 gHWoW, Run H-WoW
   Gui, Font, S3 CDefault, Verdana
   Gui, Font, S5 CDefault, Verdana
   Gui, Add, GroupBox, x22 y100 w200 h70 , Choose One
   Gui, Show, x266 y125 h338 w235, H-WoW Hotkeys
Return

GuiClose:
ExitApp

HWoW:
   Gui, Destroy
   Run, Notepad.exe  [color=RED]; Change This to H-WoW.exe[/color]
   WinWait, ahk_class Notepad  [color=RED]; Change This to your H-WoW ahk_class.[/color]
   SetTimer, Timer, 100
Return

Timer:
IfWinNotExist, ahk_class Notepad  [color=RED]; Change This again to your H-WoW ahk_class.[/color]
   {
   SetTimer, Timer, Off
   Gosub, LoadGui
   }
Return
Tell Me if this works the way you need it.


Almost. It doesn't gray the button out.
This is what i have so far...

Gui, Add, Text, x172 y310 w50 h20 , ©Apezdr
		Gui, Add, Text, x72 y0 w100 h30 +Center, Thanks for using this Macro Tool!
		Gui, Add, GroupBox, x12 y60 w210 h210 , Hotkeys
		Gui, Add, Text, x22 y40 w60 h20 , Controls
		Gui, Add, Text, x23 y82 w64 h15 , Speed Hack
		Gui, Add, Text, x32 y110 w60 h20 , Fly Hack
		Gui, Add, Text, x32 y140 w70 h30 , Walk On Water
		Gui, Add, Text, x22 y180 w70 h30 , Wall Climb
		Gui, Add, Text, x22 y210 w70 h30 , No-Clip
		Gui, Add, Text, x21 y239 w69 h23 , Reactivate
		Gui, Font, S8 CDefault Bold, Verdana
		Gui, Font, S8 CDefault Bold, Verdana
		Gui, Font, S8 CDefault, Verdana
		Gui, Font, S8 CDefault, Verdana
		Gui, Font, S8 CDefault, Verdana
		Gui, Add, Text, x172 y240 w40 h20 , Ctrl-B
		Gui, Add, Button, x24 y289 w100 h30 gGuiClose, Exit
		Gui, Add, Text, x172 y210 w40 h20 , Alt-C
		Gui, Add, Text, x192 y220 w-50 h-20 , Alt-C
		Gui, Add, Text, x172 y180 w40 h20 , Alt-F
		Gui, Add, Text, x172 y140 w40 h20 , Alt-X
		Gui, Add, Text, x172 y110 w40 h20 , Alt-Z
		Gui, Add, Text, x172 y80 w40 h20 , Alt-W
		Gui, Add, Button, x132 y30 w90 h30 gHWoW, Run H-WoW
		Gui, Font, S3 CDefault, Verdana
		Gui, Font, S5 CDefault, Verdana
		Gui, Add, GroupBox, x22 y100 w200 h70 , Choose One
		Gui, Show, x266 y125 h338 w235, H-WoW Hotkeys
		Return


GuiClose:
ExitApp

HWoW:
Run H-WoW.exe
IfWinExist, H-WoW hack
{
	GuiControl Disable0, Run H-WoW

}
IfWinNotExist, H-WoW hack
{
	GuiControl Disable1, Run H-WoW
}
return

;Hotkey Code Below
				!W::
				WinWait, H-WoW hack, 
				IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack, 
				WinWaitActive, H-WoW hack, 
				MouseClick, left,  33,  51
				;GuiControl, Cmd ,Check, Button1, H-WoW hack
				IfWinExist, World of Warcraft
{
    WinActivate  ; Automatically uses the window found above.
    return
}
				return
				;Fly Hack Activation
					!Z::
					WinWait, H-WoW hack, 
					IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack, 
					WinWaitActive, H-WoW hack, 
					MouseClick, left,  33,  120
					return
						; Walk On Water
						!X::
						MouseClick, left,  33,  137
						IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack, 
						WinWaitActive, H-WoW hack, 
						return
							; Wall Climb
							!F::
							MouseClick, left,  141,  121
							IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack, 
							WinWaitActive, H-WoW hack, 
							return
				; NoClip
				!C::
				MouseClick, left,  141,  137
				IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack, 
				WinWaitActive, H-WoW hack, 
				return
			; Reactivate
			^B::
			MouseClick, left,  70,  163
			IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack, 
			WinWaitActive, H-WoW hack,
			WinActivate, H-WoW hack,
			return
Pay particular attention to the label H-WoW

HWoW:
Run H-WoW.exe
IfWinExist, H-WoW hack
{
GuiControl Disable0, Run H-WoW

}
IfWinNotExist, H-WoW hack
{
GuiControl Disable1, Run H-WoW
}
return

This turns the button off when the program is launched. But it doesn't turn it back on when the program is closed. What am I not seeing? Code reference

#5 DethKlok

DethKlok
  • Members
  • 322 posts

Posted 17 July 2012 - 04:50 AM

I'm just winging it now, It looks rite and works on my computer, but to each his own. You might need to change the disable1 and 0 around.
SetTimer , HideButton, 100

      Gui, Add, Text, x172 y310 w50 h20 , ©Apezdr

      Gui, Add, Text, x72 y0 w100 h30 +Center, Thanks for using this Macro Tool!

      Gui, Add, GroupBox, x12 y60 w210 h210 , Hotkeys

      Gui, Add, Text, x22 y40 w60 h20 , Controls

      Gui, Add, Text, x23 y82 w64 h15 , Speed Hack

      Gui, Add, Text, x32 y110 w60 h20 , Fly Hack

      Gui, Add, Text, x32 y140 w70 h30 , Walk On Water

      Gui, Add, Text, x22 y180 w70 h30 , Wall Climb

      Gui, Add, Text, x22 y210 w70 h30 , No-Clip

      Gui, Add, Text, x21 y239 w69 h23 , Reactivate

      Gui, Font, S8 CDefault Bold, Verdana

      Gui, Font, S8 CDefault Bold, Verdana

      Gui, Font, S8 CDefault, Verdana

      Gui, Font, S8 CDefault, Verdana

      Gui, Font, S8 CDefault, Verdana

      Gui, Add, Text, x172 y240 w40 h20 , Ctrl-B

      Gui, Add, Button, x24 y289 w100 h30 gGuiClose, Exit

      Gui, Add, Text, x172 y210 w40 h20 , Alt-C

      Gui, Add, Text, x192 y220 w-50 h-20 , Alt-C

      Gui, Add, Text, x172 y180 w40 h20 , Alt-F

      Gui, Add, Text, x172 y140 w40 h20 , Alt-X

      Gui, Add, Text, x172 y110 w40 h20 , Alt-Z

      Gui, Add, Text, x172 y80 w40 h20 , Alt-W

      Gui, Add, Button, x132 y30 w90 h30 gHWoW, Run H-WoW

      Gui, Font, S3 CDefault, Verdana

      Gui, Font, S5 CDefault, Verdana

      Gui, Add, GroupBox, x22 y100 w200 h70 , Choose One

      Gui, Show, x266 y125 h338 w235, H-WoW Hotkeys

      Return





GuiClose:

ExitApp



HWoW:

Run H-WoW.exe

return



HideButton:

IfWinExist, H-WoW hack

   GuiControl Disable1, Run H-WoW

Else IfWinNotExist, H-WoW hack

   GuiControl Disable0, Run H-WoW

return





;Hotkey Code Below

            !W::

            WinWait, H-WoW hack,

            IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,

            WinWaitActive, H-WoW hack,

            MouseClick, left,  33,  51

            ;GuiControl, Cmd ,Check, Button1, H-WoW hack

            IfWinExist, World of Warcraft

{

    WinActivate  ; Automatically uses the window found above.

    return

}

            return

            ;Fly Hack Activation

               !Z::

               WinWait, H-WoW hack,

               IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,

               WinWaitActive, H-WoW hack,

               MouseClick, left,  33,  120

               return

                  ; Walk On Water

                  !X::

                  MouseClick, left,  33,  137

                  IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,

                  WinWaitActive, H-WoW hack,

                  return

                     ; Wall Climb

                     !F::

                     MouseClick, left,  141,  121

                     IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,

                     WinWaitActive, H-WoW hack,

                     return

            ; NoClip

            !C::

            MouseClick, left,  141,  137

            IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,

            WinWaitActive, H-WoW hack,

            return

         ; Reactivate

         !B::

         MouseClick, left,  70,  163

         IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,

         WinWaitActive, H-WoW hack,

         WinActivate, H-WoW hack,

         return


#6 Apezdr

Apezdr
  • Members
  • 10 posts

Posted 19 July 2012 - 09:47 PM

I'm just winging it now, It looks rite and works on my computer, but to each his own. You might need to change the disable1 and 0 around.

SetTimer , HideButton, 100
      Gui, Add, Text, x172 y310 w50 h20 , ©Apezdr
      Gui, Add, Text, x72 y0 w100 h30 +Center, Thanks for using this Macro Tool!
      Gui, Add, GroupBox, x12 y60 w210 h210 , Hotkeys
      Gui, Add, Text, x22 y40 w60 h20 , Controls
      Gui, Add, Text, x23 y82 w64 h15 , Speed Hack
      Gui, Add, Text, x32 y110 w60 h20 , Fly Hack
      Gui, Add, Text, x32 y140 w70 h30 , Walk On Water
      Gui, Add, Text, x22 y180 w70 h30 , Wall Climb
      Gui, Add, Text, x22 y210 w70 h30 , No-Clip
      Gui, Add, Text, x21 y239 w69 h23 , Reactivate
      Gui, Font, S8 CDefault Bold, Verdana
      Gui, Font, S8 CDefault Bold, Verdana
      Gui, Font, S8 CDefault, Verdana
      Gui, Font, S8 CDefault, Verdana
      Gui, Font, S8 CDefault, Verdana
      Gui, Add, Text, x172 y240 w40 h20 , Ctrl-B
      Gui, Add, Button, x24 y289 w100 h30 gGuiClose, Exit
      Gui, Add, Text, x172 y210 w40 h20 , Alt-C
      Gui, Add, Text, x192 y220 w-50 h-20 , Alt-C
      Gui, Add, Text, x172 y180 w40 h20 , Alt-F
      Gui, Add, Text, x172 y140 w40 h20 , Alt-X
      Gui, Add, Text, x172 y110 w40 h20 , Alt-Z
      Gui, Add, Text, x172 y80 w40 h20 , Alt-W
      Gui, Add, Button, x132 y30 w90 h30 gHWoW, Run H-WoW
      Gui, Font, S3 CDefault, Verdana
      Gui, Font, S5 CDefault, Verdana
      Gui, Add, GroupBox, x22 y100 w200 h70 , Choose One
      Gui, Show, x266 y125 h338 w235, H-WoW Hotkeys
      Return


GuiClose:
ExitApp

HWoW:
Run H-WoW.exe
return

HideButton:
IfWinExist, H-WoW hack
   GuiControl Disable1, Run H-WoW
Else IfWinNotExist, H-WoW hack
   GuiControl Disable0, Run H-WoW
return


;Hotkey Code Below
            !W::
            WinWait, H-WoW hack,
            IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,
            WinWaitActive, H-WoW hack,
            MouseClick, left,  33,  51
            ;GuiControl, Cmd ,Check, Button1, H-WoW hack
            IfWinExist, World of Warcraft
{
    WinActivate  ; Automatically uses the window found above.
    return
}
            return
            ;Fly Hack Activation
               !Z::
               WinWait, H-WoW hack,
               IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,
               WinWaitActive, H-WoW hack,
               MouseClick, left,  33,  120
               return
                  ; Walk On Water
                  !X::
                  MouseClick, left,  33,  137
                  IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,
                  WinWaitActive, H-WoW hack,
                  return
                     ; Wall Climb
                     !F::
                     MouseClick, left,  141,  121
                     IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,
                     WinWaitActive, H-WoW hack,
                     return
            ; NoClip
            !C::
            MouseClick, left,  141,  137
            IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,
            WinWaitActive, H-WoW hack,
            return
         ; Reactivate
         !B::
         MouseClick, left,  70,  163
         IfWinNotActive, H-WoW hack, , WinActivate, H-WoW hack,
         WinWaitActive, H-WoW hack,
         WinActivate, H-WoW hack,
         return

Didn't work=/