Passing argument from functional to eggplant DAI global/action variables


How to pass the variable containing list from eggplant functional script to eggplant DAI global/action variable?

the main intension is to control the global/action variables from the functional

eg: I’m reading the text from the search rectangle and it is stored in “Var”

put readText([423,176,505,228],EnableAggressiveTextExtraction:Yes,ignoreUnderscores:OFF) into Var
repeat with each word of item 1 of Var
insert it into Var2
end repeat
log Var2

Now Var2 contains the list [Car1,Car2,Car3]

how to pass Var2 to Global/Action variable in eggplant DAI ?

We had the same challenge before, and we ended up marshalling the argument data into a JSON string. So we convert the list to a string using JSONFormat(list) and return it to DAI as a text. DAI then pass the text to other snippet which will convert it back to a list using JSONValue(argument). This worked fine for small data. But when we tried to use this method for a very large object (about 30+ KB in string) then DAI agent started to hang.

To get a variable back from EPF to DAI you set it as an Output on the Snippets Called By Action tab (double-click to open Snippet Properties I/O Edit). Make sure to output them in the order expected, they won’t automatically match up names. Drag and drop rows in that Snippet Properties dialogue.

If you have a huge list of variables I would consider changing your methodology. Only pass the variables needed to make logic decisions within DAI and leave the rest of your content in a resource file (CSV, XLSX, whatever). Or perhaps you can have a script who’s only job is to make those decisions for DAI and return the barest essentials.
Hard to guess without knowing a lot more about what you are up to.
Your conversion to a list syntax sounds a bit more complicated than it needs to be, but I can’t say for sure without seeing an example. Have you considered the split function?

put readtext([228,310,1233,354]) into ReadVar
delete all <punctuation> from  ReadVar
split ReadVar by " "
put ReadVar

I also try to avoid OCR if possible. Have you considered getting the text into the remoteclipboard somehow? Make a triple_click_handler or even a drag and drop? Or a typetext controlkey, “ac”? I find I can usually triple-click any body of text I need, but of course it depends on your situation.

Good luck.