Form model autoit binding

Form model autoit binding is a form model binding implementation for AutoIt

License

License

Categories

Categories

Auto Application Layer Libs Code Generators ORM Data
GroupId

GroupId

ru.d-shap
ArtifactId

ArtifactId

form-model-binding-autoit
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Form model autoit binding
Form model autoit binding is a form model binding implementation for AutoIt
Project URL

Project URL

https://github.com/d-shap/form-model-binding-autoit
Source Code Management

Source Code Management

https://github.com/d-shap/form-model-binding-autoit

Download form-model-binding-autoit

How to add to project

<!-- https://jarcasting.com/artifacts/ru.d-shap/form-model-binding-autoit/ -->
<dependency>
    <groupId>ru.d-shap</groupId>
    <artifactId>form-model-binding-autoit</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/ru.d-shap/form-model-binding-autoit/
implementation 'ru.d-shap:form-model-binding-autoit:1.0.0'
// https://jarcasting.com/artifacts/ru.d-shap/form-model-binding-autoit/
implementation ("ru.d-shap:form-model-binding-autoit:1.0.0")
'ru.d-shap:form-model-binding-autoit:jar:1.0.0'
<dependency org="ru.d-shap" name="form-model-binding-autoit" rev="1.0.0">
  <artifact name="form-model-binding-autoit" type="jar" />
</dependency>
@Grapes(
@Grab(group='ru.d-shap', module='form-model-binding-autoit', version='1.0.0')
)
libraryDependencies += "ru.d-shap" % "form-model-binding-autoit" % "1.0.0"
[ru.d-shap/form-model-binding-autoit "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
ru.d-shap : form-model jar 1.0
de.openkeyword : autoit jar 0.1.20

Project Modules

There are no modules declared in this project.

Form model AutoIt binding

Form model AutoIt binding is a form model binding implementation for AutoIt.

Form model AutoIt binding is a wrapper for the AutoIt scripts. It provides facilities to describe the application's GUI, to bind this description with the application and to automate the application through the binded description.

The benefit is in enhancing script maintenance and reducing code duplication. So if the GUI changes, the script themselves don’t need to change, only the GUI definition needs to change. Subsequently all changes to support that new GUI are located in one place.

The application's GUI is described in the form definition XML. Then this form definition is binded with the application's GUI and the result of this binding is a binded form. Binded elements can be obtained by the application from this binded form. Script uses this binded elements to automate the application.

For example, suppose the Windows Calculator application.

The model for this application is the following (for Windows 7):

<?xml version="1.0"?>
<ns1:form id="calc" xmlns:ns1="http://d-shap.ru/schema/form-model/1.0">
    <ns1:element id="button0" lookup="130"/>
    <ns1:element id="button1" lookup="131"/>
    <ns1:element id="button2" lookup="132"/>
    <ns1:element id="button3" lookup="133"/>
    <ns1:element id="button4" lookup="134"/>
    <ns1:element id="button5" lookup="135"/>
    <ns1:element id="button6" lookup="136"/>
    <ns1:element id="button7" lookup="137"/>
    <ns1:element id="button8" lookup="138"/>
    <ns1:element id="button9" lookup="139"/>
    <ns1:element id="buttonPlus" lookup="93"/>
    <ns1:element id="buttonMinus" lookup="94"/>
    <ns1:element id="buttonMult" lookup="92"/>
    <ns1:element id="buttonDiv" lookup="91"/>
    <ns1:element id="buttonEquals" lookup="121"/>
    <ns1:element id="textResult" lookup="150"/>
</ns1:form>

The following code implements the binding and the application automation:

// Load form definitions
FormDefinitions formDefinitions = new FormDefinitions();
File file = new File("file with the form definition");
FormDefinitionsLoader formDefinitionsLoader = new FormXmlDefinitionsFileLoader(file);
formDefinitionsLoader.load(formDefinitions);
AutoItFormBinder formBinder = new AutoItFormBinder(formDefinitions);

// Create AutoIt object and run the application
System.setProperty(LibraryLoader.JACOB_DLL_PATH, "/path/to/jacob/dll");
AutoItX autoItX = new AutoItX();
autoItX.run("calc.exe");

// Bind the application
Document document = formBinder.bind(autoItX, "Calculator", "calc");

// Automate the application
formBinder.getBindedElementWithId(document, "button3").click();
formBinder.getBindedElementWithId(document, "buttonMinus").click();
formBinder.getBindedElementWithId(document, "button6").click();
formBinder.getBindedElementWithId(document, "buttonEquals").click();
System.out.println(formBinder.getBindedElementWithId(document, "textResult").getText());

// Close the application
autoItX.winClose("Calculator");

XML definition

Namespace: http://d-shap.ru/schema/form-model/1.0

form

The top-level element. Defines the form.

Attributes:

  • group - the form's group, optional
  • id - the form's ID, mandatory

Attributes group and id identify the form and should be unique.

Child elements:

  • element
  • single-element
  • form-reference

element

Element is a form part, that make sence for the application.

Attributes:

  • id - the element's ID, optional
  • lookup - the element's lookup string, used by the binding extension, mandatory
  • type - the element's type, optional

Valid values for the type attribute depend on the parent element. Possible values are:

  • required - there should be exactly one element.
  • required+ - there should be at least one element.
  • optional - there could be one element or no element at all.
  • optional+ - there could be more then one element or no element at all.
  • prohibited - there should not be any element.

Child elements:

  • attribute
  • element
  • single-element
  • form-reference

attribute

The element's attribute.

Attributes:

  • id - the attribute's ID, optional
  • lookup - the attribute's lookup string, used by the binding extension, mandatory
  • type - the attribute's type, optional

Valid values for the type attribute depend on the parent element. Possible values are:

  • required - there should be exactly one element.
  • optional - there could be one element or no element at all.
  • prohibited - there should not be any element.

single-element

Single element is a container for other elements. Only one child element should present (but child element could be optional+).

Attributes:

  • id - the single element's ID, optional
  • type - the single element's type, optional

Valid values for the type attribute depend on the parent element. Possible values are:

  • required - there should be exactly one element.
  • optional - there could be one element or no element at all.
  • prohibited - there should not be any element.

Child elements:

  • element
  • single-element

form-reference

The reference to another form definition. The elements of the referenced form are included in the current form as child elements of the form-reference element.

Attributes:

  • group - the form's group, optional
  • id - the form's ID, mandatory

HOW TO

HOW TO examples

Latest release

Form model library:

  • <groupId>: ru.d-shap
  • <artifactId>: form-model
  • <version>: 1.0

Form model AutoIt binding:

  • <groupId>: ru.d-shap
  • <artifactId>: form-model-binding-autoit
  • <version>: 1.0.0

Donation

If you find my code useful, you can bye me a coffee

Versions

Version
1.0.0