Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

how to access list from within vbscript in WinAutomation?

Hello,


How to access list from within vbscript in WinAutomation?


Let's assume that in %myFiles% variable I have a list of files - output of the "Get Files in Folder" action.


When I want to access the %myFiles% variable (e.g. myVar = %myFiles[0].Name%) I receive "End of statement expected" error.


I will appreciate any help.



Best Answer

Hello,


Since %myFiles[0].Name% is text, try changing the VBScript command to the following:

myVar = "%myFiles[0].Name%"

(encase the WinAutomation variable in quotes)


ADMIN
Answer

Hello,


Since %myFiles[0].Name% is text, try changing the VBScript command to the following:

myVar = "%myFiles[0].Name%"

(encase the WinAutomation variable in quotes)

It works.

Thank you George for you help.

Hello, please is there a way how to iterate through "%myFiles[x].Name%" ?

In VBScript it accepts only outside variable %...% but this one I cannot change (increase) within the script. And the variable created within the script, e.g. x, is not accepted within the string "%myFiles[x].Name%".

Thank you for ideas.

Jiri

Jiri, This is not possibile as vbscript is not directly accessing the winautomation variable. Before the vbscript executes the value of the'winautomation variable is subsutued as a literal value in the vbscript and then the vbscript is executed. So, vbscript is actually not accessing the winautomation variable. What you could do is either write all the filenames to a text file in winautomation and then code vbscript to read that text file or maybe you could do all the file processing in vbscript instead with vbscript FSO object.

Thank you, Joseph.

Originally I tried in the VBSrcipt to work with a %List% build as result of Retrieve DataTable Column, but was not able to use functions as IsArray(%List%), or TypeName(%List%), or use internal VBScript variable in the string %%. So it is explained, it is replaced with the value, not with the object. Thanks. Jiri

Login or Signup to post a comment