| |
chrisgoforth
Posts: 8
Score: 0
Joined: 7/6/2007
Status: offline
|
Okay again this is probably something simple for all of you but not for little ol me. You guys have been a very big help so far and it is very much appreciated. I think I am using the wrong commands (is the right term?) in here but I am not really sure what I should be using. Basically the setup is I have a card swipe (magnetic card reader) that customers will walk up to a kiosk and swipe their card via the card reader and the card reader then sends that data into a program called simple swipe that sends it off to a sql database. I had to devise this script to remove some data and add other data from the swipe. That is all working great. Now all I have left is to have it send that data into the simple swipe program. The program only has 1 dialog box that can have data put into. The problem is the script is not feeding into the program. I need the script to see the program if it is up and feed the information into it or launch the program if it is not up. Any ideas? Here is the script. 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 Dim SimpleSwipe 'Simpleswipe program Dim MPSS 'MPSS Const ForAppending = 8 'InputBox Data strTitle = "Total Rewards Card Swipe" strPrompt = "Swipe Card Now" strDefault = "Good Luck" OutputFile = "C:\MagTekFile.txt" 'Assigning the Path to OutPutFile variable The txt file was for testing SimpleSwipe = "c:\program files\mps\SimpleSwipe\SimpleSwipeOnline.exe" 'Simple Swipe Path MPSS = "c:\program files\mps\SimpleSwipe\SimpleSwipeOnline.exe" 'This grabs the data that was swiped and strips it to the desired section of #'s and calls Function Location 'Also get the first 2 #'s of card SiteID and sends to Function Location Do While True strSwipe = InputBox(strPrompt,strTitle,strDefault) If strSwipe = "" Then WScript.Quit End If strSubSwipe = Ucase(Mid(strSwipe,17,9)) strSiteID = Ucase(Mid(strSubSwipe,1,2)) 'The call of the function that adds the missing zero with formula Call Location(strSubSwipe, strSiteID) Set SimpleSwipe = GetObject("c:\program files\mps\SimpleSwipe\SimpleSwipeOnline.exe") '("mpss")) If objFSO.FileExists(SimpleSwipe) Then Set SimpleSwipe = GetObject("c:\program files\mps\SimpleSwipe\SimpleSwipeOnline.exe")'("mpss")) objFile.WriteLine strResult Else Set SimpleSwipe = GetObject("c:\program files\mps\SimpleSwipe\SimpleSwipeOnline.exe") objFile.writeline strResult End If '***Loop setting*** objFile.Close Loop 'Add missing zero depending on Property 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
_____________________________
I am very new to VBS and need lots and lots and lots of help
|
|