Dim Akelpad, FilePath, WS
Akelpad = WScript.Arguments(0)
FilePath = WScript.Arguments(1)
Set WS = WScript.CreateObject("WScript.Shell")
WS.Run """" & Akelpad & """ /C+ """ & NextName(FilePath) & """"
Set WS = Nothing
WScript.Quit()
Function NextName(pFilePath)
Dim FSO, Path, Name, Ext, i, Ending
Set FSO = CreateObject("Scripting.FileSystemObject")
Path = FSO.GetParentFolderName(pFilePath) & "\"
Name = FSO.GetBaseName(pFilePath)
Ext = FSO.GetExtensionName(pFilePath)
Do While FSO.FileExists(Path & Name & Ending & "." & Ext)
i = i + 1
Ending = Right("0" & i, 2)
Loop
Set FSO = Nothing
NextName = Path & Name & Ending & "." & Ext
End Function |