View previous topic :: View next topic |
Author |
Message |
Teamgreentech Valued Newbie
Joined: 07 Dec 2010 Posts: 46 Location: Somerset
|
Posted: Sun Mar 04, 2012 10:33 pm Post subject: USB Cash Drawer Open Function in VDS |
|
|
Hi All, I'm working on a little project and want to add a button to my dialog
to open a USB Cash Drawer that I have connected to my PC.
I need to send a Carrage Return value to Port 3 which is the port that the Serial emulator usb driver is listening on and apparantly sending data or a character will cuase the cash drawer to open. Seems to be lots of internet chatter about doing this with Java but I am even worse with java than I am with VDS
Perhaps someone can advise how I might achieve this ?
Many thanks for your help
Andy - Teamgreentech _________________ Many thanks
Andy @ Team Green Technology |
|
Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Sat Mar 10, 2012 5:57 am Post subject: |
|
|
What VDS Version? For VDS 6
Code: |
REM Before Dialog Create
EXTERNAL VDSCOM60.DLL
#DEFINE COMMAND,COMM
REM After Dialog Show
COMM OPEN,COMM3, 9600, 4, N, 1
COMM SENDLINE,""
COMM CLOSE
|
Code: |
COMM [VDS6]
Top Previous Next
Syntax:
COMM OPEN,<port>,<speed>,<databits>,<parity>,<stopbits>
COMM CLOSE
COMM SEND,<text>
COMM SENDLINE,<text>
Requires:
EXTERNAL VDSCOM60.DLL
#DEFINE COMMAND,COMM
Description:
The COMM command allows a DialogScript program to communicate with an external device using a serial port. The allowed options are:
COMM OPEN,...
Opens the serial port for communication. Note that only a single serial port may be opened at a time. The parameters are:
<port>
Specifies the serial port to open: COM1 ... COM8
<speed>
Specifies the communication speed in bits per second. Valid values are: 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200
<databits>
Specifies the number of data bits. Valid values are: 4, 5, 6, 7, 8
<parity>
Specifies the parity. Valid values are: N (none), O (odd), E (even), M (mark), S (space)
<stopbits>
Specifies the number of stop bits. Valid values are: 1, 2
COMM CLOSE
Closes the serial port
COMM SEND,...
Sends a string of text to the serial port
COMM SENDLINE,...
Sends a string of text to the serial port, followed by a line feed.
When a serial port is open and data is received, a COMMEVENT event is generated. The script can respond to this event by using the @COMM function to obtain the data that was sent.
OK:
Set to false if an error occurs.
See also:
@COMM
See an advanced example...
|
|
|
Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Sat Mar 10, 2012 4:46 pm Post subject: |
|
|
Where is the vdscom6.dll? I can't find it on the vdsworld.com site. Thanks. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 763 Location: Eastman, GA
|
Posted: Mon Mar 12, 2012 7:47 am Post subject: |
|
|
It's in the Visual DialogScript 6 root directory on install.
I'm not sure if my script example above will actually work, because VDS might interpret "" as an invalid variable. If this happens try @null()
I don't actually own VDS6 so I can't compile and test. |
|
Back to top |
|
 |
Teamgreentech Valued Newbie
Joined: 07 Dec 2010 Posts: 46 Location: Somerset
|
Posted: Mon Mar 12, 2012 9:27 am Post subject: |
|
|
Thanks for getting back to me on this question your advise is appreciated. I only have version 5 of VDS and as I needed to sort this out quite quickly I pushed on and came up with a rather uneligant solution which was to runh a batchfile with com call to send a data file to the port. It works but I don't like it
Maybe I'll upgrade to VDS 6 as I seem to be back in the VDS programming world and my business is slowly gaining momentum now
The batch command solutiuon I came up with if anyone is interested for future ref is as follows:
Code: | if @match(1,%%Code_encrypt)
Runh C:\Eject\FireDrawer.bat
%%row = @item(1)
List Clear,1
Parse "%%Name;%%Pass",%%row
if @file(c:\windows\system32\cqp.log)
List Loadfile,2,c:\windows\system32\cqp.log
end
List Add,2,Drawer opened by %%Name on @datetime(dd/mm/yyyy) at @datetime(hh:nn)
List Savefile,2,c:\windows\system32\cqp.log
List Clear,2
info CASH DRAWER OPEN !@cr()please remember to close the cash drawer@cr()when you have finished the transaction!
Goto Evloop |
The Batch file content is here:
@echo off
@mode com3:9600,8,n,1 > nul
@echo c:\eject\FireDrawer.bat > com3:
exit
that was it really, bit of a faf but if anyone get stuck for an option to sent data to a com port and does not have VDS6 then it is a get out of jail card
Best Regards to all
Andy - TeamGreenTech
cnodnarb wrote: | What VDS Version? For VDS 6
Code: |
REM Before Dialog Create
EXTERNAL VDSCOM60.DLL
#DEFINE COMMAND,COMM
REM After Dialog Show
COMM OPEN,COMM3, 9600, 4, N, 1
COMM SENDLINE,""
COMM CLOSE
|
Code: |
COMM [VDS6]
Top Previous Next
Syntax:
COMM OPEN,<port>,<speed>,<databits>,<parity>,<stopbits>
COMM CLOSE
COMM SEND,<text>
COMM SENDLINE,<text>
Requires:
EXTERNAL VDSCOM60.DLL
#DEFINE COMMAND,COMM
Description:
The COMM command allows a DialogScript program to communicate with an external device using a serial port. The allowed options are:
COMM OPEN,...
Opens the serial port for communication. Note that only a single serial port may be opened at a time. The parameters are:
<port>
Specifies the serial port to open: COM1 ... COM8
<speed>
Specifies the communication speed in bits per second. Valid values are: 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200
<databits>
Specifies the number of data bits. Valid values are: 4, 5, 6, 7, 8
<parity>
Specifies the parity. Valid values are: N (none), O (odd), E (even), M (mark), S (space)
<stopbits>
Specifies the number of stop bits. Valid values are: 1, 2
COMM CLOSE
Closes the serial port
COMM SEND,...
Sends a string of text to the serial port
COMM SENDLINE,...
Sends a string of text to the serial port, followed by a line feed.
When a serial port is open and data is received, a COMMEVENT event is generated. The script can respond to this event by using the @COMM function to obtain the data that was sent.
OK:
Set to false if an error occurs.
See also:
@COMM
See an advanced example...
|
|
_________________ Many thanks
Andy @ Team Green Technology |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|