Relinking/file name?

I want to relink LoRes images to HiRes images. Images in LoRes folder are named like Image1.jpg, image2.jpg… Images in HiRes folder are named like image1.tif, image2.tif… Please note the different extension.

I’m stuck with this line:

if name of myNewFileName = name of LinkName then

What ever I do to the script, I allways get the samekind of error: Can’t get name of image1.

And I can’t figure out what is the mistake I have made…