Possible to run a vbs script in scripting or generate a vbs script file?

Just wondering if it is possible to run a VBS script in scripting or would it be possible to create a vbs script within the scripting fuction then run it?

Thanks heaps.

Unfortunately not. Although ClearScript does support VBScript, it isn’t something that’s enabled in SambaPOS.

Ok no worries thank you, I’m trying to connect a tyro eftpos terminal to sambapos so it’s integrated. Would you have any other ideas on how to do it? Was thinking of using the vbs script to display the total amount.

Thanks,
Josh.

You may be able to push an amount to display to the terminal if you can find the docs for it.

If you’re trying to integrate payments with the terminal, I wouldn’t even try; trust me.

Ok no worries, basically what I was trying to do is when you press eftpos for payment it opens the tyro terminal adapter with the amount what’s due and sends it to the eftpos machine. You can activate the tyro terminal adapter by running a vbs script, vb6 code, Csharp code. If that’s any help?

The issue is there’s no way to get anything back from an external call. You could launch an external process if it accepts command line arguments, but there would be no way to get a response back.

That would work for the time being I reckon, could you help with doing that?

Here is the code from a vbs script.
Basically all you have to change is the line:

Call tyroAdapter.Purchase( 10008, 10000 )

10008 is the purchase amount. ($100.08)
1000 is cash out amount but that can stay zero. ($100.00)


`'Note: Use %windir%\SysWoW64\cscript.exe to run this script if you are on a 64 bit machine.
Set tyroAdapter = Wscript.CreateObject(“Tyro.Integ.TerminalAdapter”, “ttevent_”)

Sub ttevent_ReceiptReturned(receipt)
Wscript.Echo(receipt.GetText() & Vbcrlf & _
"Signature Required: " & receipt.IsSignatureRequired())
End Sub

Sub ttevent_TransactionCompleted(transaction)
Wscript.Echo("Transaction Result: " & transaction.GetResult() & Vbcrlf & _
"Status: " & transaction.GetStatus() & Vbcrlf & _
"Reference: " & transaction.GetTransactionReference() & Vbcrlf & _
"Authorisation Code: " & transaction.GetAuthorisationCode() & Vbcrlf & _
"Tip Amount: " & transaction.GetTipAmount() & Vbcrlf & _
"Tip Completion Reference: " & transaction.GetTipCompletionReference() & Vbcrlf & _
"Card Type: " & transaction.GetCardType())
End Sub

Sub ttevent_ErrorOccured(error)
Wscript.Echo error.GetErrorMessage() & Vbcrlf & _
"Transaction Started: " & error.IsTransactionStarted()
End Sub

Set posInformation = Wscript.CreateObject(“Tyro.Integ.Domain.POSInformation”)

posInformation.SetProductVendor(“ACME”)
posInformation.SetProductName(“ACME POS”)
posInformation.SetProductVersion(“1.2.3”)
posInformation.SetSiteReference(“102 Shop Street”)
tyroAdapter.SetPOSInformation(posInformation)

Call tyroAdapter.Purchase( 10008, 10000 )

Wscript.Sleep(100000)

WScript.DisconnectObject(tyroAdapter)`

I know nothing about VBScript or whatever library is being loaded, sorry. I wouldn’t even know where to start.

If this is a service used a lot in Australia, send an email to support@sambapos.com and see if maybe they’d undertake the integration.

Just a thought: if you could wrap that VBS in an exe that accepted command line args it might work. But exes on windows can only return an integer. So you’d have to have generic exit codes to tell you if the transaction was successful or not.

There’s an action that launches an external application and I think it can be done from within the script. One of the two can wait for an exit code, IIRC.

Ok thank you, would you know a way how to regenerate the code as it is above then saving it to say c:\purchase.vbs only changing the 1000 to whatever the total amount is, then running the process c:\purchase.vbs?

I was thinking i could make samba ask a question after the process has run asking if it was approved?

Thanks again.

Easily? No. What you could do is have a base script with some sort of place holder for the amounts - something that won’t match anything else. e.g. $trans_amount$ then pass args off to a program that loads the base script, replaces the value(s), saves it as another file then executes it.

There may be a more elegant way but I’m just spitballing right now.

I’ve tried to go down this route before and, for me, it just isn’t worth it.

Ok, did you have any luck before hand or some old code that I could have a play with to see how it goes?

Nope. I started poking around almost three years ago and gave up.

IIRC, I was trying to do it through the payment processor feature that allows the execution of a script. I can’t recall which handler fires in what order, but there should be a thread or two about them.

Are you in Aus? We will be launching integrated payments there soon. Also we do not allow integrated payments from unofficial sources it’s not safe to do that. Feel free to check in with us soon for aus payments integration.

We will be able to offer competitive rates and great devices. Please be patient it’s nearly there.

Thank you Jesse, will Tyro be included in this?