I'm currently modifying 'Insert text into file names' button by John Zeman. By default, the text(1,) in the text field is selected, is there any way to make it unselected by default?
Rename TO="{DlgStringS|텍스트를 삽입할 위치,입력할 텍스트\n\n(1 = 맨 앞)|1,}"
@nodeselect
@script vbscript
option explicit
Function Rename_GetNewName ( strFileName, strFullPath, fIsFolder, strOldName, ByRef strNewName )
Dim strNameOnly
Dim strExtension
Dim intComPos ' Location of the leftmost comma in dialog box entry
Dim strText ' Extracted Text from dialog box entry
Dim strCount ' Extracted number (of places from left) from dialog box entry
' If we're renaming a file then remove the extension from the end and save it for later.
if fIsFolder or 0 = InStr(strFileName,".") then
strExtension = ""
strNameOnly = strFileName
else
strExtension = Right(strFileName, Len(strFileName)-(InStrRev(strFileName,".")-1))
strNameOnly = Left(strFileName, InStrRev(strFileName,".")-1)
end if
' Find the leftmost comma
intComPos = InStr(strNewName,",")
if intComPos > 0 then
strCount = Trim(Left(strNewName, intComPos-1))
strText = Right(strNewName,Len(strNewName)-intComPos)
end if
Dim I
Dim Dots
Dots = ""
if CInt(strCount) > 0 then
I = 1
While I < CInt(strCount)
Dots = Dots & "."
I = I+1
Wend
Dots = "(^" & Dots & ")"
else
' Character position was not more than 0 - set LeftDots to an invalid value so rename fails
Dots = "(8SCaO4fOzy5hy4Fs2CxBGCPy6oAl2Hp988ZH9C3toox0HWlmOA)"
end if
Dim regex
' Create a RegExp object
Set regex = new RegExp
regex.Pattern = Dots & "(.*)"
strNameOnly = regex.Replace(strNameOnly, "$1" & strText & "$2")
strNewName = strNameOnly & strExtension
End Function