Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


I am sure this is simple but.....

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> I am sure this is simple but.....
  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 >>
 I am sure this is simple but..... - 7/10/2007 6:57:09 AM   
  chrisgoforth

 

Posts: 8
Score: 0
Joined: 7/6/2007
Status: offline
Between a couple of us geeks here we have developed the below script. The only thing we have not figured out (and I am sure this is such an easy thing to do) is get it to start over once the data has been input. Everything else in script works great!!! We just need it to constantly loop is all. Can anyone help me with this.

Option Explicit
DIM strTitle 'Input box title
DIM strPrompt ' Prompt for input box
DIM strDefault 'Default value for input box
DIM strSwipe 'swipe data
DIM OutputFile  'The Output File C:\MagTekFile.txt
DIM Filesystem
DIM objFSO
DIM objFile
DIM strSubSwipe 'The shortened Card #
DIM strSiteID 'First 2 #'s of the card after it is shortened  ie 39
DIM strResult 'Resulting data after extra is removed & zero added

strTitle = "Total Rewards Card Swipe"
strPrompt = "Swipe Card Now"
strDefault = "Good Luck"

strSwipe = InputBox(strPrompt,strTitle,strDefault)
strSubSwipe = Ucase(Mid(strSwipe,17,9))
strSiteID  = Ucase(Mid(strSubSwipe,1,2))
Call Location(strSubSwipe, strSiteID)
OutputFile = "C:\MagTekFile.txt"  'Assigning the Path to OutPutFile variable
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
IF objFSO.FileExists(OutputFile) Then
Set objFile = objFSO.OpenTextFile(OutputFile, ForAppending)
 objFile.WriteLine strResult
Else
Set objFile = objFSO.CreateTextFile(OutputFile)
 objFile.writeline strResult
 
End IF
Function Location(strSubSwipe, strSiteID)
DIM dblSubSwipe
Const dblFraction = .000001

IF strSiteID = "39" Then
dblSubSwipe = CDbl(strSubSwipe)
dblSubSwipe = dblSubSwipe * dblFraction
dblSubSwipe = dblSubSwipe + 3510
dblSubSwipe = dblSubSwipe / dblFraction
strResult = CStr(dblSubSwipe)

ElseIF strSiteID = "80" Then
dblSubSwipe = CDbl(strSubSwipe)
dblSubSwipe = dblSubSwipe * dblFraction
dblSubSwipe = dblSubSwipe + 7200
dblSubSwipe = dblSubSwipe / dblFraction
strResult = CStr(dblSubSwipe)
Else
END IF
End Function 

objFile.Close

_____________________________

I am very new to VBS and need lots and lots and lots of help
 
 
Post #: 1
 
 RE: I am sure this is simple but..... - 7/10/2007 9:20:38 AM   
  Skie

 

Posts: 58
Score: 0
Joined: 3/2/2006
Status: offline

      

(in reply to chrisgoforth)
 
 
Post #: 2
 
 RE: I am sure this is simple but..... - 7/10/2007 10:32:40 AM   
  chrisgoforth

 

Posts: 8
Score: 0
Joined: 7/6/2007
Status: offline
Thank you very much. Now I can do the happy dance

(in reply to Skie)
 
 
Post #: 3
 
 
 
  

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 >> I am sure this is simple but..... 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