As I said , I want to randomize the value ${TITLE}
{
“Command”: “executeScript_Sandbox”,
“Target”: “var letters = [‘Your preferred color is {!COL1}’,’ Your car is {!COL1}’,’ The water is {!COL1}’,’ Your car is {!COL1}’]; var string = ‘’; for(var i = 0; i < 1; i++){string += letters[parseInt(Math.random() * 4)]}; return string;”,
“Value”: “TITLE”
},
It returns: Your preferred color is “red”
or : Your car is “red”
and it should return the string without double quotes “” like this : Your preferred color is red
Cannot do it your way, my CSV has 40 rows already . I worked 10 years with imacros and it can be done my way , getting part of the string from a CSV file . I spent 1 week on this code and cannot make it work in ui vision .
Working code on imacros :
SET !VAR7 EVAL(“var letters = [‘Appartamentoinpienocentro’,‘Appartamentobilocale’,‘Appartamentoristrutturato’,’]; var string = ‘’; for(var i = 0; i < 1; i++){string += letters[parseInt(Math.random() * 3)]}; string”)
SET TITLE1 {{!VAR7}}in{{!COL2}}
SET TITLE2 {{!VAR7}}a{{!COL3}}
SET TITLE3 {{!COL3}}{{!COL2}}
SET TITLE4 {{!COL2}}{{!COL3}}
SET TITLE5 {{!VAR7}}
SET !VAR1 EVAL(“var letters = [’{{TITLE1}}’,’{{TITLE2}}’,’{{TITLE3}}’,’{{TITLE4}}’,’{{TITLE5}}’]; var string = ‘’; for(var i = 0; i < 1; i++){string += letters[parseInt(Math.random() * 5)]}; string”)
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form_register ATTR=ID:titolo CONTENT={{!VAR1}}
There are more ways to do your work but the very easy is this
I use imacros from 10 years, and ui vision from 1 year and I can confirm that ui vision RPA can do all automations of imacros and more other automations, sometimes i automate addons and browser internal menu (impossible to do with imacros).
Log
[status]
Playing macro Replace
[info]
Executing: | store | Your car is “red” | MyValue |
Well this is why I started using ui vision lately, there is a bigger potential here , as long as my scripts work . So , now as for your macro … I tried several times adding it even TAB VIEW and also copy paste directly to JSON source view and it gives me errors on the javascript line .
This is not the first time I’m seeing this error while using javascript . I tried removing the double quotes before with different java scripts … What am I doing wrong ?
You are constantly saying to the people “You are doing it wrong”, “Your way of doing things is bad”, “My way is better” and I think that’s harassment, my friend. You are not trying to help, you are just trying to prove yourself better in an arrogant way, disencouraging new people.
I think you have to make allowance for language differences. I believe newuserkantu is not a native English speaker? However he is very knowledgeable and helpful and means well.
I’m not english and i use translator (bing or google) to read and write.
It may happen that the words I write are not the best because I use the translator to write and often the translator does not translate the sentences well.
It can happen that the translator chooses a term that is not suitable for discussion or also makes mistakes.
If I was offensive I apologize to all of you was not in my intentions but I read and write using the translator and not always the translator chooses the best words.
For this reason I always ask for details to understand well the problem to be solved and I need the simplest possible explanations to understand the problem and then think about the solution.
Sometimes it can happen that with the translator I do not understand well what you write and therefore I can not solve a problem if I do not understand well the meaning and the translator does not always help me in this.
Technical update: It works this way as it works because the more likely use case is ${!COL1}.length > 0 , so for executeScript, we replace ${VAR} with Json.stringify(VALUE_OF_VAR) .
One easy workaround is to rewrite
var letters = 'Your car is ${!COL1}'; returns letters
with
var letters = 'Your car is ' + ${!COL1}; return letters;
Notice that in the new version ${!COL1} is now outside the “”.
I do not think you will be able to find a reason for malfunction so simply. It can be discovered only in a way of applying different solutions and see if they work. I am from Spain, Check This Out. Your project seems interesting to me and I would like to try to fix it. But I will need full access to it to experiment. Please contact me if you are interested in cooperation.