How to remember the last String in find and replace button

I have a button with this

Rename autorename FINDREP=ext PATTERN="{dlgstring|Find What?\n\nEnter String or letters to Find}" TO="{dlgstring|Replace with...}"

It's Works fine, But I want the button should remember the last Used String in Find What box and the Replace with Box, How to do that?

You might be able to use variables without scripting, but I think you'd be best off using a script, since then it is much easier to load and save variables and, more importantly, you can show a single dialog that asks for both the Find and Replace strings at once.

Maybe, what you said, my solution is there, but I am not enough skilled to understand that. Can you plz give me the code which is fill my need Leo