ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
Priniting to a device
Hi,
I have to print to a printer or other device from flexsim. I need to print it with a special font-type so the string I print comes out as a barcode. Any ideas?
__________________
kind regards Nico. |
#3
|
||||
|
||||
Hi Brenton,
yes that is correct. I found a tool for creating barcodes (shareware, 260$) called active barcode. It can be commandline driven, so i think I could use the 'runprogram' command to call the program and then use the 'runprogram' command again with parameters to let the program create the barcode. If I understood the 'runprogram' command right, I can put in anything I could also execute in the Windows cmd?
__________________
kind regards Nico. |
#4
|
||||
|
||||
So I tried the transfer from theory to real ...
I have two more questions : 1. How can I make the cmd shell not disapear direcly so I can read error messages ... (/k does not work ..) 2. How can I pass strings as parameters which have to be marked by "" ? I am now trying to call the tool by a cscript C:\\path_to_application param1 param2 'param3' .... it works in the cmd shell but from flexscript I see the shell, but it doesn´t create a output and the shell is disapearing to fast to read the error message...
__________________
kind regards Nico. |
#5
|
||||
|
||||
Nico,
Just curious, why do you want to print bar codes while Flexsim is running? Are you monitoring a real time system? I think that others may want to do something similar and would be more interested in this post if they knew what you were trying to accomplish. Thanks, Brandon
__________________
thats not normal. Last edited by Brandon Peterson; 04-14-2008 at 08:30 AM. Reason: update question |
#6
|
||||
|
||||
Hi Brandon,
we are thinking about it. It will be a system for developing and testing a real system, and the barcode is a interface to the erp system, which will be scanned mannually. Flexsim will be mostly used as an interface between some lpcs, the userinputs and another simulation. Of cause there will be some parts simulated in flexsim but we will have to integrate into a distributed enviorment. So back to the printing: I got the cscript command working but I need to pass a string as part of the parameters in the runprogram command....??
__________________
kind regards Nico. |
#7
|
||||
|
||||
Nico,
Can you share the code that you are having problems with? I'm not sure what you mean by pass in a string. Brandon
__________________
thats not normal. |
#8
|
||||
|
||||
Hi Brandon,
I have to pass something like this to the command shell: cscript barcodeimage.wsf code128.bmp "text=Hello World" type=14 width=500 height=100 So one of the parameters is a string. when I use the runprogram command it would look like this: rundprgram("cscript C:\\pathtoapplication\\barcodeimage.wsf code128.bmp "text=Hello World" type=14 width=500 height=100"); So there are quotation marks inside the passed string..
__________________
kind regards Nico. |
#9
|
||||
|
||||
Nico,
Method 1 (C++): In C++ the \ character and the " are special characters and you treat them the same when you want to include them in a string. Instead of having just the " try \" this should get the quote into your string. It is the same thing as having to have \\ when you only want \. Code: runprogram("cscript C:\\pathtoapplication\\barcodeimage.wsf code128.bmp \"text=Hello World\" type=14 width=500 height=100"); Method 2 (Flexscript): In Flexscript this may be different and you can use the strquote() command. With this command you will want to place the string that you want in quotes withing the paranthesis. Code: runprogram(concat("cscript C:\\pathtoapplication\\barcodeimage.wsf code128.bmp ", strquote("text=Hello World"), " type=14 width=500 height=100")); I'm not a C++ programmer by any means but I'm pretty sure I've got this right. I hope this makes sense to you. Good Luck, Brandon
__________________
thats not normal. Last edited by Brandon Peterson; 04-17-2008 at 12:48 PM. Reason: Updated to include Flexscript and fix type |