I need to compare file properties for two sets of files and while this would be a piece of cake with assoc. arrays at hand, I fail to see how to solve this in a halfway decent manner without such an object.
In AppleScript I have lists like these
I could iterate over every item of list A and for each item iterate over the entire list b to find matching filenames, but that is horribly inefficient. There ought to be a way to do this in AppleScript that is not a complete PITA, right?
What I aim for is something along these lines (pseudocode), which is obviously not the way to do it in AppleScript:
Any help much appreciated
In AppleScript I have lists like these
Code:
filesA = {{filename:"filename X.tif",width:"500"},{filename:"filename Z.tif",width:"200"}, ...}
filesB = {{filename:"filename Z.tif",width:"400"},{filename:"filename v.tif",width:"200"},{filename:"filename X.tif",width:"100"}, ...}
I could iterate over every item of list A and for each item iterate over the entire list b to find matching filenames, but that is horribly inefficient. There ought to be a way to do this in AppleScript that is not a complete PITA, right?
What I aim for is something along these lines (pseudocode), which is obviously not the way to do it in AppleScript:
Code:
filesA = array(
"filename X.tif" => 500,
"filename Z.tif" => 200
);
filesB = array(
"filename Z.tif" => 400,
"filename V.tif" => 200,
"filename X.tif" => 100
);
foreach (filesA AS key => value)
ratios[key] = value / filesB[key];
end foreach
Any help much appreciated