Updating Objects Values
I'm new to BT, but i worked a bit with it and managed to create some nice layouts.
Since there is no way to create a Header/detail layout yet, I created mine.
I read a text file, generated by another software, and import it in a out of page (not printed) object. then i read it and set the values of the objects.
This initial object that contains the file's data is a VBScript type. My script reads the file and set the value of itself.
Then i have another script in one of the objects on the page that fills the values.
Works, but i have some issues...
Infact, if i print the page, the values are not immediately updated from the file. Means, i have the values in the file only the second time I print, the first time I print I have the old values.
I have to say i normally use print preview, but i tested also with normal print and seems the same behavior.
Any idea on how i could force the data on the page to be refreshed?
The text file should be renamed .old as i plan to use commander to trigger the printout. The .old should reside in C:\temp.
Have you tried just using the "External File" data source type instead of a complicated VBS to read the file?
I did as first. but I couldn't manage in that way...
and my script is not so complicated :-)
I actually tried again the suggestion given. I tried that as I said, and have the same result. I use the out-of -printzone field as an external file now. So, the content is read directly, no VBScript.
Anyhow, if i run the template with text file "A" i have result A. I change the txt file behind the scene to "b", run again the template, result is still A. I re-run it, result is B now. So same problem.
Also, is there a way to change the name of the file dynamically? File A.txt could be A1.txt once in a while...
And... i might start to think that the test I am doing are not correct... in the sense that when the process is managed through Commander, it may work. Just the test is not.
I'll try and report back...
It is not working... it is like also using commander the file used as DB is not loaded...
Beginner's mistake. as i used the rename function in Commander (to .old) obviously the .txt was not retrieved by the template... so now it is ok.
- I use .txt as trigger
- renamed to .old by Commander
- picked by the template as .old
Make sure you specify the Commander variable "%Trigger File Name%" as the file to use for the print jobs as this will tell BarTender to use the file that Commander just renamed as the input data file. Do not make an explicit reference to the data file to print with.0
Ian, thanks... but could you elaborate a bit more? I tried to use the %Trigger... variable in the BT Template instead of the file name, but didn't manage to make it work.
thanks for the help,
You specify it in the BarTender command dialog under the "Text File" tab of your Commander task. You shouldn't be modifying the BarTender document for this. I suggest you read through the white paper: http://www.seagullscientific.com/label-software/whitepapers/overview-of-commander-new-201406.pdf0
Ian, thanks again, but still...
- how am I supposed to indicate the file to be used as database in the BT template? I have 3 options: select file, from Db or from data source. if my file has names like file001.ttx, file002.txt etc., which option should i use?
or maybe should i remove completely the External file object? and how do i read and fill the other objexts o nthe template then?
In the BarTender document you simply connect to a template file of the same structure, and then choose the data fields to use for each of your label object data sources. At print time Commander changes the connection parameters to be connecting to the detected trigger file instead. Follow the white paper example and you'll be golden.0
i see that. But I cannot use a database as I need to have a Header/Detail file. So i still struggle to understand what kind of object should I use to store the data.
I managed to have the External file be loaded and used, but still I rely on a fix name in the VBScript. I'd need to have that filename variable.
sorry if i struggle to understand...