Use the below codes...
myDocument = app.activeDocument;
path = myDocument.fullName;
var x = path.toString().replace("z", "H");
Hope this will help you...
Thanks and Regards,
Thank you very much Velprakash!
Vel's code will replace all instances of lowercase 'z' with uppercase 'H' -- even the ones in the file path.
Better try this:
myDocName = app.activeDocument.fullName.path+'/'+app.activeDocument.fullName.name.replace(/^z/i, "H");
(The GREP code you were probably looking for is '^' -- start of 'line', in this case equal to the start of the string.)
Thank you Guru Jongware — yes it was the ^ character I was looking for after all!
All best to both of you : )