PascalThum Posted February 10, 2017 Posted February 10, 2017 Hi there I need help creating a script to calculate a check character with mod 43 for a barcode. I found this VBA script but can't adapt it for autoit. ' calc modulo 43 ‘ returns the input string plus the check character ' demo for www.activebarcode.com Public Function MOD43CheckChar(sValue As String) As String Const charSet As String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" Dim i As Integer Dim T As Long For i = 1 To Len(Trim(UCase(sValue))) T = InStr(charSet, Mid(sValue, i, 1)) - 1 + T Next i MOD43CheckChar = sValue & Mid$(charSet, (T Mod 43 + 1), 1) End Function Can somebody give me a hint? Thanks ,Pascal
PascalThum Posted February 10, 2017 Author Posted February 10, 2017 i think i found the solution by myself: $temp = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" For $i = 1 To StringLen($HIBC) $subtotal = StringInStr ($temp, StringMid ($HIBC, $i, 1)) - 1 + $subtotal Next $MOD43CheckChar = StringMid($temp, (Mod($subtotal,43)+1),1)
UEZ Posted February 10, 2017 Posted February 10, 2017 Just for my curiosity, can you provide an input and output for that VBA function? Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
spudw2k Posted February 10, 2017 Posted February 10, 2017 ditto, That VBA function seems incomplete to me. When ran I get my original + a single digit "This is a string" yields This is a string2 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
PascalThum Posted February 13, 2017 Author Posted February 13, 2017 @UEZ Input Excel cell would be "=MOD43CheckChar("Test")" and the Output TestQ where Q the check character is. @spudw2k Yes, that's correct. The number 2 is your check character . Each of the HIBC LIC Standard data structures employs a Modulus 43 Check Digit for additional data security. The Check Digit is the Modulus 43 sum of all the character values in a given message, and is printed as the last character in a given message.
spudw2k Posted February 13, 2017 Posted February 13, 2017 (edited) Got it, I didn't understand what the logic was and was expecting a longer "checksum". Having it reduced to 43 single characters yields innumerable "collisions". If it's for a quick and dirty, speedy mechanism to validate some data (thinking data transmission perhaps?)I suppose it may be useful, but seems potentially unreliable to me. Not knowing too much about this method compares to other checksums, one glaring issue I see is the order of the string doesn't matter. For example: ABC, BAC, CBA, CAB all yield the same check char. edit: knowing this is for a barcode standard...probably nothing you can do about it; so I guess it's just commentary in general. Edited February 14, 2017 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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