Script (simplified entry):
OK="/STORAGE/OK";
P1="/STORAGE/AAA";
P2="/STORAGE/BBB";
P3="/STORAGE/CCC";
...
i=1;
How to save a loop for copying directories?
[Loop Start - Copy file]
Source: P{i} //I do not know how to make this record to have "/STORAGE/AAA"
Target: {OK}
[Script]
i=i+1
[goto loop start]
Tnx
Loop
Moderator: Martin
Re: Loop
You can create dynamic variable using eval(). If you loop against i, and the variable name are in the loop, you can use something like
But for your case, this is not the optimized method. You should use list instead, it is much easier to iterate over each element.
files now contains 4 elements, which you can loop later. If you need the loop only inside a script, example to change STORAGE become EXTERNAL, this is the loop script. (just example)
If you want to "loop copy", there is no need to do so. You can simply use action Copy Files (with s), and use the files directly in listformat comma delimited. At the source, put
Source : {files,listformat,comma}
Target : /Targetpath/folder
Code: Select all
aaa = eval("P{i}"); // eval("P1") >> then "/STORAGE/AAA"
Code: Select all
files = newList(
"/STORAGE/OK",
"/STORAGE/AAA",
"/STORAGE/BBB",
"/STORAGE/CCC" );
Code: Select all
for(i in [0 to length(files)-1])
files[i] = replace(files[i], "STORAGE", "EXTERNAL");
Source : {files,listformat,comma}
Target : /Targetpath/folder
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.