Skip to content

Commit bff855e

Browse files
committed
add support for the TEXT descriptor
1 parent 1058fcf commit bff855e

File tree

7 files changed

+47
-28
lines changed

7 files changed

+47
-28
lines changed

__tests__/index_test.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@ open Jest
22
open Expect
33
open Index
44

5-
let d ?title ?className ?regexpTitle ?regexpClassName ?last ?active ?x ?y ?w ?h
6-
?instance () =
5+
let d ?title ?className ?regexpTitle ?regexpClassName ?text ?last ?active ?x ?y
6+
?w ?h ?instance () =
77
let title = title |. Js.Nullable.fromOption in
88
let className = className |. Js.Nullable.fromOption in
99
let regexpTitle = regexpTitle |. Js.Nullable.fromOption in
1010
let regexpClassName = regexpClassName |. Js.Nullable.fromOption in
11+
let text = text |. Js.Nullable.fromOption in
1112
let last = last |. Js.Nullable.fromOption in
1213
let active = active |. Js.Nullable.fromOption in
1314
let x = x |. Js.Nullable.fromOption in
1415
let y = y |. Js.Nullable.fromOption in
1516
let w = w |. Js.Nullable.fromOption in
1617
let h = h |. Js.Nullable.fromOption in
1718
let instance = instance |. Js.Nullable.fromOption in
18-
descriptorTagged ~title ~className ~regexpTitle ~regexpClassName ~last
19+
descriptorTagged ~title ~className ~regexpTitle ~regexpClassName ~text ~last
1920
~active ~x ~y ~w ~h ~instance
2021

2122
let cases =
@@ -35,7 +36,8 @@ let cases =
3536
; ( "[TITLE:toto; CLASS:ta;;ta]"
3637
, fun () -> d ~title:"toto" ~className:"ta;ta" () )
3738
; ( "[TITLE:to;;to; CLASS:ta;;ta]"
38-
, fun () -> d ~title:"to;to" ~className:"ta;ta" () ) ]
39+
, fun () -> d ~title:"to;to" ~className:"ta;ta" () )
40+
; ("[TEXT:text text text]", fun () -> d ~text:"text text text" ()) ]
3941

4042
let makeTest (expected, case) =
4143
test expected (fun () -> expect (case ()) |> toEqual expected)

lib/js/__tests__/index_test.js

Lines changed: 26 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/src/index.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "autoit-advanced-descriptor",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "Generate AutoIT advanced window descriptions according to https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm",
55
"main": "lib/js/src/index.js",
66
"types": "src/index.d.ts",

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface WindowDescription {
33
readonly className?: string
44
readonly regexpTitle?: string
55
readonly regexpClassName?: string
6+
readonly text?: string
67
readonly instance?: number
78
readonly active?: boolean
89
readonly last?: boolean

src/index.ml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ type windowDescription =
33
; className: string Js.Nullable.t
44
; regexpTitle: string Js.Nullable.t
55
; regexpClassName: string Js.Nullable.t
6+
; text: string Js.Nullable.t
67
; last: bool Js.Nullable.t
78
; active: bool Js.Nullable.t
89
; x: int Js.Nullable.t
@@ -38,13 +39,14 @@ let addBooleanDescriptor acc key value =
3839
| Some false | None ->
3940
()
4041

41-
let descriptorTagged ~title ~className ~regexpTitle ~regexpClassName ~last
42-
~active ~x ~y ~w ~h ~instance =
42+
let descriptorTagged ~title ~className ~regexpTitle ~regexpClassName ~text
43+
~last ~active ~x ~y ~w ~h ~instance =
4344
let descriptors = [||] in
4445
addStringDescriptor descriptors "TITLE" title ;
4546
addStringDescriptor descriptors "CLASS" className ;
4647
addStringDescriptor descriptors "REGEXPTITLE" regexpTitle ;
4748
addStringDescriptor descriptors "REGEXPCLASS" regexpClassName ;
49+
addStringDescriptor descriptors "TEXT" text ;
4850
addIntegerDescriptor descriptors "INSTANCE" instance ;
4951
addBooleanDescriptor descriptors "ACTIVE" active ;
5052
addBooleanDescriptor descriptors "LAST" last ;
@@ -60,12 +62,13 @@ let descriptor windowDescription =
6062
let className = windowDescription |. classNameGet in
6163
let regexpTitle = windowDescription |. regexpTitleGet in
6264
let regexpClassName = windowDescription |. regexpClassNameGet in
65+
let text = windowDescription |. textGet in
6366
let instance = windowDescription |. instanceGet in
6467
let active = windowDescription |. activeGet in
6568
let last = windowDescription |. lastGet in
6669
let x = windowDescription |. xGet in
6770
let y = windowDescription |. yGet in
6871
let w = windowDescription |. wGet in
6972
let h = windowDescription |. hGet in
70-
descriptorTagged ~title ~className ~regexpTitle ~regexpClassName ~instance
71-
~active ~last ~x ~y ~w ~h
73+
descriptorTagged ~title ~className ~regexpTitle ~regexpClassName ~text
74+
~instance ~active ~last ~x ~y ~w ~h

src/index.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ type windowDescription =
33
; className: string Js.Nullable.t
44
; regexpTitle: string Js.Nullable.t
55
; regexpClassName: string Js.Nullable.t
6+
; text: string Js.Nullable.t
67
; last: bool Js.Nullable.t
78
; active: bool Js.Nullable.t
89
; x: int Js.Nullable.t
@@ -17,6 +18,7 @@ val descriptorTagged :
1718
-> className:string Js.Nullable.t
1819
-> regexpTitle:string Js.Nullable.t
1920
-> regexpClassName:string Js.Nullable.t
21+
-> text:string Js.Nullable.t
2022
-> last:bool Js.Nullable.t
2123
-> active:bool Js.Nullable.t
2224
-> x:int Js.Nullable.t

0 commit comments

Comments
 (0)