Skip to main content

Search

Search

Prompt User For Source File

Comments

6 comments

  • Avatar
    Shotaro Ito

    For Automation edition or above, when you use text database (csv, tab separated etc) you can switch database by /D="<database file path>" command line option.

    ...bartend.exe /AF="c:\btw\myformat.btw" /P /D="c:\data\mydata.csv"
    

    Where /AF opens document, /P prints document, /D specifies which text database to use and /X closes bartender. 

    for detail, see Command line parameter reference in BarTender help > Automating BarTender.

     

    Commander middleware coming with BarTender will automatically do that - once you drop a trigger (text file) to specified scan folder,

    Commander renames the trigger file and print. for procedure, see Commander white paper's example #2.

    http://www.seagullscientific.com/label-software/whitepapers/overview-of-commander-new-201406.pdf

     

    you can create a simple application to allow users to select a text file then drop the file to the scan folder.

     

    For OLEDB/ODBC like Excel / Access / SQL database there's no such option. usually you need to export text file from the database.

    1
  • Avatar
    Legacy Poster

    This solution is  very nice. I'll probably build the print line code into my existing program! It can split them up and offer the print imposition files to PDF if bartend.exe is found!

     

    Now the only fun part is moving the exe I'm compiling to the machine that has bartender over and over :S 

    0
  • Avatar
    Legacy Poster

    SO, I'm working on building the command now - it's a beastie alright - shown below, where 999999_Part-A_500.txt is the part that I need to change per opening. I have all that working, but I'm just trying to confirm the setup in the label format. So, when I specify /D it will replace the first text database, basically it's the same as setting up the text file database (correct delimiters, header line, et cetera) and then just going to the "Database Connection Setup" window, selecting the first text file database, and selecting a different file,  is that right? 

    "C:\Program Files (x86)\Seagull\BarTender Suite\bartend.exe" "/AF=H:\Main Storage\Labels\Label Formats\02142014.btw /P /D=C:\DataDump\Imposifier\999999_Part-A_500 /X"
    

     

     


     

    /D="<path to data file>"


    Sets or changes the text file database to be used. If no connection to a text file database has been added to the label format, the /D parameter adds it. (BarTender will assume that the first line of the file is a header that contains the field names and that the data fields are delimited with the mixed-quote-and-comma method.) If connections to one or more text file databases have already been added, the file specified with the /D parameter replaces the first text database. (BarTender will assume that the new file uses the same delimitation method as the original file, and it will assume that the first line is a header of field names if and only if the original file had such a header.) The /D parameter applies to all open label formats unless the /AF= parameter has been used. A full path to the database may need to be specified. See How BarTender Processes Path and File Names for more information.

    0
  • Avatar
    Legacy Poster

    I tried "C:\Program Files (x86)\Seagull\BarTender Suite\bartend.exe" "/AF=H:\templabeling_Samples.btw /p /D=C:\DataDump\Imposifier\999999_Part-C_57.txt /X"  with /P /PD /p /pD /pd /Pd and it's not working

     

    I am on an edition that supports this right?

     

    Edit: HMMM, playing with individual pieces, I can: 

     

    Load the format:          ".../bartend" "/AF=H:\templabeling_Samples.btw"

    Adjust Datasource:      ".../bartend" "/D=C:\DataDump\Imposifier\999999_Part-C_57.txt"

    Print (w or w/o Dialog:  ".../bartend" /P

     

    (repeat adjusting datasource for other files. One /D and then /PD command for each)

     

    close bartender:           ".../bartend" /X

     

    So, it's doable, just as far as I can tell, not in a single command. Maybe a single line like the form 

    ".../bartend" "/AF=..." &&  ".../bartend" "/D=..." && ".../bartend" /P && .... && ".../bartend" /X 

    but I cant get /P and any of them to combine, or /X and any of them (at least not right. It opens the program, closes the label and leaves the program itself still open. /X again by itself closes the program too)

     

    Edit again: /AF and /D are working together. making the command chains/bat file possibilities less cumbersome. This only works is the label is already open though. That means if your old source file is gone, you get an error on opening with /AF you could avoid this by using a dummy file as soruce right before close. Something like: 

    /AF to open format

    /AF /D to ensure proper label selected and datasource of file 1

    /P print 

    /AF /D to ensure proper label selected and datasource of file 2

    /P print 

     

    (repeat /AF /D and then /P until done)

     

    /D to dummy data file

    /X to close program

     
    0
  • Avatar
    Shotaro Ito

    Umm.. trust me, Try Commander and your life will even be easier.

    It does what you do (keep open a document and print while switching data file), by just drop csv file to a folder.

    It helps you to create command line options with GUI assist too.

     

    Note that in default, Commander runs Service mode, so if you want to access mapped drive (H:) and show print dialog,

    you need to run Commander in application mode in Administer > Service setup,

    then make BarTender UI  / interactive dialog visible from Detection > Command handler setup.

    0
  • Avatar
    Legacy Poster

    Yeah, I'm thinking that commander would be the way to go. Trying to make a program to manipulate it through command line is not workign well for me. 

    0

Please sign in to leave a comment.