Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: Scratching my head for hours trying to work this out

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: Scratching my head for hours trying to work this out
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 RE: Scratching my head for hours trying to work this out - 12/14/2006 1:22:12 AM   
  markmcrobie

 

Posts: 314
Score: 0
Joined: 12/12/2006
Status: offline
Ok, with a slight modification of the example above, I got it working within my script.

However it was complete luck/trial & error and I really don't understand how it's working.  I'm not happy with this, as I see no value in getting someone else's code to work without understanding how it works myself.  So could someone please explain how the following code works, in the context of my original problem.  About all I understand is the Len(strResult)-1 statement is to strip off the trailing "-".  Many thanks, I'm keen to learn!

Code:

strSystemMsg = "Please enter System for: " & VbCRLf & VbCRLf & strNewName & strExtension & VbCRLf & VbCRLf &_
 "Hummingbird Doc #: " & strDocNo & VbCRLf & VBCRLf & "To omit the System, click Cancel"
 arrSysSeqRev(0) = InputBox(strSystemMsg,strTitle,"", 100, 100)

 strSequenceMsg = "Please enter Sequence Number for: " & VbCRLf & VbCRLf & strNewName & strExtension & VbCRLf & VbCRLf &_
 "Hummingbird Doc #: " & strDocNo & VbCRLf & VbCRLf & "To omit the Sequence Number, click Cancel"
 arrSysSeqRev(1) = InputBox(strSequenceMsg,strTitle,"", 100, 100)

 strRevisionMsg = "Please enter Revision for: " & VbCRLf & VbCRLf & strNewName & strExtension & VbCRLf & VbCRLf &_
 "Hummingbird Doc #: " & strDocNo & VbCRLf & VbCRLf & "To omit the Revision, click Cancel"
 arrSysSeqRev(2) = InputBox(strRevisionMsg,strTitle,"", 100, 100)

 For Each strSSR In arrSysSeqRev
  If strSSR <> "" Then
   strResult = strResult & strSSR & "-"
  End If
 Next
 
 If strResult <> "" Then strResult = Left(strResult, Len(strResult)-1)
 
 'Append the user's input to the beginning of the new file name and actually rename the file.
 'Will append a number to the end of any file name if it causes a duplicate of another file that's been renamed.
 If strResult = "" Then
  
  If fso.FileExists(strNewName & strExtension) Then    
   intCounter = intCounter + 1
   File.Name = strNewName & intCounter & strExtension
  Else
   File.Name = strNewName & strExtension
  End If
 Else
  If fso.FileExists(strResult & " - " & strNewName & strExtension) Then
   intCounter = intCounter + 1
   File.Name = strResult & " - " & strNewName & intCounter & strExtension
  Else
   File.Name = strResult & " - " & strNewName & strExtension
  End If
 End If

(in reply to markmcrobie)
 
 
Post #: 21
 
 
Page:  <<   < prev  1 [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 >> RE: Scratching my head for hours trying to work this out Page: <<   < prev  1 [2]
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