Capitalize Just the First 3 Letters of a File Name

Hello,

is there a script out there that would just captialize the first three letters or the first word of a filename and leave all other words in default case?

thanks

try this one

<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
	<label>UC3L</label>
	<tip>Upper Case first 3 Characters</tip>
	<icon1>#smartfavorites</icon1>
	<function type="normal">
		<instruction>Rename PATTERN * TO *</instruction>
		<instruction />
		<instruction>@script vbscript</instruction>
		<instruction>Option Explicit</instruction>
		<instruction />
		<instruction>Dim NumberOfUpperCaseChars</instruction>
		<instruction>NumberOfUpperCaseChars = 3</instruction>
		<instruction />
		<instruction>Function Rename_GetNewName ( strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName )</instruction>
		<instruction>	strNewName = UCase(left(strFileName,NumberOfUpperCaseChars)) &amp; right(strFileName, len(strFileName)-NumberOfUpperCaseChars)</instruction>
		<instruction>End Function</instruction>
	</function>
</button>

Mmm, does it uppercase first 3 letters or characters?

Uppercasing a non-letter is a no-op :slight_smile:

Mmm, what shall be done to filename like a23bcd.txt? Should it turn into A23bcd.txt (first three characters capitalisation) or into A23BCd.txt (first three letters capitalisation)?

Yes, I am nitpicking, it's one of these days.

ok ok, now the real first 3 LETTER thing :slight_smile:

<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
	<label>UC3L</label>
	<tip>Upper Case first 3 Letters</tip>
	<icon1>#smartfavorites</icon1>
	<function type="normal">
		<instruction>Rename PATTERN * TO *</instruction>
		<instruction />
		<instruction>@script vbscript</instruction>
		<instruction>Option Explicit</instruction>
		<instruction />
		<instruction>Dim NumberOfUpperCaseChars</instruction>
		<instruction>NumberOfUpperCaseChars = 3</instruction>
		<instruction />
		<instruction>Function Rename_GetNewName ( strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName )</instruction>
		<instruction>	Dim i, count,c</instruction>
		<instruction>	count = 0</instruction>
		<instruction>	strNewName =&quot;&quot;</instruction>
		<instruction>	For i = 1 to len(strFileName)</instruction>
		<instruction>		c = mid(strFileName, i, 1)</instruction>
		<instruction>		if count&lt;NumberOfUpperCaseChars and LCase(c)&lt;&gt;UCase(c) then</instruction>
		<instruction>			c = UCase(c)</instruction>
		<instruction>			count = count + 1</instruction>
		<instruction>		End If</instruction>
		<instruction>		strNewName = strNewName &amp; c </instruction>
		<instruction>	Next</instruction>
		<instruction>End Function</instruction>
	</function>
</button>

thanks, works great