Zum Hauptinhalt gehen

Suche

Suche

Stop Printing Using Vbscript

Kommentare

3 Kommentare

  • Avatar
    Canguita

    Hello,

     

    About your issue:

     

    1. Is ABS the weight from the scale? If yes, please note that very probably your scale is getting also the units (kilograms, grams, pounds,...) so you will need discard them for converting to integer.

     

    2. How are you stroring "PreviousWeight"? Is this initalized to 0 at the beggining?

     

    3. What does it happen if ABS is less than Previous Weight? Difference will be a negative number and will not be printed.

     

    4. In order to make sure that the values are properly updated, you will need to add your code in OnPostPrompt() event script.

     

    Thanks,

     

    Carlos

    0
  • Avatar
    Legacy Poster

    Hi Carlos,

     

    The Value is the Weight (embedded data) from the scale and I am using ABS to get the absolute value of the calculation so it should never return negative. Am I using this function incorrectly? 

     

    I have the "Previous Weight" stored as Embedded Data under Named Data Sources and print it out on the next label (so that I know it is not being set back to zero). I set this value every time in the OnPrintJobEnd event and never initialize it to zero.

    Format.NamedSubStrings("PreviousWeight").Value = Format.NamedSubStrings("Weight").Value So the current "Weight" is printed in large bold numbers and the "Previous" weight is printed in a smaller number on the lower left of the label. The Previous Weight does print out properly along with the weight. 
     
    The print command is sent to the scale "W<CR>" by Bartender every 250 milliseconds and I only receive the value in Pounds back from the scale "<STX> 1400 lb <CR><LF>". It is a Doran scale so I had to create the protocol for it and it is working fine. I have it immediately print the label with the current weight and previous weight. The properties also wait for a stable weight for 5 seconds. However if for any reason the weight jumps or drops by even 1 pound for the pallet (not sure why it is doing this) it will print out another label. I want to give it a 5 pound birth before printing the next label. 
     
    I will try adding this to the OnPostPrompt() event script. After looking it up in Bartender help it looks like the correct place to put it. Thank you.
     
    Update*****************************************************************************************
     
    I do not see an OnPostPrompt() event available for me to use. I looked through the Bartender Document Options --> VB Scripting and under the named data source properties --> Transforms -->  VB Script.
    0
  • Avatar
    Domingo Rodriguez
    Moderator

    Make sure that you use "Visual Basic Script" as the source for your data source, then choose "Even Control Scripts" as the "Script" type. Click the "Edit with Script Assistant..." button. You should now see the "OnPostPrompt" event under the event list.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.