
Edifice
Active Members-
Posts
91 -
Joined
-
Last visited
Everything posted by Edifice
-
Thanks!
-
Hey Guys. Ran into ar funny problem. I'm parsing some HTML, and I wanted use the " character for stringsplit, to get the path of an image (<img src="c:\locating">). stringsplit($string, ") Ofcourse, the compiler doesn't really like it when I do that, so I wondered if any of you knew whether it was possible, and how?
-
#OnAutoItStartRegister and SQlite_startup()
Edifice replied to Edifice's topic in AutoIt General Help and Support
I'm using newest release 3.3.6.0 This problem is with one of the features in V3.3.6.0 so I cannot understand why you would say it's an old version. -
Hello I thought the new #OnAutoItStartRegister feature was pretty cool, so I decided to use it to initiate SQlite. I found that if you do that, scite will give you an error: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Lasse\Documents\My Dropbox\Programmering\Auto-IT\SQlite.au3" C:\Program Files\AutoIt3\Include\SQLite.au3 (1168) : ==> Variable used without being declared.: If @error Then Return $SQLITE_CORRUPT If @error Then Return ^ ERROR >Exit code: 1 Time: 0.511 Here is the code used: #include <SQLite.au3> #include <SQLite.dll.au3> #OnAutoItStartRegister "program_start" Func program_start() _SQLite_Startup () EndFunc However, if you replace the OnAutoItStartRegister with a regular function call, it works perfectly: #include <SQLite.au3> #include <SQLite.dll.au3> ;#OnAutoItStartRegister "program_start" program_start() Func program_start() _SQLite_Startup () EndFunc Hope someone can use this info for something
-
Hello I've created a program, of which this is a small part: #include <GUIConstantsEx.au3> $mainGUI = GUICreate ("Test", 500, 450) ; Creates GUI-menu $menu = GUICtrlCreateMenu("&Filer") $mntm_save = GUICtrlCreateMenuItem("Gem", $menu) $mntm_open = GUICtrlCreateMenuItem("Åben", $menu) GUICtrlSetState(-1, $GUI_DISABLE) $separator1 = GUICtrlCreateMenuItem("", $menu, 2) $mntm_exit = GUICtrlCreateMenuItem("Luk", $menu) $mntm_functions = GUICtrlCreateMenu("Funktioner", -1, 1) $mntm_usedefaultprinter = GUICtrlCreateMenuItem("Brug Standard Printer", $mntm_functions) $separator2 = GUICtrlCreateMenuItem("", $mntm_functions, 2) $mntm_settings = GUICtrlCreateMenuItem("Indstillinger", $mntm_functions, 1) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd However, I would like the separator line in "Funktioner" to be between "indstillinger" and "Brug standard printer", however I just cannot figure out why it only wants to be at the bottom. It's properly just a small stupid mistake, but I've stared at it all day. Any help is as always greatly appreciated
-
Thanks! This works really great! I wasn't sure how to get to position, and also I didn't try to delete and create the GUI - only show and hide it. Really nicely done. Thanks again.
-
Let's say I have a GUI 500x500 pixels and I have a second GUI that pops up 100x100 pixels. How can I then make the popupGUI always pop "from the center" of my main GUI? Any help is greatly appreciated - I feel like I've tried everything.
-
Reacting to change in input fields?
Edifice replied to Edifice's topic in AutoIt GUI Help and Support
I looked at the post but I had a very hard time understanding how I could fit it onto my script. I guess it looked to confusing and/or complicated. -
Reacting to change in input fields?
Edifice replied to Edifice's topic in AutoIt GUI Help and Support
I'm sorry I didn't find this out myself - Don't think I didn't try. Anyway, this works beautifully! - Thank you very much! -
Reacting to change in input fields?
Edifice replied to Edifice's topic in AutoIt GUI Help and Support
No, It's fine that the user can write something himself. The options are variable stuff that can be executed during a computer repair, however the different ways the mend a computer are almost infinite and that is why the user has to be able to input text himself. The options are merely a help to write and price the most common options. Also writing in the input fields doesn't trigger the calculation I wan't it to. Is there any way to trigger something every time the user types a new character? -
Reacting to change in input fields?
Edifice replied to Edifice's topic in AutoIt GUI Help and Support
Now I got the part with the combo's working. Just hate it when I stare at something for so long I completely miss the obvious error I made Anyway, The GUIGetMsg () approach only got me half of the way - it works great with combo's, except when you write something in them instead of selecting something. And also, it doesn't work at all with regular input fields. Here's the code, try the tab called "Prisoverslag - beta" and you'll properly see what I'm trying to achieve. Hope somebody has the magic trick - btw if you don't have the "printMGv2.au3" file just comment it out. It's only used for printing. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Date.au3> #include <GUIConstants.au3> #include <EditConstants.au3> #include <array.au3> #include <WinAPI.au3> #include <Constants.au3> #include 'printMGv2.au3';the print UDF for printing using printmg.dll Global Const $CBS_DROPDOWNLIST = 0x0003, $RED = 0x0000ff, $GREEN = 0x00ff00, $BLUE = 0xff0000, $BLACK = 0x000000 Dim $app_name = "Indlevering" Dim $client = "ADD-Data " Dim $colors = "Sort|Hvid|Grå|Sølv|Orange|Rød|Gul|Grøn|Blå|Lilla" Dim $brands = "ADD-Data|Gigabyte|Asus|MSI|Toshiba|Clevo|HP|Shuttle|Aopen|Calvin|Acer|Packard Bell|Samsung|Lenovo|IBM|NZXT|Antec|Apevia|Western Digital" Dim $worktypes = "Værkstedstime|Testbegyr|Kort test|" Dim $pris_arbejdstime = "450" Dim $pris_testgebyr = "375" Dim $pris_korttest = "125" Dim $row1 = 30 Dim $row2 = $row1 + 30 Dim $row3 = $row2 + 30 Dim $row4 = $row3 + 30 Dim $row5 = $row4 + 30 Dim $rowheight = 20 Dim $colom1 = 20 Dim $colom2 = $colom1 + 120 Dim $colom3 = $colom2 + 120 Dim $colom4 = $colom3 + 120 Dim $smallcolom1 = 30 Dim $smallcolom2 = $smallcolom1 + 80 Dim $smallcolom3 = $smallcolom2 + 80 Dim $smallcolom4 = $smallcolom3 + 80 Dim $smallcolom5 = $smallcolom4 + 80 Dim $smallcolom6 = $smallcolom5 + 80 Dim $smallcolom7 = $smallcolom6 + 80 Dim $colomwidth = 110 Dim $smallwidth = 70 HotKeySet("{F9}", "iniprint") HotKeySet("{F11}", "clearfields") $mainGUI = GUICreate ($client & $app_name, 500, 450) ; Creates the GUI $clearfields = GUICtrlCreateButton("Ryd alle felter", 140, 420, 100, 25) $button_print = GUICtrlCreateButton("Udskriv", 260, 420, 100, 25) $label_modtager = GUICtrlCreateLabel("Modtager: ", 10, 33, 100, 20, 2) $combo_modtager = GUICtrlCreateCombo("Alf", 110, 30, 70, 20, 0x0103) ; create first item GUICtrlSetData($combo_modtager, "Claus|Lasse|Per|Jacob|Toke") ; add other item $label_navn = GUICtrlCreateLabel("Navn: ", 10, 58, 100, 20, 2) $input_name = GUICtrlCreateInput("", 110, 55, 300, 20, 0) $label_tlfnr = GUICtrlCreateLabel("Telefonnummer: ", 10, 83, 100, 20, 2) $input_phonenumber = GUICtrlCreateInput("", 110, 80, 150, 20, 0x2000) $input_other = GUICtrlCreateInput("", 270, 80, 140, 20, 0) $label_indleveret = GUICtrlCreateLabel("Indleveret produkt: ", 10, 108, 100, 20, 2) $combo_indleveret = GUICtrlCreateCombo("Almindelig PC", 110, 105, 170, 20, $CBS_DROPDOWNLIST) ; create first item GUICtrlSetData($combo_indleveret, "Laptop|Hardware|Andet") ; add other item snd set a new default $chkbx_garanti = GUICtrlCreateCheckbox("Garantireperation", 10, 130, 100, 20) $combo_faknr = GUICtrlCreateCombo("Faktura nr.", 110, 130, 100, 20, 2) ; create first item GUICtrlSetData($combo_faknr, "Ukendt") $hindleveret = GUICreate ("", 500, 180, 0, 180, $WS_POPUP, $WS_EX_MDICHILD, $mainGUI) $hSubTabs = GUICtrlCreateTab (0, 0, 500, 280) $hSubTabPage1 = GUICtrlCreateTabItem ("Beskrivelse") $combo_color1 = GUICtrlCreateCombo("Farve 1", $colom1, $row2, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_color1, $colors) ; add other items $combo_color2 = GUICtrlCreateCombo("Farve 2", $colom2, $row2, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_color2, $colors) ; add other items $combo_color3 = GUICtrlCreateCombo("Farve 3", $colom3, $row2, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_color3, $colors) ; add other items $combo_color4 = GUICtrlCreateCombo("Farve 4", $colom4, $row2, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_color4, $colors) ; add other items $combo_brand = GUICtrlCreateCombo("Mærke", $colom1, $row1, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_brand, $brands) ; add other items $diversebskrvls = GUICtrlCreateInput("", $colom1, $row3, 470, $rowheight) $hSubTabPage2 = GUICtrlCreateTabItem ("Tilbehør") $recoverymedier = GUICtrlCreateCheckbox("Recovery Medier", $colom1, $row1, $colomwidth, $rowheight) $PSU = GUICtrlCreateCheckbox("Strømforsyning", $colom2, $row1, $colomwidth, $rowheight) $taske = GUICtrlCreateCheckbox("Taske", $colom3, $row1, $colomwidth, $rowheight) $memorystick = GUICtrlCreateCheckbox("Memorystick", $colom4, $row1, $colomwidth, $rowheight) $eksternhdd = GUICtrlCreateCheckbox("Ekstern Harddisk", $colom1, $row2, $colomwidth, $rowheight) $eksterndvdrw = GUICtrlCreateCheckbox("Ekstern DVD/RW", $colom2, $row2, $colomwidth, $rowheight) $manual = GUICtrlCreateCheckbox("Manual", $colom3, $row2, $colomwidth, $rowheight) $3gmodem = GUICtrlCreateCheckbox("3G Modem", $colom4, $row2, $colomwidth, $rowheight) $diversetlbhr = GUICtrlCreateInput("", $colom1, $row3, 470, $rowheight) $hSubTabPage3 = GUICtrlCreateTabItem ("Fejlbeskrivelse") $fejlbeskrivelse = GUICtrlCreateInput("", $colom1, $row1, 470, $rowheight) $hSubTabPage4 = GUICtrlCreateTabItem ("Prisoverslag - Beta") $lbl_done = GUICtrlCreateLabel("udføres", $colom1, $row1+15,$colomwidth, $rowheight, 0x01) $combo_work1 = GUICtrlCreateCombo("Udføres", $colom1, $row2, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_work1, $worktypes) ; add other items $combo_work2 = GUICtrlCreateCombo("Udføres", $colom1, $row3, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_work2, $worktypes) ; add other items $combo_work3 = GUICtrlCreateCombo("Udføres", $colom1, $row4, $colomwidth, $rowheight, 0x0102) ; create first item GUICtrlSetData($combo_work3, $worktypes) ; add other items $lbl_antal = GUICtrlCreateLabel("Antal", $colom2, $row1+15,$colomwidth, $rowheight, 0x01) $input_quantity1 = GUICtrlCreateInput("", $colom2, $row2, $colomwidth, $rowheight, 0x2000) $input_quantity2 = GUICtrlCreateInput("", $colom2, $row3, $colomwidth, $rowheight, 0x2000) $input_quantity3 = GUICtrlCreateInput("", $colom2, $row4, $colomwidth, $rowheight, 0x2000) $input_price1 = GUICtrlCreateInput("", $colom4, $row2, $colomwidth, $rowheight, 0x2800) $input_price2 = GUICtrlCreateInput("", $colom4, $row3, $colomwidth, $rowheight, 0x2800) $input_price3 = GUICtrlCreateInput("", $colom4, $row4, $colomwidth, $rowheight, 0x2800) $lbl_af = GUICtrlCreateLabel("Stykpris", $colom3, $row1+15,$colomwidth, $rowheight, 0x01) $input_total = GUICtrlCreateInput("", $colom4, $row5, $colomwidth, $rowheight, 0x2800) $lbl_total = GUICtrlCreateLabel("Total:", $colom3, $row5, $colomwidth, $rowheight, 0x0002) $input_itemprice1 = GUICtrlCreateInput("", $colom3, $row2, $colomwidth, $rowheight, 0x2000) $input_itemprice2 = GUICtrlCreateInput("", $colom3, $row3, $colomwidth, $rowheight, 0x2000) $input_itemprice3 = GUICtrlCreateInput("", $colom3, $row4, $colomwidth, $rowheight, 0x2000) ;~ WinSetTrans($mainGUI,"",210) ;~ WinSetTrans($hindleveret,"",200) GUISetState (@SW_SHOW, $mainGUI) GUISetState (@SW_SHOW, $hindleveret) Func clearfields() GUICtrlSetData($combo_modtager, "Alf") GUICtrlSetData($combo_indleveret, "Almindelig PC") GUICtrlSetData($combo_faknr, "Faktura nr.") GUICtrlSetData($combo_brand, "Mærke") GUICtrlSetData($combo_color1, "Farve 1") GUICtrlSetData($combo_color2, "Farve 2") GUICtrlSetData($combo_color3, "Farve 3") GUICtrlSetData($combo_color4, "Farve 4") GUICtrlSetData($input_name, "") GUICtrlSetData($input_phonenumber, "") GUICtrlSetData($input_other, "") GUICtrlSetState($chkbx_garanti, $GUI_UNCHECKED) GUICtrlSetData($diversebskrvls, "") GUICtrlSetState($recoverymedier, $GUI_UNCHECKED) GUICtrlSetState($PSU, $GUI_UNCHECKED) GUICtrlSetState($taske, $GUI_UNCHECKED) GUICtrlSetState($memorystick,$GUI_UNCHECKED) GUICtrlSetState($eksternhdd, $GUI_UNCHECKED) GUICtrlSetState($eksterndvdrw, $GUI_UNCHECKED) GUICtrlSetState($manual, $GUI_UNCHECKED) GUICtrlSetState($3gmodem , $GUI_UNCHECKED) GUICtrlSetData($diversetlbhr, "") GUICtrlSetData($fejlbeskrivelse, "") EndFunc runprogram() Func runprogram() While 1 $nMsg = GUIGetMsg () Select Case $nMsg = $GUI_EVENT_CLOSE program_exit() Case $nMsg = $button_print iniprint() Case $nMsg = $clearfields clearfields() Case $nMsg = $combo_work1 Select Case GUICtrlRead($combo_work1) = "Værkstedstime" GUICtrlSetData($input_itemprice1, $pris_arbejdstime) Case GUICtrlRead($combo_work1) = "Testbegyr" GUICtrlSetData($input_itemprice1, $pris_testgebyr) Case GUICtrlRead($combo_work1) = "Kort test" GUICtrlSetData($input_itemprice1, $pris_korttest) EndSelect GUICtrlSetData($input_price1, Int(GUICtrlRead($input_itemprice1, 1) * GUICtrlRead($input_quantity1, 1))) GUICtrlSetData($input_total, Int(GUICtrlRead($input_price1, 1) + GUICtrlRead($input_price2, 1) + GUICtrlRead($input_price3, 1))) Case $nMsg = $combo_work2 Select Case GUICtrlRead($combo_work2) = "Værkstedstime" GUICtrlSetData($input_itemprice2, $pris_arbejdstime) Case GUICtrlRead($combo_work2) = "Testbegyr" GUICtrlSetData($input_itemprice2, $pris_testgebyr) Case GUICtrlRead($combo_work2) = "Kort test" GUICtrlSetData($input_itemprice2, $pris_korttest) EndSelect GUICtrlSetData($input_price2, Int(GUICtrlRead($input_itemprice2, 1) * GUICtrlRead($input_quantity2, 1))) GUICtrlSetData($input_total, Int(GUICtrlRead($input_price1, 1) + GUICtrlRead($input_price2, 1) + GUICtrlRead($input_price3, 1))) Case $nMsg = $combo_work3 Select Case GUICtrlRead($combo_work3) = "Værkstedstime" GUICtrlSetData($input_itemprice3, $pris_arbejdstime) Case GUICtrlRead($combo_work3) = "Testbegyr" GUICtrlSetData($input_itemprice3, $pris_testgebyr) Case GUICtrlRead($combo_work3) = "Kort test" GUICtrlSetData($input_itemprice3, $pris_korttest) EndSelect GUICtrlSetData($input_price3, Int(GUICtrlRead($input_itemprice3, 1) * GUICtrlRead($input_quantity3, 1))) GUICtrlSetData($input_total, Int(GUICtrlRead($input_price1, 1) + GUICtrlRead($input_price2, 1) + GUICtrlRead($input_price3, 1))) EndSelect WEnd EndFunc Func iniprint() If GUICtrlRead($input_phonenumber) > 99999999 Or GUICtrlRead($input_phonenumber) < 20000000 Then MsgBox(0, "Fejl", "Telefonnummeret er ikke indtastet korrekt. Venligst udfyld telefonnummeret") Else print() EndIf EndFunc Func accesory() $accesory = "" If GUICtrlread($recoverymedier) = 1 Then $accesory = $accesory & "Recoverymedier, " EndIf If GUICtrlread($PSU) = 1 Then $accesory = $accesory & "Strømforsyning, " EndIf If GUICtrlread($taske) = 1 Then $accesory = $accesory & "Taske, " EndIf If GUICtrlread($memorystick) = 1 Then $accesory = $accesory & "Memorystick, " EndIf If GUICtrlread($eksternhdd) = 1 Then $accesory = $accesory & "Ekstern Harddisk, " EndIf If GUICtrlread($eksterndvdrw) = 1 Then $accesory = $accesory & "Ekstern DVD/RW, " EndIf If GUICtrlread($manual) = 1 Then $accesory = $accesory & "Manualer, " EndIf If GUICtrlread($3gmodem) = 1 Then $accesory = $accesory & "3G Modem, " EndIf Return($accesory) EndFunc Func color() $color = "" If GUICtrlRead($combo_color1, 1) = "Farve 1" OR GUICtrlRead($combo_color1, 1) = "" Then Else $color = $color & GUICtrlRead($combo_color1, 1) & ", " EndIf If GUICtrlRead($combo_color2, 1) = "Farve 2" OR GUICtrlRead($combo_color1, 1) = "" Then Else $color = $color & GUICtrlRead($combo_color2, 1) & ", " EndIf If GUICtrlRead($combo_color3, 1) = "Farve 3" OR GUICtrlRead($combo_color1, 1) = "" Then Else $color = $color & GUICtrlRead($combo_color3, 1) & ", " EndIf If GUICtrlRead($combo_color4, 1) = "Farve 4" OR GUICtrlRead($combo_color1, 1) = "" Then Else $color = $color & GUICtrlRead($combo_color4, 1) EndIf Return($color) EndFunc Func garanti() $garanti = "" If GUICtrlRead($chkbx_garanti) = 1 Then $garanti = "indenfor garanti" Else $garanti = "udenfor garanti" EndIf Return($garanti) EndFunc Func Print() Local $mmssgg,$marginx,$marginy Dim $currenty = 0 Dim $currentx = 0 local $header1 = 25 local $header2 = 17 local $header3 = 13 local $body = 10 local $leftmargin = 25 local $rightmargin = 15 local $topmargin = 15 local $linespacing_small = 1.3 local $linespacing_medium = 1.5 Dim $startpoint = 1 Dim $lenght = 90 Dim $var = 0 Dim $result2 = 1 Dim $empty = "" $hp = _PrintDllStart($mmssgg);this must always be called first if $hp = 0 then consolewrite("Error from dllstart = " & $mmssgg & @CRLF) Exit endif ;choose the printer if you don't want the default printer ;_PrintSetPrinter($hp);see also _PrinterSelectPrinter _PrintPageOrientation($hp,1);set ordinary printing _PrintStartPrint($hp) $pageheight = _PrintGetpageheight($hp) - _PrintGetYOffset($hp) $pagewidth = _PrintGetpageWidth($hp) - _PrintGetXOffset($hp) ; Print headline $currenty = $topmargin $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header1,0,'') $text = "ADD-Data Indlevering" _PrintText($hp,$text, $currentx, $currenty) $textheight = _PrintGetTextHeight($hp,$text) $currenty = $currenty + $textheight ; Print line under headline $currentx = $currentx - 5 $currenty = $currenty - 17 _PrintSetLineWid($hp,2) _PrintSetLineCol($hp,$BLACK) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currentx = $leftmargin ;print "Modtaget af" in the top right corner _PrintSetFont($hp,'Tahoma',$header3,0,'') $currenty = $currenty - 6 $text = "Modtaget af " & GUICtrlRead($combo_modtager, 1) & " d. " & @MDAY & "-" & @MON & "-" & @YEAR & " kl. " & @HOUR & ":" & @MIN $textwidth = _PrintGetTextWidth($hp,$text) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, int($pagewidth - $textwidth - $rightmargin - 20), $currenty) ;Print "kunde informationer" $currenty = $currenty + int($textheight * $linespacing_medium) _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Kunde information" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print customer name $currenty = $currenty + int($textheight * $linespacing_small) $currentx = $currentx * 2 _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Navn: " & GUICtrlRead($input_name, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print Contact information $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Telefonnummer: " & GUICtrlRead($input_phonenumber, 1) & " Anden Kontakt: " & GUICtrlRead($input_other, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print "Produkt informationer" $currenty = $currenty + int($textheight * $linespacing_medium) $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Produkt information" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print customer name and waranty info $currenty = $currenty + int($textheight * $linespacing_small) $currentx = $currentx * 2 _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Indleveret: " & GUICtrlRead($combo_indleveret, 1) & " " & garanti() $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print invoice ID $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Faktura nr: " & GUICtrlRead($combo_faknr, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print "beskrivelse" $currenty = $currenty + int($textheight * $linespacing_small) $currentx = $currentx + $leftmargin _PrintSetFont($hp,'Tahoma',$header3,0,'') $text = "Beskrivelse" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print brand $currenty = $currenty + int($textheight * $linespacing_medium) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Mærke: " & GUICtrlRead($combo_brand) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print color $currenty = $currenty + int($textheight * $linespacing_medium) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Farve: " & color() $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print textfield beneth the colors $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = GUICtrlRead($diversebskrvls, 1) $startpoint = 1 $var = 0 $result2 = 1 while $result2 > 0 $var = StringMid($text, $startpoint, $lenght) $result2 = Stringcompare($var, $empty, 2) $startpoint = $startpoint + $lenght $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$var, $currentx, $currenty) $currenty = $currenty + int($textheight * $linespacing_small) WEnd ;Print list of accesory $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') If accesory() = "" Then $text = "Tilbehør: Intet Tilbehør" Else $text = "Tilbehør: " & accesory() EndIf $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print textfield beneth the accesory $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = GUICtrlRead($diversetlbhr) $startpoint = 1 $var = 0 $result2 = 1 while $result2 > 0 $var = StringMid($text, $startpoint, $lenght) $result2 = Stringcompare($var, $empty, 2) $startpoint = $startpoint + $lenght $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$var, $currentx, $currenty) $currenty = $currenty + int($textheight * $linespacing_small) WEnd ;Print "Fejlbeskrivelse" $currenty = $currenty + int($textheight * $linespacing_medium) $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Fejlbeskrivelse" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print textfield "Fejlbeskrivelse" $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = GUICtrlRead($fejlbeskrivelse) $startpoint = 1 $var = 0 $result2 = 1 while $result2 > 0 $var = StringMid($text, $startpoint, $lenght) $result2 = Stringcompare($var, $empty, 2) $startpoint = $startpoint + $lenght $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$var, $currentx, $currenty) $currenty = $currenty + int($textheight * $linespacing_small) WEnd _PrintNewPage($hp) ; Print headline $currenty = $topmargin $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header1,0,'') $text = "ADD-Data Arbejdsseddel" _PrintText($hp,$text, $currentx, $currenty) $textheight = _PrintGetTextHeight($hp,$text) $currenty = $currenty + $textheight ; Print line under headline $currentx = $currentx - 5 $currenty = $currenty - 17 _PrintSetLineWid($hp,2) _PrintSetLineCol($hp,$BLACK) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currentx = $leftmargin ;print "Modtaget af" in the top right corner _PrintSetFont($hp,'Tahoma',$header3,0,'') $currenty = $currenty - 6 $text = "Modtaget af " & GUICtrlRead($combo_modtager, 1) & " d. " & @MDAY & "-" & @MON & "-" & @YEAR & " kl. " & @HOUR & ":" & @MIN $textwidth = _PrintGetTextWidth($hp,$text) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, int($pagewidth - $textwidth - $rightmargin - 20), $currenty) ;Print "kunde informationer" $currenty = $currenty + int($textheight * $linespacing_medium) _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Kunde information" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print customer name $currenty = $currenty + int($textheight * $linespacing_small) $currentx = $currentx * 2 _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Navn: " & GUICtrlRead($input_name, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print Contact information $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Telefonnummer: " & GUICtrlRead($input_phonenumber, 1) & " Anden Kontakt: " & GUICtrlRead($input_other, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print "Udført arbejde" $currenty = $currenty + int($textheight * $linespacing_medium) $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Udført arbejde" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print "Pris" $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Pris" $textwidth = _PrintGetTextWidth($hp,$text) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, int($pagewidth - $textwidth - $rightmargin - 20), $currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,1700,$currenty - $textheight,1700,$pageheight - 50) ; Print line under headline $currentx = $currentx - 5 _PrintSetLineWid($hp,2) _PrintSetLineCol($hp,$BLACK) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currentx = $leftmargin $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currenty = $currenty + int($textheight) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) ;Print "Total" $currenty = $currenty + int($textheight * $linespacing_medium) $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Total" $textheight = _PrintGetTextHeight($hp,$text) $textwidth = _PrintGetTextWidth($hp,$text) _PrintText($hp,$text, 1700 - $textwidth - 20, $currenty - 100) _PrintEndPrint($hp) _printDllClose($hp) EndFunc Func program_exit() Exit EndFunc -
Reacting to change in input fields?
Edifice replied to Edifice's topic in AutoIt GUI Help and Support
This worked really well. Thanks Anyway, I wondered if you, or someone else for that matter, knew why is piece of code is not putting data into my input field? Case $nMsg = $combo_work1 Select Case $combo_work1 = "Udføres" Case $combo_work1 = "Værkstedstime" GUICtrlSetData($input_itemprice1, "450") Case $combo_work1 = "Testbegyr" GUICtrlSetData($input_itemprice1, "375") Case $combo_work1 = "Kort test" GUICtrlSetData($input_itemprice1, "125") EndSelect GUICtrlSetData($input_price1, Int(GUICtrlRead($input_itemprice1, 1) * GUICtrlRead($input_quantity1, 1))) -
Hello I have this program in which I need to calculate a price of something. This is easily done, however I don't want to calculate the price in the GUI, coz that would be a huge waste of CPU to calculate it 1000 times each second. Is there some kind of method to know and react to change in dropdown menues? Example: User changes value of dropdown / writes own value in an input field. Then, and only then, will the function be called that does the calculating.
-
Okay, and one last n00bie thing. How do I get combo and dropdown menus to the default state. The SetData will just add stuff to them?
-
Okay I just did that to all my GUI stuff, just one problem: The command clears the text from the checkboxes but not the fact that they are checked. How do I make sure they are all unchecked?
-
Arhh of course! - The Setdata It's been a while since I've Auto-itted - amazing how much one forgets Thanks man!
-
Hello, I have made this GUI that can print the content of the inputfields onto a piece of paper. The user might want to do this twice, with different data, without restarting the program. Is there any way to reset or empty them all at once? #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Date.au3> #include <GUIConstants.au3> #include <EditConstants.au3> #include <array.au3> #include <WinAPI.au3> #include <Constants.au3> #include 'printMGv2.au3';the print UDF for printing using printmg.dll Global Const $CBS_DROPDOWNLIST = 0x0003, $RED = 0x0000ff, $GREEN = 0x00ff00, $BLUE = 0xff0000, $BLACK = 0x000000 Dim $app_name = "Indlevering" Dim $client = "ADD-Data " Dim $row1 = 30 Dim $row2 = $row1 + 30 Dim $row3 = $row2 + 30 Dim $row4 = $row3 + 30 Dim $row5 = $row4 + 30 Dim $rowheight = 20 Dim $colom1 = 20 Dim $colom2 = $colom1 + 120 Dim $colom3 = $colom2 + 120 Dim $colom4 = $colom3 + 120 Dim $smallcolom1 = 30 Dim $smallcolom2 = $smallcolom1 + 80 Dim $smallcolom3 = $smallcolom2 + 80 Dim $smallcolom4 = $smallcolom3 + 80 Dim $smallcolom5 = $smallcolom4 + 80 Dim $smallcolom6 = $smallcolom5 + 80 Dim $smallcolom7 = $smallcolom6 + 80 Dim $colomwidth = 110 Dim $smallwidth = 70 $mainGUI = GUICreate ($client & $app_name, 500, 350) $clearfields = GUICtrlCreateButton("Ryd alle felter", 200, 10, 100, 25) $udskriv = GUICtrlCreateButton("Udskriv", 200, 300, 100, 25) $label_modtager = GUICtrlCreateLabel("Modtager: ", 10, 33, 100, 20, 2) $combo_modtager = GUICtrlCreateCombo("Alf", 110, 30, 70, 20, $CBS_DROPDOWNLIST) ; create first item GUICtrlSetData($combo_modtager, "Claus|Lasse|Per|Jacob|Toke") ; add other item $label_navn = GUICtrlCreateLabel("Navn: ", 10, 58, 100, 20, 2) $input_name = GUICtrlCreateInput("", 110, 55, 300, 20, 0) $label_tlfnr = GUICtrlCreateLabel("Telefonnummer: ", 10, 83, 100, 20, 2) $input_phonenumber = GUICtrlCreateInput("", 110, 80, 150, 20, 0) $input_other = GUICtrlCreateInput("", 270, 80, 140, 20, 0) $label_indleveret = GUICtrlCreateLabel("Indleveret produkt: ", 10, 108, 100, 20, 2) $combo_indleveret = GUICtrlCreateCombo("Almindelig PC", 110, 105, 170, 20, $CBS_DROPDOWNLIST) ; create first item GUICtrlSetData($combo_indleveret, "Laptop|Hardware|Andet") ; add other item snd set a new default $chkbx_garanti = GUICtrlCreateCheckbox("Garantireperation", 10, 130, 100, 20) $combo_faknr = GUICtrlCreateCombo("Faktura nr.", 110, 130, 100, 20, 2) ; create first item GUICtrlSetData($combo_faknr, "Ukendt") ; add other item snd set a new default $hindleveret = GUICreate ("", 500, 130, 0, 180, $WS_POPUP, $WS_EX_MDICHILD, $mainGUI) $hSubTabs = GUICtrlCreateTab (0, 0, 500, 280) $hSubTabPage1 = GUICtrlCreateTabItem ("Beskrivelse") $check_color_black = GUICtrlCreateCheckbox("Sort", $smallcolom1, $row1, $smallwidth, $rowheight) $check_color_silver = GUICtrlCreateCheckbox("Sølv", $smallcolom2, $row1, $smallwidth, $rowheight) $check_color_blue = GUICtrlCreateCheckbox("Blå", $smallcolom3, $row1, $smallwidth, $rowheight) $check_color_yellow = GUICtrlCreateCheckbox("Gul", $smallcolom4, $row1, $smallwidth, $rowheight) $check_color_green = GUICtrlCreateCheckbox("Grøn", $smallcolom5, $row1, $smallwidth, $rowheight) $check_color_red = GUICtrlCreateCheckbox("Rød", $smallcolom6, $row1, $smallwidth, $rowheight) $combo_brand = GUICtrlCreateCombo("Mærke", $colom1, $row2, $colomwidth, $rowheight, 2) ; create first item GUICtrlSetData($combo_brand, "Asus|MSI|Toshiba|Clevo|HP|Shuttle|Aopen|Calvin|Acer|Packard Bell|Samsung|Lenovo|IBM|NZXT|Antec|Apevia|Western Digital") ; add other item snd set a new default $diversebskrvls = GUICtrlCreateInput("", $colom1, $row3, 450, $rowheight) $hSubTabPage2 = GUICtrlCreateTabItem ("Tilbehør") $recoverymedier = GUICtrlCreateCheckbox("Recovery Medier", $colom1, $row1, $colomwidth, $rowheight) $PSU = GUICtrlCreateCheckbox("Strømforsyning", $colom2, $row1, $colomwidth, $rowheight) $taske = GUICtrlCreateCheckbox("Taske", $colom3, $row1, $colomwidth, $rowheight) $memorystick = GUICtrlCreateCheckbox("Memorystick", $colom4, $row1, $colomwidth, $rowheight) $eksternhdd = GUICtrlCreateCheckbox("Ekstern Harddisk", $colom1, $row2, $colomwidth, $rowheight) $eksterndvdrw = GUICtrlCreateCheckbox("Ekstern DVD/RW", $colom2, $row2, $colomwidth, $rowheight) $manual = GUICtrlCreateCheckbox("Manual", $colom3, $row2, $colomwidth, $rowheight) $3gmodem = GUICtrlCreateCheckbox("3G Modem", $colom4, $row2, $colomwidth, $rowheight) $diversetlbhr = GUICtrlCreateInput("", $colom1, $row3, 450, $rowheight) $hSubTabPage3 = GUICtrlCreateTabItem ("Fejlbeskrivelse") $fejlbeskrivelse = GUICtrlCreateInput("", $colom1, $row1, 450, $rowheight) GUISetState (@SW_SHOW, $mainGUI) GUISetState (@SW_SHOW, $hindleveret) runprogram() Func runprogram() While 1 $nMsg = GUIGetMsg () Select Case $nMsg = $GUI_EVENT_CLOSE program_exit() Case $nMsg = $udskriv ;If GUICtrlRead($input_phonenumber) > 99999999 Or GUICtrlRead($input_phonenumber) < 20000000 Then ; MsgBox(0, "Fejl", "Telefonnummeret er ikke indtastet korrekt! Venligst udfyld telefonnummeret") ;Else print() ;EndIf Case $nMsg = $clearfields clearfields() EndSelect WEnd EndFunc Func accesory() $accesory = "" If GUICtrlread($recoverymedier) = 1 Then $accesory = $accesory & "Recoverymedier, " EndIf If GUICtrlread($PSU) = 1 Then $accesory = $accesory & "Strømforsyning, " EndIf If GUICtrlread($taske) = 1 Then $accesory = $accesory & "Taske, " EndIf If GUICtrlread($memorystick) = 1 Then $accesory = $accesory & "Memorystick, " EndIf If GUICtrlread($eksternhdd) = 1 Then $accesory = $accesory & "Ekstern Harddisk, " EndIf If GUICtrlread($eksterndvdrw) = 1 Then $accesory = $accesory & "Ekstern DVD/RW, " EndIf If GUICtrlread($manual) = 1 Then $accesory = $accesory & "Manualer, " EndIf If GUICtrlread($3gmodem) = 1 Then $accesory = $accesory & "3G Modem, " EndIf Return($accesory) EndFunc Func color() $color = "" If GUICtrlread($check_color_black) = 1 Then $color = $color & "Sort, " EndIf If GUICtrlread($check_color_blue) = 1 Then $color = $color & "Blå, " EndIf IF GUICtrlread($check_color_green) = 1 Then $color = $color & "Grøn, " EndIf If GUICtrlread($check_color_red) = 1 Then $color = $color & "Rød, " EndIf IF GUICtrlread($check_color_silver) = 1 Then $color = $color & "Sølv, " EndIf If GUICtrlread($check_color_yellow) = 1 Then $color = $color & "Gul" EndIf Return($color) EndFunc Func garanti() $garanti = "" If GUICtrlRead($chkbx_garanti) = 1 Then $garanti = "indenfor garanti" Else $garanti = "undenfor garanti" EndIf Return($garanti) EndFunc Func Print() Local $mmssgg,$marginx,$marginy Dim $currenty = 0 Dim $currentx = 0 local $header1 = 25 local $header2 = 17 local $header3 = 13 local $body = 10 local $leftmargin = 25 local $rightmargin = 15 local $topmargin = 15 local $linespacing_small = 1.3 local $linespacing_medium = 1.5 Dim $startpoint = 1 Dim $lenght = 90 Dim $var = 0 Dim $result2 = 1 Dim $empty = "" $hp = _PrintDllStart($mmssgg);this must always be called first if $hp = 0 then consolewrite("Error from dllstart = " & $mmssgg & @CRLF) Exit endif ;choose the printer if you don't want the default printer ;_PrintSetPrinter($hp);see also _PrinterSelectPrinter _PrintPageOrientation($hp,1);set ordinary printing _PrintStartPrint($hp) $pageheight = _PrintGetpageheight($hp) - _PrintGetYOffset($hp) $pagewidth = _PrintGetpageWidth($hp) - _PrintGetXOffset($hp) ; Print headline $currenty = $topmargin $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header1,0,'') $text = "ADD-Data Indlevering" _PrintText($hp,$text, $currentx, $currenty) $textheight = _PrintGetTextHeight($hp,$text) $currenty = $currenty + $textheight ; Print line under headline $currentx = $currentx - 5 $currenty = $currenty - 17 _PrintSetLineWid($hp,2) _PrintSetLineCol($hp,$BLACK) _PrintLine($hp,$currentx, $currenty,int($pagewidth - $currentx - $rightmargin),$currenty) $currentx = $leftmargin ;print "Modtaget af" in the top right corner _PrintSetFont($hp,'Tahoma',$header3,0,'') $currenty = $currenty - 6 $text = "Modtaget af " & GUICtrlRead($combo_modtager, 1) & " d. " & @MDAY & "-" & @MON & "-" & @YEAR & " kl. " & @HOUR & ":" & @MIN $textwidth = _PrintGetTextWidth($hp,$text) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, int($pagewidth - $textwidth - $rightmargin - 20), $currenty) ;Print "kunde informationer" $currenty = $currenty + int($textheight * $linespacing_medium) _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Kunde information" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print customer name $currenty = $currenty + int($textheight * $linespacing_small) $currentx = $currentx * 2 _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Navn: " & GUICtrlRead($input_name, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print Contact information $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Telefonnummer: " & GUICtrlRead($input_phonenumber, 1) & " Anden Kontakt: " & GUICtrlRead($input_other, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print "Produkt informationer" $currenty = $currenty + int($textheight * $linespacing_medium) $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Produkt information" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print customer name and waranty info $currenty = $currenty + int($textheight * $linespacing_small) $currentx = $currentx * 2 _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Indleveret: " & GUICtrlRead($combo_indleveret, 1) & " " & garanti() $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print invoice ID $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Faktura nr: " & GUICtrlRead($combo_faknr, 1) $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print "beskrivelse" $currenty = $currenty + int($textheight * $linespacing_small) $currentx = $currentx + $leftmargin _PrintSetFont($hp,'Tahoma',$header3,0,'') $text = "Beskrivelse" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print color $currenty = $currenty + int($textheight * $linespacing_medium) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Farve: " & color() $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print textfield beneth the colors $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = GUICtrlRead($diversebskrvls, 1) $startpoint = 1 $var = 0 $result2 = 1 while $result2 > 0 $var = StringMid($text, $startpoint, $lenght) $result2 = Stringcompare($var, $empty, 2) $startpoint = $startpoint + $lenght $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$var, $currentx, $currenty) $currenty = $currenty + int($textheight * $linespacing_small) WEnd ;Print list of accesory $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = "Tilbehør: " & accesory() $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print textfield beneth the accesory $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = GUICtrlRead($diversetlbhr) $startpoint = 1 $var = 0 $result2 = 1 while $result2 > 0 $var = StringMid($text, $startpoint, $lenght) $result2 = Stringcompare($var, $empty, 2) $startpoint = $startpoint + $lenght $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$var, $currentx, $currenty) $currenty = $currenty + int($textheight * $linespacing_small) WEnd ;Print "Fejlbeskrivelse" $currenty = $currenty + int($textheight * $linespacing_medium) $currentx = $leftmargin _PrintSetFont($hp,'Tahoma',$header2,0,'') $text = "Fejlbeskrivelse" $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$text, $currentx, $currenty) ;Print textfield "Fejlbeskrivelse" $currenty = $currenty + int($textheight * $linespacing_small) _PrintSetFont($hp,'Tahoma',$body,0,'') $text = GUICtrlRead($fejlbeskrivelse) $startpoint = 1 $var = 0 $result2 = 1 while $result2 > 0 $var = StringMid($text, $startpoint, $lenght) $result2 = Stringcompare($var, $empty, 2) $startpoint = $startpoint + $lenght $textheight = _PrintGetTextHeight($hp,$text) _PrintText($hp,$var, $currentx, $currenty) $currenty = $currenty + int($textheight * $linespacing_small) WEnd _PrintEndPrint($hp) _printDllClose($hp) program_exit() EndFunc Func program_exit() Exit EndFunc
-
It will help in the way that the string is chopped up into pieces that fit to an A4 page (83 letters). Then the idea is to print the text and move printcoordinates down one line for the next piece of string. -> Repeat. you can feed any string into this and it will come out as 83 letters long strings until nothing remains in the main string.
-
I am currently working on a function (It's just a hobby and I'm working kinda slow.) This is what I have so far: Dim $startpoint = 1 Dim $lenght = 83 Dim $text = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789" Dim $line = "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123" Dim $var = 0 Dim $result = stringcompare($text, $line, 2) Dim $result2 = 1 Dim $empty = "" If $result > 0 Then while $result2 > 0 $var = StringMid($text, $startpoint, $lenght) $result2 = Stringcompare($var, $empty, 2) If $result2 > 0 Then MsgBox(0, "Chopping up text into lines", $var) EndIf $startpoint = $startpoint + 83 ;Print $var onto paper ;Move one line down WEnd EndIf I would be very glad if you could incorporate it into the rest, otherwise I will just send you an example when I finish it (I'm hoping to be able to progress a bit faster during the next few weeks)
-
I am kinda stuck now. Is there any way to restrict a _PrintLine to a specific width and then insert newlines down the page if it's too wide? - Or some kinda _Printtextbox or something? Edit: Sorry for bad quote - please read very carefully to understand fully
-
Hello Just wanna say I think this is really great, and I hope these functions will be fully integrated in auto-it (as include). Anyway, I found a small bug - When I press "Cancel" to a print, the printer still prints it? And, I would like to know if there is any kind of documentation of the calls you can make and parametres that they can be called with?
-
Better late than never: Thanks guys! Really helped me out!
-
Got a bit of dissapointment as I mis-read the helpfile, and thought I could prevent users from checking the checkbox by flagging it with $ES_READONLY as I discovered this flag only covers input controls. Any other way to do this?
-
Thanks for the help guys!
-
Hello I think GUICtrlCreateInput is very limited as to the formatting of the text. Although I don't need all that much formatting (nor do I want it) I would like to be able to create new-lines via the "Enter" key. Is this possible? Bonus info: How will it be shown after I save it in SQLite and bring it back again?