Jump to content


Photo

Check whether a button is disabled/"greyed out"


  • Please log in to reply
3 replies to this topic

#1 halllon

halllon
  • Members
  • 16 posts

Posted 30 January 2008 - 09:50 AM

Dear all,

I am trying to create a script that checks whether a button is disabled ("greyed out"). I want it to do nothing if it's disabled and click it if it is not disabled.

This is the code as it is now:

SetTimer, CheckPrompt, 100

SjekkDRMPrompt:
	IfWinExist, Hente lisens
{
	ControlFocus, Play, ahk_class #32770
	Send, {Enter}
}
return

I want to only run the Controlfocus and Send commands if the button ("Play") is not disabled.

How do I get around this?

All help appreciated!

#2 halllon

halllon
  • Members
  • 16 posts

Posted 30 January 2008 - 09:59 AM

Is it possible to use "GuiControlGet" for this?

The button is in a Windows-prompt, and not made up of AHK Gui functions.

#3 Guests

  • Guests

Posted 30 January 2008 - 11:57 AM

Is it possible to use "GuiControlGet" for this?

The button is in a Windows-prompt, and not made up of AHK Gui functions.

Almost right.
Try "ControlGet".

#4 Sajith

Sajith
  • Guests

Posted 30 January 2008 - 02:12 PM

The following should work. Just replace ClassNN and Windowtitle with the appropriate values.

GUIControlGet, OutVar, Enabled, ClassNN
if (OutVar = 1)
GUIControlClick, Button1, Windowtitle