Interacting with Rows and Columns in a Data File
Data sets contained in spreadsheets can be exported as comma-separated values (.csv) files. These files can then be interacted with directly on the local file system using SenseTalk scripting in Eggplant Functional (EPF).
Obtaining a Cell Value by Header and Row Names
The following example demonstrates how you can set up SenseTalk scripts to interact and process a data file located in a suites Resources pane, which is located on the local file system.
For this example, the DemoLanguage.txt
file, located in the Resources pane, contains the following data:
RefWord,English,German,French,Japanese,ChinesePRC,ArabicHello,Hello,Hallo,Bonjour,こんにちは,你好,مرحبا,Testing,Testing,Testen,essai,検査,测试,تجريب,Goodbye,Goodbye,Auf Wiedersehen,Au Revoir,さようなら,再见,وداعا,
Notice that the DemoLanguage.txt
file contains several language versions of only three words: hello
, goodbye
, and testing
. This example uses the "English"
language and the "hello"
word. For the OCR search to work, you must have the "hello"
word located somewhere on your SUT screen.
After getting this example working, you can experiment with the other languages and words contained in the DemoLanguage.txt
file.
The Primary
script passes a header name, "English"
, and a row name, "hello"
, into the TextLoc
function. This function processes the DemoLanguage.txt
data file, locating the column for the header ("English"
) and the row for the passed word ("hello"
). The script then uses returns the cell value for that header and row name.
Here is the Primary script:
set global MyLanguage to "English"
doubleclick textLoc ("hello")
Here is the TextLoc
script.
params MyWord
put ResourcePath("DemoLanguage.txt") into FilePath
repeat with each item MyItem of firstline
if MyItem = global MyLanguage
put repeatindex() into MyColumn
end if
end repeat
repeat with each line of file FilePath
if item 1 of it = MyWord
put repeatindex() into MyRow
end if
end repeat
log "Trying to find" && item MyColumn of line MyRow of file FilePath
return ImageLocation (Text:item MyColumn of line MyRow of file FilePath, Language:global MyLanguage)