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.