Jump to content

Recommended Posts

hi everyone

i have a function Verify if select or not select According to what i send 

If $setting = "enabled"  Then
            If ControlCommand($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13", "Check", "") = 0 Then
                Send("{down 1}{ENTER}")
                            Sleep(2000)
            
            ElseIf ControlCommand($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14", "Check", "") = 0 Then
                Send("{ENTER}")
                            Sleep(2000)
                
            ElseIf ControlCommand($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15", "Check", "") = 0 Then
                Send("{up 1}{ENTER}")
                            Sleep(2000)
            EndIf
EndIf
        
        
If $setting = "disable"  Then
    If ControlCommand($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13", "Check", "") = 0 Then
            Send("{down 2}{ENTER}")
    
    ElseIf ControlCommand($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14", "Check", "") = 0 Then
                Send("{down 1}{ENTER}")
    
    ElseIf ControlCommand($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15", "Check", "") = 0 Then
                Send("{ENTER}") 
            Sleep(2000)
    EndIf
EndIf

but if it is Enabled and my setting is disabled. It does not do what is in the condition

 
 
Link to post
Share on other sites

Can you explain the issue in more detail, confused by "if it is Enabled and my setting is disabled".

It sounds like you want to join the two if statements or use Switch for example:

If $setting = "enabled" Then
...
ElseIf $setting = "disabled" Then
...
EndIf

;~ Or

Select
    Case $setting = "enabled"
    ...
    Case $setting = "disabled"
    ...
EndSelect

 

Link to post
Share on other sites
22 minutes ago, Subz said:

Can you explain the issue in more detail, confused by "if it is Enabled and my setting is disabled".

It sounds like you want to join the two if statements or use Switch for example:

If $setting = "enabled" Then
...
ElseIf $setting = "disabled" Then
...
EndIf

;~ Or

Select
    Case $setting = "enabled"
    ...
    Case $setting = "disabled"
    ...
EndSelect

 

if setting = "disable" and ControlCommand see it is Enabled so Send("{down 1}{ENTER}")

Link to post
Share on other sites
  • 2 weeks later...
On 10/12/2022 at 4:53 PM, Subz said:

Add some debugging to your script to for example, to see if the value is being returned correctly, test with it checked and unchecked

MsgBox(0, "", ControlCommand($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14", "Check", ""))

 

I did it but after i do for example down 1 so is aging check the if
and if is Enabled so is instead of ENTER so is do {down 1}{ENTER}
if i have 

If ControlCommand($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13", "Check", "") = 0 Then

so it mean Not Configured is cheak or not

Edited by gal9
Link to post
Share on other sites

i think i know what the problem

thi part:

If $setting = "enabled"  Then
            If ControlCommand($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13", "Check", "") = 0 Then
                Send("{down 1}{ENTER}")
                            Sleep(2000)
            
            ElseIf ControlCommand($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14", "Check", "") = 0 Then
                Send("{ENTER}")
                            Sleep(2000)
                
            ElseIf ControlCommand($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15", "Check", "") = 0 Then
                Send("{up 1}{ENTER}")
                            Sleep(2000)
            EndIf
EndIf
        
        
If $setting = "disable"  Then
    If ControlCommand($mtric, "Not &Configured", "WindowsForms10.BUTTON.app.0.297b065_r64_ad13", "Check", "") = 0 Then
            Send("{down 2}{ENTER}")
    
    ElseIf ControlCommand($mtric, "&Enabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad14", "Check", "") = 0 Then
                Send("{down 1}{ENTER}")
    
    ElseIf ControlCommand($mtric, "&Disabled", "WindowsForms10.BUTTON.app.0.297b065_r64_ad15", "Check", "") = 0 Then
                Send("{ENTER}") 
            Sleep(2000)
    EndIf
EndIf

is on radio buttons how can I do it right?

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...