Control specific operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Control specific operations >

Control specific operations

GCI. - Get-Combo-Item

Previous Top Next


MiniRobotLanguage (MRL)

 

GCI. Command

Get Combo Item

 

Direct Engine_01

 

Intention

 

The GCI.-Command can be used to return the Combo-Box-Items.

 

Here is a Picture of a Combobox with item Nr.4 selected.

 

graphic

 

It is important, that you first locate a Combobox. To do this, You can use SCW. as well as SAO..

 

In our Test-Application this would look like:

 

STW.ct|PBWindowClass:0|TestApp

SCW.nc|3|ComboBox

 

Once this is done, the computer knows which Combobox you want to analyze. So we can start using GCI. The simplest way of operation is, if you just write:

 

GCI.

 

In this case you will find the actual selected Combo-Item (see below) on the TOS:

 

graphic

 

The TOS contains the 1-based Index number of the actual selected item. Below the TOS is the text of the selected Combo-Item.

 

The GCI.-command has multiple Modes of operation. To switch between them, the command knows a number of prototypes, see below.

 

Lets start with the c - prototype. c like count. Using this prototype you can simply find out how many items the Combobox has.

 

There are two modes of operation using this prototype:

 

 

'This will just place the number of Combo-Items on the TOS.

GCI.c

 

graphic

 

 

' This will store the result in the given variable instead on TOS.

GCI.c|$$NUM

 

As you can see the only difference is, that the result is once on the Stack, and once in a given variable. This will be the same with most of the following operation modes.

 

Using the s - like selected prototype, you can find out which Combo-Item is currently selected. As the returned index is 1 - based, a return value of zero means that currently there is no Item selected. The modes of operation for the "s"-prototype are:

 

GCI.

GCI.s

GCI.s|$$TXT

GCI.s||$$NUM

GCI.s|$$TXT|$$NUM  

 

The only difference is, which result is been placed on the TOS and which is placed inside variables. $$TXT hereby is the Text of the selected Combo-Item, while $$NUM is the 1-based Index of it.

 

Using the t - like text prototype, you can get the Text of an Combo-Item from an 1-based Item-Index. The details from where the numeric index is taken, and where the result is been place, are straightforward.

 

' Take number from TOS, place result on TOS

GCI.t

 

' Take number from $$NUM, place result on TOS

GCI.t|$$NUM

 

' Take number from $$NUM, place result in $$TXT

GCI.t|$$NUM|$$TXT

 

 

Using the n - like numeric prototype, you can find out the numeric, 1-based Index of an Combo-Item. The string you specify can contain 3.2 Standard-Search Pattern.

 

' Will get the search string from TOS, and place result on TOS

GCI.n

 

' Search string from $$TXT, result on TOS

GCI.n|$$TXT

 

' Search string from $$TXT, choose result number $$NUM

' place result on TOS

GCI.n|$$TXT|$$NUM ' resultat number in $$NUM

 

' Search string from $$TXT, choose result number $$NUM

' place result in variable $$RES

GCI.n|$$TXT|$$NUM|$$RES

 

 

Using the f - like find prototype, you can find a Combo-Item using 3.2 Standard-Search Pattern.

 

 

' Will get the search string from TOS, and place result on TOS

GCI.f

 

' Search string from $$TXT, result on TOS

GCN.f|$$TXT

 

' Search string from $$TXT, choose result number $$NUM

' place result on TOS

GCN.f|$$TXT|$$NUM

 

' Search string from $$TXT, choose result number $$NUM

' place result in variable $$RES

GCN.f|$$TXT|$$NUM|$$RES

 

 

Using the a - like all prototype, you can

 

' Concatenates all Combo-Items using $crlf$ as delimiter.

' Result is been placed on TOS.

GCI.a

 

' Concatenates all Combo-Items using $$DEM as delimiter.

' Result is been placed on TOS.

GCI.a|$$DEM

 

' Concatenates all Combo-Items using $$DEM as delimiter.

' Result is been placed in $$RES

GCI.a|$$SDEM|$$RES

 

If the delimiter expression is a null (zero-length) string, no separators are inserted between the string sections.

 

If the delimiter expression is the following 3-byte value of "," a leading and trailing double-quote is added to each string section.

 

 

 

Syntax

 

GCI.[P1][|P2][|P3]

 

 

Parameter Explanation

 

The details of the parameter depend on the used prototype.

 

P1 - (optional) prototype, selects the kind of operation, if omitted "s" is used. The following prototypes are supported:

 

c - count Combo-items

s - selected Combo-Item (get selected)

t - text of Combo Item

n - numeric, get 1-based Index of Combo-Item

f - find, find a Combo-Item based on a Text using Patterns

a - all, fill a variable with all Combo-Items, possibly with a

   delimiter of your choice.

 

 

 

P2 - (optional) VAR to store results, STRING or number.

P3 - (optional) VAR to store results.

P4 - (optional) VAR to store results.

 

 

 

 

Example

 

'*************************************************

' GCI- Sample #1

' Get actual selected Item

'*************************************************

'

' This first line will just test if the TestApp is already

' running and must not be started.

STW.Xwtg|0|TestApp|over

' We start the TestApp

EXE.?exepath\Sample Apps\TestApp_01.exe

' We can locate it directly with the PID

STW.p|#pid#

:over

' Select Combo-Box

SCW.i|1027

' Will return the actual selected Item on TOS

GCI.

' Lets see the TOS

STS.DUMP

MBX.Ready

ENR.

 

 

'*************************************************

' GCI- Sample #2

' Get all Combo-Items in a List

'*************************************************

'

' This first line will just test if the TestApp is already

' running and must not be started.

STW.Xwtg|0|TestApp|over

' We start the TestApp

EXE.?exepath\Sample Apps\TestApp_01.exe

' We can locate it directly with the PID

STW.p|#pid#

:over

' Locate the Combobox by ID

SCW.i|1027

' Get all Combo-Item delimited by newlines

GCI.a

STS.DUMP

MBX.Ready $$TXT

ENR.

 

'*************************************************

' GCI- Sample #3

' Get all Combo-Items in a delimited List

'*************************************************

'

' This first line will just test if the TestApp is already

' running and must not be started.

STW.Xwtg|0|TestApp|over

' We start the TestApp

EXE.?exepath\Sample Apps\TestApp_01.exe

' We can locate it directly with the PID

STW.p|#pid#

:over

' Locate the Combobox by ID

SCW.i|1027

' Get all Combo-Item delimited by newlines

GCI.a|"."|$$TXT

' Complete the result with leading and trailing "

VAR.$$FIN="$$TXT"

MBX.$$FIN

ENR.

 

 

'*************************************************

' GCI- Sample #4

' Get Combo-Item No.12

'*************************************************

'

' This first line will just test if the TestApp is already

' running and must not be started.

STW.Xwtg|0|TestApp|over

' We start the TestApp

EXE.?exepath\Sample Apps\TestApp_01.exe

' We can locate it directly with the PID

STW.p|#pid#

:over

' Locate the Combobox by ID

SCW.i|1027

' Get Combo-Item No.12

GCI.t|12|$$TXT

MBX.$$TXT

ENR.

 

 

'*************************************************

' GCI- Sample #5

' Ermittelt 1 - basierten Index des aktuell

' selektierten Elementes

'*************************************************

'

' This first line will just test if the TestApp is already

' running and must not be started.

STW.Xwtg|0|TestApp|over

' We start the TestApp

EXE.?exepath\Sample Apps\TestApp_01.exe

' We can locate it directly with the PID

STW.p|#pid#

:over

' Locate the Combobox by ID

SCW.i|1027

' Get Combo-Item No.12

GCI.s||$$TXT

MBX.$$TXT

ENR.

 

 

 

Remarks

 

-

 

 

Limitations:

 

 

There may be non-Standard Comboboxes out there, where this command may not work as expected. If that happens, its not a bug, its just that the developer of that Application made his Combobox too far away from Common-Control-Standards. Please note that this command does generally not support Comboboxes in Browser- or Java-Applications.

 

Also this command may currently not work with all x64 applications.

 

 

 

See also:

 

    1.9. Locating Child-Windows

    3.2 Standard-Search Pattern

    SCI. - Set-Combo-Item

    CDD. - Combo Drop Down

    SKP. Send-Key-Press

    SDT. - SenD-window-Text

    RST. - Replace Selected Text

    SKT. - Send-Key-Text