Let me get this straight...
fileName contains the full path to the new image.
you want to set your PSM to the name of the file in fileName
if so, use something along these lines: (can't test atm because I'm on a linux machine, but it should work)
js code:
Messenger.MyPersonalMessage=fileName.substring(fileName.lastIndexOf('\\')+1, fileName.lastIndexOf('.'))
edit: lol ('.') turned into a bunny :P
edit2: just saw you tried matty's code (which does the same, except it doesn't remove the extension) and it delayed the PSM change... how long is the delay there?