Not sure I understand your problem with paths, could you elaborate, plz?
Regarding strings and types - this is the only way I can find out the property type, i.e. I can't convert string to int myself, since it might've been intended to be a string by user, but just happened to contain numbers inside.
Let's say I create a property.
window.GetProperty(blabla, 'C:\path\gbqaws');
For sure, that path it's wrong if you use it as is within js. You know it, I know it. Ok. But what about users?
window.GetProperty(blabla, 'PUT HERE YOUR PATH');
Then the user just copy/paste paths from explorer and...
99.99% programs within windows give you paths with single "\" when copying them.
Maybe that's easily solved with other method (I'm totally novice on js) but as far as I know the only way to manage that usage is using String.raw'whatever' . But that workaround does nothing in this case since the getProperty value has been already converted to string where escapes have been processed. So...
window.GetProperty(blabla, 'PUT HERE YOUR PATH').replace('\','\\'); for sure doesn't work.
neither
String.raw'${window.GetProperty(blabla, 'PUT HERE YOUR PATH')}'.replace('\','\\');
nor
String.raw'${window.GetProperty(blabla, String.raw'C:\path\gbqaws')}'.replace('\','\\');
As far as I tested, you are forced to put double \ on the panel (?) because the returned value has been already converted to string. Similar behavior can be found with other escapes.
What do you mean by getmeta?
This
function getTagsValues(handle, tagsArray, bMerged = false) {
if (!isArrayStrings (tagsArray)) {return null;}
if (!handle) {return null;}
const sel_info = sel.GetFileInfo();
const tagArray_length = tagsArray.length;
let outputArray = [];
let i = 0;
while (i < tagArray_length) {
let tagValues = [];
const tagIdx = sel_info.MetaFind(tagsArray[i]);
const tagNumber = (tagIdx != -1) ? sel_info.MetaValueCount(tagIdx) : 0;
if (tagNumber != 0) {
let j = 0;
while (j < tagNumber) {
tagValues[j] = sel_info.MetaValue(tagIdx,j);
j++;
}
}
outputArray.push(tagValues);
i++;
}
if (bMerged) {outputArray = outputArray.flat();}
return outputArray;
};
Is slower than this;
]function getTagsValuesV3(handle, tagsArray, bMerged = false) {
if (!isArrayStrings (tagsArray)) {return null;}
if (!handle) {return null;}
const tagArray_length = tagsArray.length;
let outputArray = [];
let i = 0;
let tagString = "";
const outputArray_length = handle.Count;
while (i < tagArray_length) {
if (bMerged) {tagString += i == 0 ? "[%" + tagsArray[i] + "%]" : "[, " + "%" + tagsArray[i] + "%]";} // We have all values separated by comma
else {tagString += i == 0 ? "[%" + tagsArray[i] + "%]" : "| " + "[%" + tagsArray[i] + "%]";} // We have tag values separated by comma and different tags by |
i++;
}
let tfo = fb.TitleFormat(tagString);
outputArray = tfo.EvalWithMetadbs(handle);
if (bMerged) { // Just an array of values per track: n x 1
for (let i = 0; i < outputArray_length; i++) {
outputArray[i] = outputArray[i].split(', ')
}
} else { // Array of values tag and per track; n x tagNumber
let tfo = fb.TitleFormat(tagString);
outputArray = tfo.EvalWithMetadbs(handle);
for (let i = 0; i < outputArray_length; i++) {
outputArray[i] = outputArray[i].split('| ');
for (let j = 0; j < tagArray_length; j++) {
outputArray[i][j] = outputArray[i][j].split(', ');
}
}
}
return outputArray;
}
Try it iterating on 30k tracks. I didn't understand how a TF approach is faster than using the methods to get tags. I mean... take a look at how many things I have to do to get usable output with TF...