AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dirty QR Barcode Generator

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  

usefull?
yes
100%
 100%  [ 2 ]
no
0%
 0%  [ 0 ]
Total Votes : 2

Author Message
imapow



Joined: 13 Mar 2008
Posts: 155
Location: Trøndelag, Norway

PostPosted: Mon Oct 12, 2009 9:05 pm    Post subject: Dirty QR Barcode Generator Reply with quote

this is more like a client for the tec-it barcode generator

it needs internett

Code:

;this is a client for:
;http://www.tec-it.com/online-demos/tbarcode/barcode-generator.aspx

gui, add, edit,vbc r1 w100,
gui, add, button, x+5 w50, go
gui, 2:add, text,vtext cblue w200,
gui, 2:add, pic,vbarcode w200 h200 xm+5,
gui, 2:add, text, w200,This barcode was generated with Barcode Software by TEC-IT.
gui, show, y300
nr1 = 0
OnExit,
return

buttongo:
GuiControlGet, bc
gg = gg
if gg = g%bc%g
bc = error
StringReplace, bctext, bc, %A_SPACE%, +, All
UrlDownloadToFile, http://www.tec-it.com/online-demos/tbarcode/barcode.aspx?code=QRCode&data=%bctext%&dpi=96&rotation=0&modulewidth=fit, %A_ScriptDir%\bc.gif
if nr1 = 0
guicontrol, 2:, barcode, %A_ScriptDir%\bc.gif
guicontrol, 2:, text, %bc%
gui, 2:show, y400
FileDelete, %A_ScriptDir%\bc.gif
return


|::
guiclose:
exitapp

_________________
-._.-¨¯¨-._.-IM@PΩW-._.-¨¯¨-._.-


Last edited by imapow on Tue Oct 13, 2009 8:31 am; edited 2 times in total
Back to top
View user's profile Send private message
Nom



Joined: 24 Jun 2009
Posts: 16

PostPosted: Tue Oct 13, 2009 3:27 am    Post subject: Reply with quote

I don't use QD codes myself but pointing out this resource and a method to implement it's use certainly is useful.

You might consider adding

This barcode was generated with Barcode Software by TEC-IT.

to your code atleast in a comment if not in an about on your gui.

I'm definitely going to use your code as a starting point for an app for the office, Thanks!

Nom
Back to top
View user's profile Send private message
imapow



Joined: 13 Mar 2008
Posts: 155
Location: Trøndelag, Norway

PostPosted: Tue Oct 13, 2009 8:31 am    Post subject: Reply with quote

uppdate added:
credits to tec-it
_________________
-._.-¨¯¨-._.-IM@PΩW-._.-¨¯¨-._.-
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Oct 13, 2009 1:04 pm    Post subject: Reply with quote

Nom wrote:
I don't use QD codes myself


you can modify it to use meny types of barcodes

Code:

http://www.tec-it.com/online-demos/tbarcode/barcode.aspx?code=QRCode&data=your+text&dpi=96&rotation=0&modulewidth=fit


this is just one of meny barcodes. you can find more at:
http://www.tec-it.com/online-demos/tbarcode/barcode-generator.aspx

find you type and copy the url from the html code feald at the buttom
Back to top
infogulch



Joined: 27 Mar 2008
Posts: 649

PostPosted: Tue Oct 13, 2009 6:00 pm    Post subject: Reply with quote

oh. my. god.

wtf kind of obfuscation is this!?!
Code:
gg = gg
if gg = g%bc%g
    bc = error


There is a problem with your code (besides the gag-inducing IF statement above). If the user typed any url characters into the text box then your code fails.

I added uriEncode() that fixes this problem:
Code:
;this is a client for: http://www.tec-it.com/online-demos/tbarcode/barcode-generator.aspx
#SingleInstance, Force
#NoEnv

    gui, add  , edit  , vbc r1 w400, http://www.tec-it.com/online-demos/tbarcode/barcode-generator.aspx
    gui, add  , ddl   , vtype y+5 w345 +AltSubmit gTypeChg, % types("", 2)
    gui, add  , button, x+5 w50 default, Go
    gui, add  , text  , y+5 xm w400 vDescr r2 +Wrap
    gui, 2:add, edit  , vtext cblue w400 +ReadOnly
    gui, 2:add, pic   , vbarcode h200 w400 xm+5
    gui, 2:add, text  , w400 gTecIT, This barcode was generated with Barcode Software by TEC-IT.`nClick to visit their website.
    gui, show, y300, Create Barcode
   gosub typechg
return

TypeChg:
   GuiControlGet, type
   guicontrol, , descr, % types(type, 3)
return

ButtonGo:
    GuiControlGet, bc
    GuiControlGet, type
    type := types(type, 1)
    if (bc = "")
        bc = error
    bctext := uriEncode(bc)
    UrlDownloadToFile, http://www.tec-it.com/online-demos/tbarcode/barcode.aspx?code=%type%&data=%bctext%&dpi=96&rotation=0&modulewidth=fit, %A_ScriptDir%\bc.gif
    guicontrol, 2:, barcode, *h0 *w0 %A_ScriptDir%\bc.gif
    guicontrol, 2:, text, %bc%
    gui, 2:show, y400, Barcode
return

tecit:
    run http://www.tec-it.com
return

guiclose:
   exitapp


uriEncode(str) {
; by Titan: http://www.autohotkey.com/forum/viewtopic.php?p=119507#119507
; modified by infogulch for this specific application
   f = %A_FormatInteger%
   SetFormat, Integer, Hex
   StringReplace, str, str, `%, `%25, All
   StringReplace, str, str, +, `%2B, All
   StringReplace, str, str, %A_Space%, +, All
   Loop
      If RegExMatch(str, "i)[^\w\.~%+]", char)
         StringReplace, str, str, %char%, % "%" . substr( "0" . substr(Asc(char)+0,3) , -1), All
      Else Break
   SetFormat, Integer, %f%
   Return, str
}

Types( row = "", col = "", join = "|" ) {
    static types
    if (types = "")
        gosub settypes
    if (row + 0 && col + 0)
    {
        loop, parse, types, `n, %A_Space%%A_Tab%
            if (A_Index = row)
                loop, parse, A_LoopField, @, %A_Space%%A_Tab%
                    if (A_Index = col)
                        return A_LoopField
    }
    else if (col + 0)
    {
        loop, parse, types, `n, %A_Space%%A_Tab%
            loop, parse, A_LoopField, @, %A_Space%%A_Tab%
                if (A_Index = col)
                    ret .= A_LoopField join
        return substr(ret, 1, -1)
    }
return "", ErrorLevel := "Invalid row/col"

SetTypes:
    types := "
    ( LTrim Join`n
        Aztec                 @Aztec                               @Encodes alphanumeric data (ISO8859-1) and Bytes
        CodablockF            @Codablock-F                         @Encodes ASCII [0..127] + ISO8854-1
        DataMatrix            @DataMatrix                          @Encodes alphanumeric characters (Latin-1) and Bytes
        MaxiCode              @MaxiCode                            @Encodes alphanumeric data (USPS specific)
        MicroPDF417           @MicroPDF417                         @Encodes alphanum. and / or bytes
        PDF417                @PDF417                              @Encodes alphanumeric data (ASCII/Ext.ASCII) and Bytes
        QRCode                @QRCode|                             @Encodes alphanumeric data (Latin-1, Kanji) and Bytes
        MicroQR               @MicroQRCode                         @Encodes alphanumeric data (Latin-1, Kanji)
        MobileQRPhone         @QRCodePhonenumber                   @Encodes alphanumeric data (Latin-1, Kanji) and Bytes
        MobileQRSMS           @QRCodeSMS                           @Encodes alphanumeric data (Latin-1, Kanji) and Bytes. Enter the phone number and the desired text sperated by a colon ':'
        MobileQRUrl           @QRCodeUrl                           @Encodes alphanumeric data (Latin-1, Kanji) and Bytes
        MobileSemaPhone       @SemacodePhonenumber                 @Encodes alphanumeric characters (Latin-1) and Bytes
        MobileSemaSMS         @SemacodeSMS                         @Encodes alphanumeric characters (Latin-1) and Bytes. Enter the phone number and the desired text sperated by a colon ':'
        MobileSemaUrl         @SemacodeUrl                         @Encodes alphanumeric characters (Latin-1) and Bytes
        Code11                @Code-11                             @Encodes numeric data [0..9] and [-]
        Code128               @Code-128                            @Encodes the full ASCII set [0..127]
        Code25IL              @Code-2of5Interleaved                @Encodes numeric data (alias ITF)
        Code39                @Code-39                             @Encodes [0..9 A..Z -.$/+% Space]
        Code39FullASCII       @Code-39FullASCII                    @Encodes the full ASCII set [0..127]
        Code93                @Code-93                             @Encodes [0..9 A..Z -.$/+% Space]
        EAN8                  @EAN-8                               @Enter 7 or 8 digits
        EAN13                 @EAN-13                              @Enter 12 or 13 digits
        Flattermarken         @Flattermarken                       @Encodes numeric data [0..9]
        EANUCC128             @GS1-128(UCC/EAN-128)                @Enter digits and AIs (FNC1 = \F)
        ISBN                  @ISBN                                @Enter 12 + 5 digits
        MSI                   @MSI                                 @Encodes numeric data [0..9]
        OneTrackPharmacode    @PharmacodeOne-Track                 @Encodes numeric [0..9] and generic data
        TwoTrackPharmacode    @PharmacodeTwo-Track                 @Encodes numeric [0..9] and generic data
        TelepenAlpha          @TelepenAlpha                        @Encodes the full ASCII set [0..127]
        UPCA                  @UPC-A                               @Enter 11 or 12 digits
        UPCE                  @UPC-E                               @Enter 7 or 8 digits
        AustralianPost        @AustralianPostStandardCustomer      @Enter 8 digits
        DAFT                  @DAFT                                @Generic code for generating 4-state bar codes (enter D, A, F or T) for US-Postal
        DPD                   @DPDBarcode(DPDParcelLabel)          @Enter data in the following form: (I)PPPPPPPTTTTTTTTTTTTTTSSSCCC I...X or E, P...alphanumeric, T...alphanumeric, S...numeric, C...numeric
        JapanesePostal        @JapanesePostal(Customer)Code        @Enter 7 digits (ZIP) + address code [0..9 A..Z -]
        KIX                   @KIX(TNTPostNetherlands)             @Encodes the full ASCII set [0..127]
        KoreanPostal          @KoreanPostalAuthorityCode           @Enter 6 digits
        PlanetCode12          @PlanetCode12                        @Enter 11 digits
        RoyalMail             @RoyalMail4State                     @Enter [0..9 A..Z]
        PostNet5              @USPSPostNet5                        @Enter 5 digits (ZIP)
        PostNet9              @USPSPostNet9                        @Enter 5 (ZIP) + 4 digits
        PostNet11             @USPSPostNet11                       @Enter 5 (ZIP) + 4 + 2 digits
        USPSOneCode           @USPSOneCode4-StateCustomerBarcode   @Enter 20 digits + 0, 5, 9 or 11 digits (ZIP)
        RSS14                 @GS1-DataBar                         @Enter 13 or 14 digits (GTIN)
        RSS14Stacked          @GS1-DataBarStacked                  @Enter 13 or 14 digits (GTIN)
        RSS14StackedOmni      @GS1-DataBarStackedOmni              @Enter 13 or 14 digits (GTIN)
        RSSLimited            @GS1-DataBarLimited                  @Enter 13 or 14 digits (GTIN)
        RSSExpanded           @GS1-DataBarExpanded                 @Encodes [0..9 A..Z a..z] + ISO646
        RSSExpandedStacked    @GS1-DataBarExpandedStacked          @Encodes [0..9 A..Z a..z] + ISO646
        EAN8CCA               @EAN-8CompositeSymbology             @Enter 7 or 8 digits + | + 2D data
        EAN13CCA              @EAN-13CompositeSymbology            @Enter 12 or 13 digits + | + 2D data
        GS1-128CCA            @GS1-128CompositeSymbology           @Enter digits (with AIs) + | + 2D data
        RSS14CCA              @GS1-DataBarComposite                @Enter 13 or 14 digits (GTIN) + | + 2D data (ISO646)
        RSS14StackedCCA       @GS1-DataBarStackedComposite         @Enter 13 or 14 digits (GTIN) + | + 2D data (ISO646)
        RSS14StackedOmniCCA   @GS1-DataBarStackedOmniComposite     @Enter 13 or 14 digits (GTIN) + | + 2D data (ISO646)
        RSSLimitedCCA         @GS1-DataBarLimitedComposite         @Enter 13 or 14 digits (GTIN) + | + 2D data (ISO646)
        RSSExpandedCCA        @GS1-DataBarExpandedComposite        @Enter alphanumeric data (ISO646) + | + 2D data
        RSSExpandedStackedCCA @GS1-DataBarExpandedStackedComposite @Enter alphanumeric data (ISO646) + | + 2D data
        UPCACCA               @UPC-ACompositeSymbology             @Enter 11 or 12 digits + | + 2D data
        UPCECCA               @UPC-ECompositeSymbology             @Enter 7 or 8 digits + | + 2D data
    )"
return
}

Edit: also added: Can now create all barcodes. More descriptive dropdown list. Description of valid characters for each barcode when selected.
_________________
Scripts - License


Last edited by infogulch on Tue Oct 13, 2009 8:47 pm; edited 3 times in total
Back to top
View user's profile Send private message
imapow



Joined: 13 Mar 2008
Posts: 155
Location: Trøndelag, Norway

PostPosted: Tue Oct 13, 2009 8:32 pm    Post subject: Reply with quote

infogulch wrote:
oh. my. god.
wtf kind of obfuscation is this!?!
Code:
gg = gg
if gg = g%bc%g
    bc = error



im not so good at ahk. just made this one fast to transport smal text to my cellphone

nice uppdate infogulch.

i detected a problem with this new program

WTF?

im not so good at ahk so if enyone have eny idea of wot is wrong...

but thanks infogulch. help is always welcome.
_________________
-._.-¨¯¨-._.-IM@PΩW-._.-¨¯¨-._.-
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 649

PostPosted: Tue Oct 13, 2009 8:34 pm    Post subject: Reply with quote

Sorry about that. I just updated it. Look at my post above to see the changes.
_________________
Scripts - License
Back to top
View user's profile Send private message
imapow



Joined: 13 Mar 2008
Posts: 155
Location: Trøndelag, Norway

PostPosted: Tue Oct 13, 2009 8:45 pm    Post subject: Reply with quote

nice. ty.
_________________
-._.-¨¯¨-._.-IM@PΩW-._.-¨¯¨-._.-
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 649

PostPosted: Tue Oct 13, 2009 8:47 pm    Post subject: Reply with quote

Little fix to encoding, plz redownload.
_________________
Scripts - License
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group