Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/16/2015 in all areas

  1. Hi forum, is possible get/catch all name (and IP) of all printers by 'printers properties' in control panel? Thank you
    1 point
  2. Your code works for me, it prints out fine ... but the test.xlsx book must exist first. What error are you getting? Try this to see if you get an error (and add some error checking in general): $oWorkbook = _Excel_BookOpen($bill, @ScriptDir & "\test.xlsx") if @error then MsgBox("","error",@error)
    1 point
  3. taietel

    3D text

    Modify by your taste: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #Include <File.au3> ;written by taietel ;Example - modify to fit >>YOUR<< needs GUICreate("3D Text", 650, 550) GUISetBkColor(0x996600) $arStyle=StringSplit("u|i|n|u|i|n","|",2) For $i=0 To 5 _3DText("AutoIt - 3D Text", 10, 20+80*$i, -1, -1, 14 + $i*10, "b", $arStyle[$i]) Next GUISetState(@SW_SHOW) While 1 Sleep(10) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Arial") If $iW = -1 Or $iW = Default Then $iW = Int(StringLen($sText)*$iFontSize/1.2) If $iH = -1 Or $iH = Default Then $iH = Int(1.5*$iFontSize) If $iFontSize = -1 Or $iFontSize = Default Then $iFontSize = 14 If $sWeight = -1 Or $sWeight = Default Then $sWeight = "b" If $sStyle = -1 Or $sStyle = Default Then $sStyle = "n" If $sFont = -1 Or $sFont = Default Then $sFont = "Arial" Local $f = 0x111111 Switch $sWeight Case "b" $iWeight = 800 Case "n" $iWeight = 400 EndSwitch Switch $sStyle Case "n" $iStyle = 0 Case "i" $iStyle = 2 Case "u" $iStyle = 4 EndSwitch Local $iZ = $iFontSize/10 For $i=0 To $iZ Step 0.5 GUICtrlCreateLabel($sText, $iX-$i, $iY+$i, $iW, $iH) GUICtrlSetColor(-1,$f*($i+1)/0.5) GUICtrlSetFont(-1, $iFontSize, $iWeight, $iStyle, $sFont) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) Next EndFunc [edit] forgot to clean...
    1 point
  4. Here's a small till-slip printer example using said DLL... #include "..\printMGv2.68.au3" Print() Func Print() Local $pErr Local $Prn = _PrintDllStart($pErr) If $pErr Then MsgBox(0, "_PrintDllStart Error...", "Printer library cannot be initialised!" & @CRLF & @CRLF & _ "Check that the 'printmg.dll' file is present in the same folder as the Cashup program.") Return 0 EndIf Local $sPrinter = "Till_Printer_Name" Local $selPrn = _PrintSelectPrinter($Prn,$sPrinter ) If $selPrn = -1 Then MsgBox(0, "_PrintSelectPrinter Error...", "Printer " & $sPrinter & " cannot be selected!") Return 0 EndIf _PrintSetDocTitle($Prn, "Cashup Till Slip") ; start printing operation _PrintStartPrint($Prn) If @error Then MsgBox(0, "_PrintStartPrint Error...", "Printer cannot be started!", 0, $MainWin) Return 0 EndIf ;_PrintSetFont($Prn,$FontName,$FontSize,$FontCol=0,$Fontstyle = '') ;To check that the text will fit a space use _PrintGetTextHeight and _PrintGetTextWidth ;_PrintText($hDll,$sText,$ix=-1,$iy=-1,$iAngle=0) _PrintText($Prn, "***************************************", 10, 20) _PrintText($Prn, "* *", 10, 60) _PrintText($Prn, "* Eat-All-You_Can Restaurant *", 10, 100) _PrintText($Prn, "* Address Line 1 *", 10, 140) _PrintText($Prn, "* Address Line 2 *", 10, 180) _PrintText($Prn, "* Address Line 3 *", 10, 220) _PrintText($Prn, "* Tel: 555 666 7777 *", 10, 260) _PrintText($Prn, "* Fax: 555 666 7070 *", 10, 300) _PrintText($Prn, "* email: food@eatright.com *", 10, 340) _PrintText($Prn, "* *", 10, 380) _PrintText($Prn, "* Prompt, Quality Service *", 10, 420) _PrintText($Prn, "***************************************", 10, 460) _PrintText($Prn, " ", 10, 500) _PrintText($Prn, "Tx No: " & $pTx & " " & $tD & " " & $tT, 10, 540) _PrintText($Prn, "---------------------------------------", 10, 580) _PrintText($Prn, "Item Qty Price", 10, 620) _PrintText($Prn, "---------------------------------------", 10, 660) _PrintText($Prn, " ", 10, 700) ; print items here ;$pPos += 40 _PrintText($Prn, _StringRepeat(" ", 32) & "-------", 10, $pPos) _PrintText($Prn, _StringRepeat(" ", 21) & "TOTAL " & $sStr, 10, $pPos + 40) _PrintText($Prn, _StringRepeat(" ", 32) & "-------", 10, $pPos + 80) _PrintText($Prn, "***************************************", 10, $pPos + 160) _PrintText($Prn, "* *", 10, $pPos + 200) _PrintText($Prn, "* Thank you for your patronage *", 10, $pPos + 240) _PrintText($Prn, "* ---------------------------- *", 10, $pPos + 280) _PrintText($Prn, "* Have a pleasant day. *", 10, $pPos + 320) _PrintText($Prn, "* *", 10, $pPos + 360) _PrintText($Prn, "***************************************", 10, $pPos + 400) _PrintText($Prn, _StringRepeat(" ", 32), 10, $pPos + 440) _PrintEndPrint($Prn) EndFunc... and that's it
    1 point
  5. I used Martin's PrintMg UDF and DLL to print till slips, and it works beautifully
    1 point
  6. wakillon

    ImageRasterizer

    A little example of Image processing where pixel blocks are replaced by forms of your choice. Don't know if title is really appropriate... Try it and tell me. Downloads available in the download section Use big images (> 1000px) for a better rendering! Example :
    1 point
  7. jchd

    Capitalize words

    No, it doesn't give the right capitalization is some languages. This is more correct: $s = Execute('"' & StringRegExpReplace($s, '(*UCP)(^|\.)(\s*\X)', '$1" & StringUpper("$2") & "') & '"')Note that \X matches any EGC (extended grapheme cluster) regardless of case, so it will invoke StringUpper even for letters or EGC already capitalized contrary to the previous version, but this I regard as a minor inconvenience. This version is still perfectible in that it only recognizes the dot . for end of sentence. But several languages use other symbols instead of dot.
    1 point
  8. dzlee, Can you explain a bit more what exactly you are trying to do. For example, are you looking to set up your own billing system for a restaurant? The more information we have the better we can advise you. M23
    1 point
  9. water

    PPT Quit not executing

    Easiest way to get COM errors is to add the following lines at hte top of your script: #include <Debug.au3> _DebugSetup() _DebugCOMError()You can modify _DebugSetup to direct the output to a file.
    1 point
  10. Hi, dzlee. There are many ways to accomplish what you're after. For simplicity, I would suggest the following: In Excel, find the receipt template that best fits your needs and save it locallyStudy the Excel functions in the help file, which will easily allow you to write to the template.Try these suggestions out, and post your code if you get stuck; we'll be happy to assist.
    1 point
  11. The file contains Null-Chars (a char with the value 0). A text file is ending at this char. So if you handle the file as a text file, the file only gets read until the first Null. But because the file contains text information anyway i would say the file ist corrupt - because a Null-character has no place inside a text file. The solution: Handle the file as a binary file and kill the Null-chars: $hFile = FileOpen("Example.txt", 16) $sFile = StringReplace(BinaryToString(FileRead($hFile)), Chr(0), "", 0, 1) FileClose($hFile) ConsoleWrite($sFile)
    1 point
  12. You have extra closing parenthesis after several column names and missing commas separating them. SQLITE_APERTURA() ; con questa funzione facciopartire sql e apro il db robo_annunci nella script dir ;MsgBox (0,'',$mail) If Not _SQLite_Exec(-1, "INSERT INTO annunci (" & _ "categoria," & _ "sottocategoria," & _ "offro_cerco," & _ "titolo," & _ "prezzo," & _ "descrizione," & _ "path_immagini, " & _ "email, " & _ "nome, " & _ "telefono, " & _ "velocita_macro, " & _ "paypal_sino, " & _ "subito_it, " & _ "kijiji_it, " & _ "secondamano_it, " & _ "bakeca_it, " & _ "comune, " & _ "password, " & _ "indirizzo) " & _ "VALUES (" & _ _SQLite_FastEscape($categoria) & "," & _ _SQLite_FastEscape($sottocategoria) & "," & _ _SQLite_FastEscape($offro_cerco) & "," & _ _SQLite_FastEscape($Titolo) & "," & _ _SQLite_FastEscape($PREZZO_letto) & "," & _ _SQLite_FastEscape($descrizione_letto) & "," & _ _SQLite_FastEscape($percorso_foto) & "," & _ _SQLite_FastEscape($mail) & "," & _ _SQLite_FastEscape($numero_hide) & "," & _ _SQLite_FastEscape($slide_ritardo) & "," & _ _SQLite_FastEscape($paypal_si_no) & "," & _ _SQLite_FastEscape($status_subito_it) & "," & _ _SQLite_FastEscape($status_Kijiji_it) & "," & _ _SQLite_FastEscape($status_secondamano_it) & "," & _ _SQLite_FastEscape($status_Bakeca_it) & "," & _ _SQLite_FastEscape($aItem[7]) & "," & _ ;password _SQLite_FastEscape($aItem[8]) & _ ;indirizzo ");") = $SQLITE_OK Then _ MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) SQLITE_CHIUSURA() ; con questa funzione chiudo il database e shutdown lsqlite FYI, schema names including spaces need to be enclosed in either double quotes "my table", or square brackets [my beautiful table] or backquotes `my last attempt to a smart table`.
    1 point
  13. czardas

    Array in Array

    I think it's partly a design choice. Suppose you intend to Redim the sub-arrays - using a 2D array could turn out to be a nightmare in this case. In most normal cases I would prefer to use a single multidimensional array.
    1 point
  14. BrewManNH

    Array in Array

    ​You generally don't want to do this, as it makes things harder because accessing elements in the internal array isn't as easy to code as accessing 2D array elements.
    1 point
  15. taurus905

    3D text

    Solution: Replace line 150: GUICtrlSetBkColor(-1, "0x"&Hex($Bf,2) & Hex($Gf,2) & Hex($Rf,2)) With: GUICtrlSetBkColor(-1, "0x"&Hex(Int($Bf),2) & Hex(Int($Gf),2) & Hex(Int($Rf),2)) Hopefully someone will see this and it will save them the time I spent trying to track it down. taurus905
    1 point
  16. taietel

    3D text

    I've played with gradients and came up with this splash screen: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> _SplashScreen("Prelucrare grafica a testelor", "Prelucrare Teste", "v1.0", "Copyright 2010 © Mihai Iancu") _Exit() While 1 Sleep(10) Switch GUIGetMsg() Case -3 _Exit() EndSwitch WEnd ; #FUNCTION# ==================================================================================================== ; Name...........: _SplashScreen ; Description....: Create SplashScreen ; Syntax.........: _SplashScreen($sText1="Text Description", $sText2="Text Application",$sText3="Text Version", $sTextCopyright = "Text © Copyright", $iTime=3, $iW=400,$iH=200,$Color = 0xABCDEF) ; Parameters.....: $sText1 - top-left text ; $sText2 - app title (center) text ; $sText3 - subtitle (center) text ; $sTextCopyright - bottom-right text ; $iTime - time (in seconds), [Optional] ; $iW - width of the splash, [Optional] ; $iH - height of the splash, [Optional] ; $Color - the color of the splash, [Optional] ; ; Return values..: one cup of coffee (big one!) ; Author.........: Mihai Iancu (taietel at yahoo dot com) ; =============================================================================================================== Func _SplashScreen($sText1="DEMO Description", $sText2="DEMO Application",$sText3="DEMO Version", $sTextCopyright = "DEMO © Copyright", $iTime=3, $iW=400,$iH=200,$Color = 0x00AA00) If $iW = -1 Or $iW = Default Then $iW = 400 If $iH = -1 Or $iH = Default Then $iH = 200 If $iTime = -1 Or $iTime = Default Then $iTime = 3 If $Color = -1 Or $Color = Default Then $Color = 0xABCDEF Local $hGui = GUICreate("Splash", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED) _Gradient(0x000001, $Color, $iW, $iH,0,0,1) _RoundCorners($hGui) Local $lblSus = GUICtrlCreateLabel($sText1,20,10,$iW/2-40,20) GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0xDDDDDD) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) _3DText($sText2, 10, 60, 380, 52, 34, "b", "n",-1,0x442200) _3DText($sText3, 10, 115, 380, 22, 16, "b", "n","Arial") _Gradient(0xFF0000, 0xFFFF00,($iW-40)/2, 2,20,$iH-40,0) _Gradient(0xFFFF00, 0xFF0000,($iW-40)/2, 2,20++($iW-40)/2,$iH-40,0) GUICtrlCreateLabel($sTextCopyright,20,$iH-30,$iW-40,20,$SS_RIGHT) GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0xeeee00) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlCreatePic("", 2, 2, $iW-4, $iH-4) WinSetTrans($hGui,"",0) GUISetState(@SW_SHOW) For $i=0 To 250 Step 10 Sleep(30) WinSetTrans($hGui,"",$i) Next Sleep($iTime*1000) For $i=250 To 0 Step -10 Sleep(30) WinSetTrans($hGui,"",$i) Next GUIDelete($hGui) EndFunc Func _Exit() Exit EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _RoundCorners ; Description....: Create GUI with rounded corners ; Syntax.........: _RoundCorners($hWnd,$iR) ; Parameters.....: $hWnd - window handle ; $iR - corner radius, [Optional] ; ; Return values..: Success: Nonzero ; Failure: 0 ; ; Author.........: Mihai Iancu (taietel at yahoo dot com) ; =============================================================================================================== Func _RoundCorners($hWnd,$iR=10) Local $x Local $pos = WinGetPos($hWnd) If $pos[2]>$pos[3] Then $x = $pos[2]/$pos[3] Else $x = $pos[3]/$pos[2] EndIf Local $aResult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", 0, "int", 0, "int", $pos[2], "int", $pos[3], _ "int", $iR*$x, "int", $iR*$x) Local $aRet = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hWnd, "handle", $aResult[0], "bool", False) If @error Then Return SetError(@error, @extended, False) Return $aRet[0] EndFunc ;==>_RoundCorners ; #FUNCTION# ==================================================================================================== ; Name...........: _Gradient ; Description....: Create gradient between two colors ; Syntax.........: _Gradient($lColor1, $lColor2, $iW=100, $iH=20, $iX=0, $iY=0, $iDirection=0) ; Parameters.....: $lColor1 - First color to begin with ; $lColor2 - Second color ; $iW - width of the area, [Optional] ; $iH - height of the area, [Optional] ; $iX - position from left, [Optional] ; $iY - position from top, [Optional] ; $iY - direction to fill the gradient, [Optional] ; 0 - vertical fill ; 1 - horizontal fill ; ; Return values..: none ; ; Author.........: Mihai Iancu (taietel at yahoo dot com) ; =============================================================================================================== Func _Gradient($lColor1, $lColor2, $iW=100, $iH=20, $iX=0, $iY=0, $iDirection=0) Local $m, $Ri,$Rf,$Rs,$Gi,$Gf,$Gs,$Bi,$Bf,$Bs Switch $iDirection Case 0 $m = $iW Case 1 $m = $iH EndSwitch $Ri = Mod($lColor1,256) $Gi = BitAND($lColor1/256,255) $Bi = BitAND($lColor1/65536,255) $Rf = Mod($lColor2,256) $Gf = BitAND($lColor2/256,255) $Bf = BitAND($lColor2/65536,255) $Rs = Abs($Ri - $Rf)/$m $Gs = Abs($Gi - $Gf)/$m $Bs = Abs($Bi - $Bf)/$m If $Rf < $Ri Then $Rs = -$Rs If $Gf < $Gi Then $Gs = -$Gs If $Bf < $Bi Then $Bs = -$Bs For $i = 0 To $m $Rf = $Ri + $Rs * $i $Gf = $Gi + $Gs * $i $Bf = $Bi + $Bs * $i GUICtrlCreateLabel(" ", $iX+$i-$i*$iDirection, $iY + $i*$iDirection, 2+$iDirection*$iW, 2+(1-$iDirection)*$iH) GUICtrlSetBkColor(-1, "0x"&Hex($Bf,2) & Hex($Gf,2) & Hex($Rf,2)) GUICtrlSetState(-1,$GUI_DISABLE) Next EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _3DText ; Description....: Create 3D White Text ; Syntax.........: _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Times New Roman") ; Parameters.....: $sText - Text string ; $iX - position from left, [Optional] ; $iY - position from top, [Optional] ; $iW - width of the area, [Optional] ; $iH - height of the area, [Optional] ; $iFontSize - size of the font, [Optional] ; $sWeight - weight of the font, [Optional] ; |b - bold [Default] ; |n - normal ; $sStyle - style of the font, [Optional] ; |n - normal [Default] ; |i - italic ; |u - underline ; $sFont - font used [Optional] ; $lColor - color of text [Optional] ; Return values..: none ; ; Author.........: Mihai Iancu (taietel at yahoo dot com) ; =============================================================================================================== Func _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Times New Roman",$lColor=0xffffff) If $iW = -1 Or $iW = Default Then $iW = Int(StringLen($sText)*$iFontSize/1.2) If $iH = -1 Or $iH = Default Then $iH = Int(1.5*$iFontSize) If $iFontSize = -1 Or $iFontSize = Default Then $iFontSize = 14 If $sWeight = -1 Or $sWeight = Default Then $sWeight = "b" If $sStyle = -1 Or $sStyle = Default Then $sStyle = "n" If $sFont = -1 Or $sFont = Default Then $sFont = "Garamond" Switch $sWeight Case "b" $iWeight = 800 Case "n" $iWeight = 400 EndSwitch Switch $sStyle Case "n" $iStyle = 0 Case "i" $iStyle = 2 Case "u" $iStyle = 4 EndSwitch Local $Ri,$Rf,$Gi,$Gf,$Bi,$Bf $Ri = Mod($lColor,256) $Gi = BitAND($lColor/256,255) $Bi = BitAND($lColor/65536,255) Local $iZ = Int($iFontSize/10) For $i=0 To $iZ Step 0.5 $Rf = $Ri*$i $Gf = $Gi*$i $Bf = $Bi*$i GUICtrlCreateLabel($sText, $iX-$i, $iY+$i, $iW, $iH, $SS_CENTER) GUICtrlSetColor(-1,"0x"&Hex($Bf,2) & Hex($Gf,2) & Hex($Rf,2)) GUICtrlSetFont(-1, $iFontSize, $iWeight, $iStyle, $sFont) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) Next EndFunc
    1 point
×
×
  • Create New...