anixon Posted October 18, 2009 Share Posted October 18, 2009 (edited) Is there a check sum #include based on the UPC check formula been written for AutoIT? The the last digit in the number is the check sum and is derived by applying a formula to the first digits 'excluding the check sum number' and subtracting that number from 10. This code works on 9 digits #include <Array.au3> dim $CheckSum[9] $CheckDigit = 123456782 ;//Populate The Checksum Array For $i = 0 to UBound( $CheckSum ) - 1 $CheckSum[$i] = Stringmid($CheckDigit, $i, 1) Next ;Calculate the CheckSum $CheckSumOdd = ($CheckSum[1] + $CheckSum[3] + $CheckSum[5] + $CheckSum[7]) * 3 $CheckSumEven = $CheckSum[2] + $CheckSum[4] + $CheckSum[6] + $CheckSum[8] $CheckSumCal = 10 - StringRight($CheckSumOdd + $CheckSumEven,1) Msgbox(0,"",$CheckSumCal) Edited October 18, 2009 by anixon Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now