Jump to content


Photo

block altering a control state


  • Please log in to reply
6 replies to this topic

#1 azure

azure
  • Members
  • 1203 posts

Posted 30 April 2012 - 09:43 AM

hello!

there is a control (specifically a drop down menu), that not sure how, it changes state (entry) during human interaction with the GUI accidentally
is there a way to 100% block changing of a specific control?

EDIT to add additional details:
- that drop down menu control is part of a third-party app, that unfortunately it is not available for download, but you can get the idea from Windows Explorer address bar that acts like drop down menu
- as for human interaction with that third-party app, I mean that as a user uses that app, he may accidentaly focus that drop down menu control and by hitting any key to alter its value/entry (just an example)

thanks!

#2 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 30 April 2012 - 06:31 PM

you might be able to set a style on the control in question. You might be able to force it to be locked. Try Control, Disable.

#3 azure

azure
  • Members
  • 1203 posts

Posted 02 May 2012 - 07:39 AM

Control, Disable works very well! thanks!
however, how can I make it disable the control everytime the control exists? regardless if the window is active or not, and ensuring that there will be no time delay between the control starting to exist and the script disabling the control, which may leave possibilities of letting the control be unlocked?

for example, when there is a delay to render the control (make it appear) and the script wont trigger immediately due to memory slowness

you might be able to set a style on the control in question

you might be able to force it to be locked

how can I do these, in case they work better than Control, Disable?

#4 azure

azure
  • Members
  • 1203 posts

Posted 02 May 2012 - 11:00 AM

I run a script:

#IfWinActive ahk_class someclass
Control, Check, , someradiobutton, ahk_class someclass
#IfWinActive


but it doesnt automatically check the radio button each time that window appears :/

#5 CodeKiller

CodeKiller
  • Members
  • 2066 posts

Posted 02 May 2012 - 12:03 PM

Just use a timer...

SetTimer AutoCheck, 10

AutoCheck:
IfWinActive ahk_class someclass ; You can replace it with IfWinExist
    Control Check, , someradiobutton, ahk_class someclass
Return


#6 azure

azure
  • Members
  • 1203 posts

Posted 02 May 2012 - 05:38 PM

is it just me that I dont feel 100% accurate and secure with such timers? I mean what if, I say if, the window is inaccessible that 10ms and no radiobutton gets checked?

#7 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 02 May 2012 - 06:05 PM

the chances of your user hitting it in that 10ms is pretty small.