Both of them have identical key-value names: Index, File.
I understand that identical names are, probably, not a good idea, but I don't want to change them. (For a number of reasons. Actually, it is a part of quite large and complicated script.)
The further explanations are better to show as part of the code itself:
Code: Select all
ModificationTimeOld := {}
ModificationTimeNew := {}
Files1 := ["foo.txt", "bar.txt", "baz.txt"]
Files2 := ["foo.png", "bar.png", "baz.png"]
for Index, File in Files1
{
FileGetTime, ModificationTimeNew, % File, M
ModificationTimeNew[File] := ModificationTimeNew
if (ModificationTimeOld[File] != ModificationTimeNew[File])
{
; This line updates the "last modification" date of the files
; inside the Files1 array.
;
; It works when located above the inner loop. However, due to
; the inner logic of my script, I want to move it below.
; The problem is, that when I move it below, it starts to "read"
; the modification dates of the inner loop, instead of outer.
; Is there a way to fix it?
ModificationTimeOld[File] := ModificationTimeNew[File]
for Index, File in Files2
{
; Of course, in real life here goes another things.
SoundBeep, 300, 300
}
; This is the "target" place.
; I.e. I want "ModificationTimeOld[File] := ModificationTimeNew[File]"
; line to be located here.
}
}