I don't know if I will be much help. Attached is an image of the code I used. For some reason, I remember the time delay was needed for it to work right. Hopefully you will find this useful. In my case 'linked to file? (F)' was set to TRUE. I was dealing with very large images, so I had to scale them down for viewing purposes in the files.
Randall Pursley