I am trying to shorten existing folder names so that only the first two parts of the exisiting folder name remain, e.g. a folder named "FirstPart SecondPart ThirdPart" will be renamed to "FirstPart SecondPart" and any additional parts of the folder name will be removed. (I recently received help on the forum on how to remove dates from the end of other folder names, but am now stuck trying to shorten these folder names.) The length of the folder names varies with each folder. I can get the length of the first two parts of the folder name using InStr and I have confirmed the result using a Message Box. But when I try to use that length within SubStr nothing happens. I have tried numerous combinations of script. Can anyone assist please? My script:
Code: Select all
Send, !{Esc}
Sleep, 200
Send ^a
Send ^c
Sleep, 200
InStr(Clipboard, " ", false, 1, 2) ; result is correct if tested using a Message Box
Send % SubStr(Clipboard, 1, %InStr%)
return
Thank you to anyone who can help.
Roger