Very cool! Does it actually produce a code that can be scanned? On Fri, Jul 20, 2018 at 3:25 AM Matthias Rebbe via use-livecode < use-livecode@lists.runrev.com> wrote:
> Mike > > you´re awesome. That is already an almost complete solution to my > question. Never had expected that. Thank you very much. > I´ve made some little changes. One among of them is: > To have all the separate bars of the barcode in a group, i changed the > lines where the grc is cloned > to for example copy grc “narrowB” to grp “barcode2of5” > > Here´s now my code to convert the nNnNN…. string to Barcode > > local tLast > on mouseup > if there is a grp "barcode2of5" then delete grp "barcode2of5" > -- now change the width of the template graphics > put "2" into tNarrow > put "4" into tWide > set the width of grc "narrowC" to tNarrow > set the width of grc "narrowB" to tNarrow > set the width of grc "wideC" to tWide > set the width of grc "wideB" to tWide > put "0" into tHorAdjust -- allows to put a gap beween the separate bars. > put "60,286" into tBarTopLeft -- defines where the first bar is placed > put empty into tLast > put fld "2of5" into tChars -- the field with your wNnnW string > set the casesensitive to true -- to differentiate case of course > create grp "barcode2of5" > repeat for each char tChar in tChars > switch tChar > case "N" > -- checks the char, and clones the matching bar. > --if its the first time through, places it at astart location > -- then uses the id of the most recent bar forplacement > purposes > --clone grc "narrowB" > copy grc "narrowB" to grp "barcode2of5" > if tLast is empty then > set the topleft of the last grc to tBarTopLeft > else > set the topleft of the last grc to horAdjust(tHorAdjust) > end if > break > case "n" > --clone grc "narrowC" > copy grc "narrowC" to grp "barcode2of5" > if tLast is empty then > set the topleft of the last grc to tBarTopLeft > else > set the topleft of the last grc to horAdjust(tHorAdjust) > end if > break > case "W" > --clone grc "wideB" > copy grc "wideB" to grp "barcode2of5" > if tLast is empty then > set the topleft of the last grc to tBarTopLeft > else > set the topleft of the last grc to horAdjust(tHorAdjust) > end if > break > case "w" > --clone grc "widec" > copy grc "widec" to grp "barcode2of5" > if tLast is empty then > set the topleft of the last grc to tBarTopLeft > else > set the topleft of the last grc to horAdjust(tHorAdjust) > end if > break > end switch > put the short id of the last grc into tLast -- the id of the most > recently placed bar > end repeat > set the height of grp "barcode2of5" to 69 > set the width of grp "barcode2of5" to 360 > end mouseup > > --This function allows a horizontal adjustment of the single bars. > function horAdjust tHorAdjust > put the topright of grc id tLast into tTMP > set the itemdelimiter to "," > add tHorAdjust to item 1 of tTMP > return tTMP > end horAdjust > > Again, thank you very much for your help. > > Regards, > > Matthias > > > > Am 20.07.2018 um 01:01 schrieb Mike Bonner via use-livecode < > use-livecode@lists.runrev.com>: > > > > Not sure if it will work for your purpose, but as a test I created for > > graphic lines, 1 narrow black, 1 wider black, duplicated them and set the > > blendlevel of the copies so that they're transparent. > > > > Grcs are named narrowB, wideB, narrowC and wideC (b for black, c for > clear) > > > > Then used the following code (and your example string from above with the > > WWnNw stuff) to generate a barcode. > > > > on mouseup > > put empty into tLast > > put field 1 into tChars -- the field with your wNnnW string > > set the casesensitive to true -- to differentiate case of course > > repeat for each char tChar in tChars > > switch tChar > > case "N" -- checks the char, and clones the matching bar. > > --if its the first time through, places it at a > > start location > > -- then uses the id of the most recent bar for > > placement purposes > > clone grc "narrowB" > > if tLast is empty then > > set the topleft of the last grc to 10,50 > > else > > set the topleft of the last grc to the topright of grc id > > tLast > > end if > > break > > case "n" > > clone grc "narrowC" > > if tLast is empty then > > set the topleft of the last grc to 10,50 > > else > > set the topleft of the last grc to the topright of grc id > > tLast > > end if > > break > > case "W" > > clone grc "wideB" > > if tLast is empty then > > set the topleft of the last grc to 10,50 > > else > > set the topleft of the last grc to the topright of grc id > > tLast > > end if > > break > > case "w" > > clone grc "widec" > > if tLast is empty then > > set the topleft of the last grc to 10,50 > > else > > set the topleft of the last grc to the topright of grc id > > tLast > > end if > > break > > > > end switch > > put the short id of the last grc into tLast -- the id of the most > > recently placed bar > > end repeat > > end mouseup > > > > Spacing and line size might need to be tweaked, but it seems like this > > would be relatively straight forward. > > > > On Thu, Jul 19, 2018 at 4:30 PM Bob Sneidar via use-livecode < > > use-livecode@lists.runrev.com> wrote: > > > >> I think the trick will be drawing large graphics one at a time and > >> properly spaced at several times their finished size, perhaps off > screen, > >> then getting a snapshot of the result and scaling it down. Not sure how > >> picky the readers will be. > >> > >> Bob S > >> > >> > >>> On Jul 19, 2018, at 15:06 , Matthias Rebbe via use-livecode < > >> use-livecode@lists.runrev.com> wrote: > >>> > >>> Currently i am using a special 2of5i barcode font. The font .has only > >> four characters (bars) in its set. > >>> The code displays a > >>> narrow space (blank) bar when the character is n > >>> narrow black bar when N > >>> wide space when w > >>> wide black bar when W > >> > >> > >> _______________________________________________ > >> use-livecode mailing list > >> use-livecode@lists.runrev.com > >> Please visit this url to subscribe, unsubscribe and manage your > >> subscription preferences: > >> http://lists.runrev.com/mailman/listinfo/use-livecode > >> > > _______________________________________________ > > use-livecode mailing list > > use-livecode@lists.runrev.com > > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode