Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


"File already exists" - Renaming files, how to make my own error message?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62751
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> "File already exists" - Renaming files, how to make my own error message?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 "File already exists" - Renaming files, how t... - 7/25/2008 12:28:12 AM   
  TKS


Posts: 154
Score: 0
Joined: 5/16/2008
Status: offline
Heres the code I'm working with :


      

Note : "nameb.value" is a dinamic variable that is fetched from a textarea.
 
 
Post #: 1
 
 RE: "File already exists" - Renaming files, h... - 7/25/2008 12:35:02 AM   
  TKS


Posts: 154
Score: 0
Joined: 5/16/2008
Status: offline
Oh wait... figured it out 

   Function RenameSmilies()
           Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
           strNewName = inputbox("Would you like to change the name of the smiley you just clicked on?","Rename", objFSO.GetBaseName(nameb.value))
       If strNewName = "" Then
       Elseif strNewName = objFSO.GetBaseName(nameb.value) Then
       Else
               Dim objFile : Set objFile = objFSO.GetFile("Smilies/" & nameb.value)
           If objFSO.FileExists("Smilies/"+strNewName+"."+objFSO.GetExtensionName(nameb.value)) Then
               msgBox "Error message : " + (nameb.value) + " already exists!"
           Else
           objFile.Name = strNewName & "." & objFSO.GetExtensionName(nameb.value)
           document.location.reload()
           End If
       End If
   End Function

(in reply to TKS)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> "File already exists" - Renaming files, how to make my own error message? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts