Jump to content

Recommended Posts

Posted (edited)

Hi i am new to Autoit.  i wrote the below code and tried executing it.  Script moves to first switch case as expected and the If condition is satisfied. Hence the return value for $test is set as "EditPosAccountManagementCenter 'Accept Cash' is not set"
    but still the code continues to execute inside the case and the $parameterFieldValue "99998" is set  in the text box in application. Can anyone help why this happens?

Func EditPosAccountManagementCenter($parameterFieldName, $parameterFieldValue, $parameterFieldValueTwo)

    $Result = 1

    Switch $parameterFieldName

        Case "Disable Bill collector when bills collected reaches"

            If ControlGetHandle("BBTSMain", "Accept Cash", "[CLASS:TCheckBox; INSTANCE:2]") <> 1 Then
                Return "EditPosAccountManagementCenter 'Accept Cash' is not set"
            EndIf

            Sleep($SleepSmall)
            ControlClick("BBTSMain", "", "[CLASS:TbbDBEdit; INSTANCE:1]")
            Sleep($SleepSmall)
            Send("^a")
            Sleep($SleepSmall)
            Send($parameterFieldValue)

        Case "Account Management Center Configuration"
            If $parameterFieldValue = "Default" Or $parameterFieldValue == "Default" Then
                ControlClick("BBTSMain", "Use default settings", "[CLASS:TRadioButton; INSTANCE:4]")
            Else
                If $parameterFieldValue = "Custom" Or $parameterFieldValue == "Custom" Then
                    ControlClick("BBTSMain", "Use custom settings", "[CLASS:TRadioButton; INSTANCE:3]")
                Else
                    $Result = "EditPosAccountManagementCenter Unknown option of Account Management Center Configuratin "
                EndIf
            EndIf


        Case Else
            Return  "-EditPosAccountManagementCenter Field for changing not found"
    EndSwitch
    Return $Result

EndFunc   ;==>EditPosAccountManagementCenter


 $test = EditPosAccountManagementCenter("Disable Bill collector when bills collected reaches",99998,"")

ConsoleWrite($test)

 

Edited by Press
Posted

Hi i am new to Autoit.  i wrote the below code and tried executing it.  Script moves to first switch case as expected and the If condition is satisfied. Hence the return value for $test is set as "EditPosAccountManagementCenter 'Accept Cash' is not set"
    but still the code continues to execute inside the case and the $parameterFieldValue "99998" is set  in the text box in application. Can anyone help why this happens?

Func EditPosAccountManagementCenter($parameterFieldName, $parameterFieldValue, $parameterFieldValueTwo)

    $Result = 1

    Switch $parameterFieldName

        Case "Disable Bill collector when bills collected reaches"

            If ControlGetHandle("BBTSMain", "Accept Cash", "[CLASS:TCheckBox; INSTANCE:2]") <> 1 Then
                Return "EditPosAccountManagementCenter 'Accept Cash' is not set"
            EndIf

            Sleep($SleepSmall)
            ControlClick("BBTSMain", "", "[CLASS:TbbDBEdit; INSTANCE:1]")
            Sleep($SleepSmall)
            Send("^a")
            Sleep($SleepSmall)
            Send($parameterFieldValue)

        Case "Account Management Center Configuration"
            If $parameterFieldValue = "Default" Or $parameterFieldValue == "Default" Then
                ControlClick("BBTSMain", "Use default settings", "[CLASS:TRadioButton; INSTANCE:4]")
            Else
                If $parameterFieldValue = "Custom" Or $parameterFieldValue == "Custom" Then
                    ControlClick("BBTSMain", "Use custom settings", "[CLASS:TRadioButton; INSTANCE:3]")
                Else
                    $Result = "EditPosAccountManagementCenter Unknown option of Account Management Center Configuratin "
                EndIf
            EndIf


        Case Else
            Return  "-EditPosAccountManagementCenter Field for changing not found"
    EndSwitch
    Return $Result

EndFunc   ;==>EditPosAccountManagementCenter


 $test = EditPosAccountManagementCenter("Disable Bill collector when bills collected reaches",99998,"")

ConsoleWrite($test)

 

Posted

This is reposted in AutoIT General Help & Support Forum. This post can be deleted. Apologize for the inconvenience.

Posted

ControlGetHandle() returns a handle, not the content of a control.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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