Jump to content

GUI beginner attempt, cash register


Recommended Posts

 

Can you tell me the sequence when I wanna close some GUI, should it be first @sw_hide or @sw_disable, and does the @sw_disable delete the variables previously entered?

P.S. When I put coca cola, and do coca cola again, it types "product 8" instead of price...

P.P.S. Is that GUI parenting really necessary?$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI

I mean, can't I do everything with < sw_hide/show > and < sw_disable/enable >?

1) There isn't any type of order. It's all about how you want it to look like.

@sw_hide will hide from view, whereas @sw_disable keeps it visable the whole time just wont let you interact with it. @sw_disable does not delete the variable.  It just disables the control.

 

 

P.P.S. Is that GUI parenting really necessary?

2) It greatly helps.  Why you might ask.  Because it temporarily disables the parent window ($GUI_1) and gives focus to the child ($GUI_2).

The last thing you would want is someone selecting a product then the Price/QTY window pops up and then someone select another product. You don't want the option of selecting any other product while the Price/QTY window is showing.  That could get very confusing...

 

-touch screen input

If you are using a touch screen monitor then I suppose you have already accomplish that.

 

Also, here is a very crude way of doing some of the things you need.

#include <GUIConstantsEx.au3>
Local $TotalPrice
$GUI_1 = GUICreate("Products", 1600, 890, Default, Default) ;==> draws GUI
GUISetBkColor(0xFF3399)
GUISetFont(14, 400, "", "Comic Sans MS")
$ware_1 = GUICtrlCreateButton("Coca-Cola", 10, 10, 275, 100)
$ware_2 = GUICtrlCreateButton("Pizza Funghi", 10, 120, 275, 100)
$ware_3 = GUICtrlCreateButton("Lasagne Bolognese", 10, 230, 275, 100)
$ware_4 = GUICtrlCreateButton("Ice cream - ball", 10, 340, 275, 100)
$ware_5 = GUICtrlCreateButton("Room - 2 beds", 10, 450, 275, 100)
$ware_6 = GUICtrlCreateButton("Lunch - menu 1", 10, 560, 275, 100)
$ware_7 = GUICtrlCreateButton("Product 7", 10, 670, 275, 100)
$ware_8 = GUICtrlCreateButton("Product 8", 10, 780, 275, 100)

$ware_9 = GUICtrlCreateButton("Product 9", 295, 10, 275, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 295, 120, 275, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 295, 230, 275, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 295, 340, 275, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 295, 450, 275, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 295, 560, 275, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 295, 670, 275, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 295, 780, 275, 100)

$ware_17 = GUICtrlCreateButton("Product 17", 580, 10, 275, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 580, 120, 275, 100)
$ware_19 = GUICtrlCreateButton("Product 19", 580, 230, 275, 100)
$ware_20 = GUICtrlCreateButton("Product 20", 580, 340, 275, 100)
$ware_21 = GUICtrlCreateButton("Product 21", 580, 450, 275, 100)
$ware_22 = GUICtrlCreateButton("Product 22", 580, 560, 275, 100)
$ware_23 = GUICtrlCreateButton("Product 23", 580, 670, 275, 100)
$ware_24 = GUICtrlCreateButton("Product 24", 580, 780, 275, 100)

$ware_25 = GUICtrlCreateButton("Product 25", 865, 10, 275, 100)
$ware_26 = GUICtrlCreateButton("Product 26", 865, 120, 275, 100)
$ware_27 = GUICtrlCreateButton("Product 27", 865, 230, 275, 100)
$ware_28 = GUICtrlCreateButton("Product 28", 865, 340, 275, 100)
$ware_29 = GUICtrlCreateButton("Product 29", 865, 450, 275, 100)
$ware_30 = GUICtrlCreateButton("Product 30", 865, 560, 275, 100)
$ware_31 = GUICtrlCreateButton("Product 31", 865, 670, 275, 100)
$ware_32 = GUICtrlCreateButton("Product 32", 865, 780, 275, 100)

$ware_33 = GUICtrlCreateButton("Product 33", 1150, 10, 275, 100)
$ware_34 = GUICtrlCreateButton("Product 34", 1150, 120, 275, 100)
$ware_35 = GUICtrlCreateButton("Product 35", 1150, 230, 275, 100)
$ware_36 = GUICtrlCreateButton("Product 36", 1150, 340, 275, 100)
$ware_37 = GUICtrlCreateButton("Product 37", 1150, 450, 275, 100)
$ware_38 = GUICtrlCreateButton("Product 38", 1150, 560, 275, 100)
$ware_39 = GUICtrlCreateButton("Product 39", 1150, 670, 275, 100)
$ware_40 = GUICtrlCreateButton("Product 40", 1150, 780, 275, 100)

$Finish = GUICtrlCreateButton("Finish", 1435, 10, 155, 870)

Run("Notepad.exe") ;     Using notepad for scripting, coz notepad opens fastest. Will be MS Word or MS Excel template at the end with pre-entered info (company, date, operator), or similar program.
WinWaitActive("[CLASS:Notepad]")
#cs Send ("Company: Samsong, Owner: Mickey Mouse")
    Send ("{ENTER}")
    Send ("Adress: Lady Gaga street, tax number: 007, country: Virgin Islands")
    Send ("{ENTER}")
    Send ("Time: 00:00:01, date: Friday, 13.")
    Send ("{ENTER}")
    Send ("Operator: Waiter 3, Donald Duck")
    Send ("{ENTER 3}")
    Send ("Products:")
    Send ("{TAB}")
    Send ("Quantity:")
    Send ("{TAB}")
    Send ("Single peace price:")
    Send ("{TAB}")
    Send ("Price (Quantity * Single peace price")
#ce Send ("{ENTER 3}")

GUISetState()

$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default, -1, -1, $GUI_1) ;==> draws GUI
GUISetBkColor(0xFF3399)
$quantity_ware_1 = GUICtrlCreateInput("Enter quantity", 20, 150, 450, 150)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 30, 400)
$price_ware_1 = GUICtrlCreateInput("Enter price", 490, 150, 450, 150)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 30, 400)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 100)
GUICtrlSetFont(-1, 30, 800)
GUICtrlCreateLabel("Price:", 490, 20, 450, 100)
GUICtrlSetFont(-1, 30, 800)
$GUI_2_OK = GUICtrlCreateButton("OK", 20, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x66FF33)
$GUI_2_BACK = GUICtrlCreateButton("BACK", 490, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0xFFFF00)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If WinActive($GUI_1) Then Exit
            If WinActive($GUI_2) Then
                GUISetState(@SW_HIDE, $GUI_2)
                GUISetState(@SW_ENABLE, $GUI_1)
                WinActivate($GUI_1)
            EndIf
        Case $ware_1
            GUISetState(@SW_DISABLE, $GUI_1)
            GUICtrlSetData($price_ware_1, "Enter price")
            GUICtrlSetData($quantity_ware_1, "Enter quantity")
            GUISetState(@SW_SHOW, $GUI_2)
        Case $GUI_2_OK
            GUISetState(@SW_HIDE, $GUI_2)
            WinActivate("Untitled - Notepad")
            Send(GUICtrlRead($ware_1) & "{TAB 2}" & Round(GUICtrlRead($quantity_ware_1), 2) & "{TAB 2}" & GUICtrlRead($price_ware_1) & @LF); Try this instead.
            $TotalPrice = $TotalPrice + Round(GUICtrlRead($quantity_ware_1), 2) * GUICtrlRead($price_ware_1)
            GUISetState(@SW_ENABLE, $GUI_1)
        Case $GUI_2_BACK
            GUISetState(@SW_HIDE, $GUI_2)
            GUISetState(@SW_ENABLE, $GUI_1)
            WinActivate($GUI_1)
        Case $Finish
            GUIDelete($GUI_1)
            GUIDelete($GUI_2)
            WinActivate("Untitled - Notepad")
            Send("Total price (Sum of all prices): " & $TotalPrice)
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

If you are using a touch screen monitor then I suppose you have already accomplish that.

 

 

No, I dont have it yet, but I will buy it.

 

I want to make it pure touch screen script, so that keyboard and mouse are not needed at all, and for example, now I still have to type numbers for quantity, price, bla bla, and probobly click "print" in MS office when a bill is finished.

So I will later try to make another GUI, GUI_3 which will be open at the same time as GUI_2, and it should look like a numpad.

I drew it here, so you can see exactly what I mean:

http://postimg.org/image/auls0fvhj/

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

Ok, I made some changes, put the numpad in gui 2, here is the script:

#include <GUIConstantsEx.au3>
Global $colors_1 = 0x00FF00
Global $colors_2 = 0xFFFF00



;GUI_1:
$GUI_1 = GUICreate("Products", 1600, 890, Default, Default) ;==> draws GUI
GUISetBkColor(0x000000)
GUISetFont(14, 400, "", "Comic Sans MS")


;GUI_1_inputs
$ware_1 = GUICtrlCreateButton("Coca-Cola", 10, 10, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_2 = GUICtrlCreateButton("Pizza Funghi", 10, 120, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_3 = GUICtrlCreateButton("Lasagne Bolognese", 10, 230, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_4 = GUICtrlCreateButton("Ice cream - ball", 10, 340, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_5 = GUICtrlCreateButton("Room - 2 beds", 10, 450, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_6 = GUICtrlCreateButton("Lunch - menu 1", 10, 560, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_7 = GUICtrlCreateButton("Product 7", 10, 670, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_8 = GUICtrlCreateButton("Product 8", 10, 780, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_9 = GUICtrlCreateButton("Product 9", 295, 10, 275, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 295, 120, 275, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 295, 230, 275, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 295, 340, 275, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 295, 450, 275, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 295, 560, 275, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 295, 670, 275, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 295, 780, 275, 100)

$ware_17 = GUICtrlCreateButton("Product 17", 580, 10, 275, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 580, 120, 275, 100)
$ware_19 = GUICtrlCreateButton("Product 19", 580, 230, 275, 100)
$ware_20 = GUICtrlCreateButton("Product 20", 580, 340, 275, 100)
$ware_21 = GUICtrlCreateButton("Product 21", 580, 450, 275, 100)
$ware_22 = GUICtrlCreateButton("Product 22", 580, 560, 275, 100)
$ware_23 = GUICtrlCreateButton("Product 23", 580, 670, 275, 100)
$ware_24 = GUICtrlCreateButton("Product 24", 580, 780, 275, 100)

$ware_25 = GUICtrlCreateButton("Product 25", 865, 10, 275, 100)
$ware_26 = GUICtrlCreateButton("Product 26", 865, 120, 275, 100)
$ware_27 = GUICtrlCreateButton("Product 27", 865, 230, 275, 100)
$ware_28 = GUICtrlCreateButton("Product 28", 865, 340, 275, 100)
$ware_29 = GUICtrlCreateButton("Product 29", 865, 450, 275, 100)
$ware_30 = GUICtrlCreateButton("Product 30", 865, 560, 275, 100)
$ware_31 = GUICtrlCreateButton("Product 31", 865, 670, 275, 100)
$ware_32 = GUICtrlCreateButton("Product 32", 865, 780, 275, 100)

$ware_33 = GUICtrlCreateButton("Product 33", 1150, 10, 275, 100)
$ware_34 = GUICtrlCreateButton("Product 34", 1150, 120, 275, 100)
$ware_35 = GUICtrlCreateButton("Product 35", 1150, 230, 275, 100)
$ware_36 = GUICtrlCreateButton("Product 36", 1150, 340, 275, 100)
$ware_37 = GUICtrlCreateButton("Product 37", 1150, 450, 275, 100)
$ware_38 = GUICtrlCreateButton("Product 38", 1150, 560, 275, 100)
$ware_39 = GUICtrlCreateButton("Product 39", 1150, 670, 275, 100)
$ware_40 = GUICtrlCreateButton("Product 40", 1150, 780, 275, 100)

$Finish = GUICtrlCreateButton("Finish", 1435, 10, 155, 870)

Run("Notepad.exe") ;     Using notepad for scripting, coz notepad opens fastest. Will be MS Word or MS Excel template at the end with pre-entered info (company, date, operator), or similar program.
WinWaitActive("[CLASS:Notepad]")
#cs Send ("Company: Samsong, Owner: Mickey Mouse")
    Send ("{ENTER}")
    Send ("Adress: Lady Gaga street, tax number: 007, country: Virgin Islands")
    Send ("{ENTER}")
    Send ("Time: 00:00:01, date: Friday, 13.")
    Send ("{ENTER}")
    Send ("Operator: Waiter 3, Donald Duck")
    Send ("{ENTER 3}")
    Send ("Products:")
    Send ("{TAB}")
    Send ("Quantity:")
    Send ("{TAB}")
    Send ("Single peace price:")
    Send ("{TAB}")
    Send ("Price (Quantity * Single peace price")
#ce Send ("{ENTER 3}")

GUISetState()



;GUI_2:
$GUI_2 = GUICreate("Quantity", 1600, 600, Default, Default, -1, -1, $GUI_1) ;==> draws GUI
GUISetBkColor(0x000000)


;GUI_2_labels:
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)

GUICtrlCreateLabel("Price:", 490, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)


;GUI_2_buttons:
$GUI_2_OK = GUICtrlCreateButton("OK", 20, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_BACK = GUICtrlCreateButton("BACK", 490, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_7 = GUICtrlCreateButton("7", 1000, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_8 = GUICtrlCreateButton("8", 1160, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_9 = GUICtrlCreateButton("9", 1320, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_4 = GUICtrlCreateButton("4", 1000, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_5 = GUICtrlCreateButton("5", 1160, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_6 = GUICtrlCreateButton("6", 1320, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_1 = GUICtrlCreateButton("1", 1000, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_2 = GUICtrlCreateButton("2", 1160, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_3 = GUICtrlCreateButton("3", 1320, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_1 = GUICtrlCreateButton("0", 1000, 490, 230, 100)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_comma = GUICtrlCreateButton(",", 1240, 490, 230, 100)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)


;GUI_2_inputs:

$quantity_ware_1 = GUICtrlCreateInput("Enter quantity", 20, 150, 450, 150)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 30, 400)

$price_ware_1 = GUICtrlCreateInput("Enter price", 490, 150, 450, 150)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 30, 400)






While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If WinActive($GUI_1) Then Exit
            If WinActive($GUI_2) Then
                GUISetState(@SW_HIDE, $GUI_2)
                GUISetState(@SW_ENABLE, $GUI_1)
                WinActivate($GUI_1)
            EndIf
        Case $ware_1
            GUISetState(@SW_DISABLE, $GUI_1)
            GUISetState(@SW_SHOW, $GUI_2)
                Switch GUIGetMsg()
                    Case $GUI_2_7
                        Send ("{7}")
                EndSwitch
        Case $GUI_2_OK
            GUISetState(@SW_HIDE, $GUI_2)
;   $ware_1_end = GUICtrlRead($ware_1)
;   If you set $ware_1 to the value of $ware_1 then it will always be true. That means the 'Case $ware_1' statement listed above will always execute once triggered.
;   $quantity_ware_1_end = GUICtrlRead($quantity_ware_1)
;   $price_ware_1_end = GUICtrlRead($price_ware_1)
            WinActivate("Untitled - Notepad")
;   Send ($ware_1_end & "{TAB}" & $quantity_ware_1_end & "{TAB}" & $price_ware_1_end)
;   $ware_1 will not be used this way.
            Send(GUICtrlRead($ware_1) & "{TAB 2}" & GUICtrlRead($quantity_ware_1) & "{TAB 2}" & GUICtrlRead($price_ware_1) & "{ENTER}"); Try this instead.
            Sleep(1000)
            GUISetState(@SW_HIDE, $GUI_2)
;   GUISetState(@SW_DISABLE,$GUI_2)Coca-Cola    2       Product 8Coca-Cola  2       Product 8
;   Nowhere in your code does it enable $GUI_2.  Because of this, there is no way to interact with it once disabled. Simply hiding it will do just fine.
            GUISetState(@SW_ENABLE, $GUI_1)
            WinActivate ($GUI_1)
        Case $GUI_2_BACK
            GUISetState(@SW_HIDE, $GUI_2)
            GUISetState(@SW_ENABLE, $GUI_1)
            WinActivate($GUI_1)
        Case $Finish
            GUISetState(@SW_HIDE, $GUI_2)
            GUISetState(@SW_DISABLE, $GUI_2)
            GUISetState(@SW_HIDE, $GUI_1)
            GUISetState(@SW_DISABLE, $GUI_1)

            Send("Total price (Sum of all prices:")
    EndSwitch
WEnd

But can't realise why these lines don't work:

Switch GUIGetMsg()
    Case $GUI_2_7
        Send ("{7}")

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

I had troubles with decimal point, because excel takes only a comma, as decimal, and I need a point for "thousand separators", here's what I did on this experiment:

$var1 = Inputbox ("", "")
$var2 = Inputbox ("", "")
Local $text1 = StringReplace($var1, ",", ".")
Local $text2 = StringReplace($var2, ",", ".")
$sum = $text1 * $text2
Local $sumnew = StringReplace($sum, ".", ",")
MsgBox (0, "", $sumnew)

Is there a faster way?

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

 

But can't realise why these lines don't work:

Switch GUIGetMsg()
     Case $GUI_2_7
         Send ("{7}")

That's because you are sending it to the button. (at that very moment the button has focus because you just clicked on it)

The problem I see is you have two controls you need to interact with.

; For Quantity.
ControlFocus("[Title:Quantity]", "", "[CLASS:Edit; INSTANCE:1]")
ControlSend("[Title:Quantity]", "", "[CLASS:Edit; INSTANCE:1]", "7")

; For Price.
ControlFocus("[Title:Quantity]", "", "[CLASS:Edit; INSTANCE:2]")
ControlSend("[Title:Quantity]", "", "[CLASS:Edit; INSTANCE:2]", "7")
Edited by NewPlaza
Link to comment
Share on other sites

Is it possible to make a database in autoit? I mean, to enter items and quantites, and they being remembered after I close the program or turn off pc?

And also, how to make a custom template which I could form my way, when I'm printing bills or so?

I've been using an Open Office calc (similar to excel) but was wondering how to make a custom one?

P.S. It should be "offline from the internet"...

Edited by CroatianPig

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

I made the GUI with 2 buttons, and the script closes instantly when I run it:

GUISetState()

While 1
    $msg_1 = GUIGetMsg()
        If $msg_1 = $GUI_1_start then Exit
            Exit
        If $msg_1 = $GUI_1_exit then Exit
            Exit
WEnd

Can someone tell me the logic why it instantly closes before I even can click on one of those?

Maybe the question is stupid and trivial, but I dont understand.

 

P.S. Ok, I figured that if I "circle" that loop with a "switch" loop, it works then.... 

Is it because it then endlessly repeats the loop inside, and it results by showing the GUI?

Edited by CroatianPig

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

If I make an array that consists of random number of elements, with what function could I manipulate them when I use "send", like putting "enter" or "tab" between each of them as they are being "sent" in a line they were entered?

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

Wh would you want to use Send at all for what you're making?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Wh would you want to use Send at all for what you're making?

 

Emm, because I need the program to enter all those wares, quantites and prices when the program ends, to an excel template.

Ok I will put a script to show you what I did today.

; Script Start - Add your code below here

#include <GUIConstantsEx.au3>
Global $colors_green = 0x00FF00
Global $colors_yellow = 0xFFFF00
Global $colors_red = 0xFF0000
Global $colors_black = 0x000000



;GUI_1:
$GUI_1= GUICreate("BEN", 400, 300, Default, Default) ;==> draws GUI
GUISetBkColor(0x000000)
GUISetFont(14, 400, "", "Cambria")

;GUI_1_buttons:
$GUI_1_start= GUICtrlCreateButton("Ulaz", 20, 25, 360, 120)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetBkColor(-1, $colors_green)

$GUI_1_exit= GUICtrlCreateButton("Izlaz", 20, 155, 360, 120)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetBkColor(-1, $colors_yellow)



GUISetState()



;GUI_2:
$GUI_2= GUICreate("Izbornik", 1800, 900, Default, Default, $GUI_1)
GUISetBkColor($colors_black)
GUISetFont(14, 400, "", "Cambria")

;GUI_2_labels:
GUICtrlCreateLabel("I", 200, 10, 450, 100)
GUICtrlSetFont(-1, 16, 800)
GUICtrlSetColor(-1, $colors_green)

GUICtrlCreateLabel("Wares", 45, 60, 450, 50)
GUICtrlSetFont(-1, 12, 800)
GUICtrlSetColor(-1, $colors_green)

GUICtrlCreateLabel("Prices", 350, 60, 450, 50)
GUICtrlSetFont(-1, 12, 800)
GUICtrlSetColor(-1, $colors_green)

;GUICtrlCreateLabel("2:", 490, 20, 450, 100)
;GUICtrlSetFont(-1, 20, 800)
;GUICtrlSetColor(-1, $colors_green)

;GUI_2_combos+inputs:
Global $checkbox_1 = GUICtrlCreateCheckbox("", 10, 105, 20, 20)
Global $item_1 = GUICtrlCreateCombo("1", 40, 100, 300, Default) ; create first item
GUICtrlSetData(-1, "2|3|4|5|6|7|8|", "1") ; add other item snd set a new default
GUICtrlSetFont(-1, 12, 600)
Global $quantity_1= GUICtrlCreateInput( '', 345, 100, 160, 31)
GUICtrlSetLimit(-1,10)
GUICtrlSetFont(-1, 12, 600)


;GUI_2_buttons:
$finish = GUICtrlCreateButton("Kraj", 40, 740, 1720, 80)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If WinActive($GUI_1) Then Exit
            If WinActive($GUI_2) Then
                GUISetState(@SW_HIDE, $GUI_2)
                GUISetState(@SW_SHOW, $GUI_1)
                WinActivate($GUI_1)
            ;If WinActive($GUI_3)
                ;GUISetState(@SW_HIDE, $GUI_3)
                ;GUISetState(@SW_HIDE, $GUI_2)
                ;GUISetState(@SW_ENABLE, $GUI_1)
            EndIf
        Case $GUI_1_start
            GUISetState(@SW_HIDE, $GUI_1)
            GUISetState(@SW_SHOW, $GUI_2)
            WinActivate($GUI_2)
        Case $GUI_1_exit
            Exit
        Case $finish
            $exit_confirm= MsgBox(4, "Potvrdi kraj", "Ispis računa?")
            Switch $exit_confirm
                Case $exit_confirm = 6
                    Exit
                Case $exit_confirm = 7
                    Exit
            EndSwitch
            Exit
    EndSwitch
WEnd

But look at the last lines, if I choose not to finish the bill, because I missclicked or so, how to return to the program and to the line where it showed GUI 2 for the first time?

Oh, and btw, Aleichi Shalom. 

Didn't see the letters till now.

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

There's an Excel UDF that can do that instead of using Send which is very unreliable.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

There's an Excel UDF that can do that instead of using Send which is very unreliable.

 

Is there something similar for the Open office Calc?

Btw, here's the previous script, which I gave up because I realised I will pee blood, so it can be clear what I made. I will upload the template I used also.

#include <GUIConstantsEx.au3>
Global $colors_1 = 0x00FF00
Global $colors_2 = 0xFFFF00


;GUI_1:
$GUI_1 = GUICreate("Products", 1600, 890, Default, Default) ;==> draws GUI
GUISetBkColor(0x000000)
GUISetFont(14, 400, "", "Cambria")


;GUI_1_inputs
$ware_1 = GUICtrlCreateButton("Obuća ženska", 10, 10, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_2 = GUICtrlCreateButton("Pizza Funghi", 10, 120, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_3 = GUICtrlCreateButton("Lasagne Bolognese", 10, 230, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_4 = GUICtrlCreateButton("Ice cream - ball", 10, 340, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_5 = GUICtrlCreateButton("Room - 2 beds", 10, 450, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_6 = GUICtrlCreateButton("Lunch - menu 1", 10, 560, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_7 = GUICtrlCreateButton("Product 7", 10, 670, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_8 = GUICtrlCreateButton("Product 8", 10, 780, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_9 = GUICtrlCreateButton("Product 9", 295, 10, 275, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 295, 120, 275, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 295, 230, 275, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 295, 340, 275, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 295, 450, 275, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 295, 560, 275, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 295, 670, 275, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 295, 780, 275, 100)

$ware_17 = GUICtrlCreateButton("Product 17", 580, 10, 275, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 580, 120, 275, 100)
$ware_19 = GUICtrlCreateButton("Product 19", 580, 230, 275, 100)
$ware_20 = GUICtrlCreateButton("Product 20", 580, 340, 275, 100)
$ware_21 = GUICtrlCreateButton("Product 21", 580, 450, 275, 100)
$ware_22 = GUICtrlCreateButton("Product 22", 580, 560, 275, 100)
$ware_23 = GUICtrlCreateButton("Product 23", 580, 670, 275, 100)
$ware_24 = GUICtrlCreateButton("Product 24", 580, 780, 275, 100)

$ware_25 = GUICtrlCreateButton("Product 25", 865, 10, 275, 100)
$ware_26 = GUICtrlCreateButton("Product 26", 865, 120, 275, 100)
$ware_27 = GUICtrlCreateButton("Product 27", 865, 230, 275, 100)
$ware_28 = GUICtrlCreateButton("Product 28", 865, 340, 275, 100)
$ware_29 = GUICtrlCreateButton("Product 29", 865, 450, 275, 100)
$ware_30 = GUICtrlCreateButton("Product 30", 865, 560, 275, 100)
$ware_31 = GUICtrlCreateButton("Product 31", 865, 670, 275, 100)
$ware_32 = GUICtrlCreateButton("Product 32", 865, 780, 275, 100)

$ware_33 = GUICtrlCreateButton("Product 33", 1150, 10, 275, 100)
$ware_34 = GUICtrlCreateButton("Product 34", 1150, 120, 275, 100)
$ware_35 = GUICtrlCreateButton("Product 35", 1150, 230, 275, 100)
$ware_36 = GUICtrlCreateButton("Product 36", 1150, 340, 275, 100)
$ware_37 = GUICtrlCreateButton("Product 37", 1150, 450, 275, 100)
$ware_38 = GUICtrlCreateButton("Product 38", 1150, 560, 275, 100)
$ware_39 = GUICtrlCreateButton("Product 39", 1150, 670, 275, 100)
$ware_40 = GUICtrlCreateButton("Product 40", 1150, 780, 275, 100)

$Finish = GUICtrlCreateButton("Finish", 1435, 10, 155, 870)

Run ("C:\Program Files (x86)\OpenOffice.org 3\program\scalc.exe") ;     Using notepad for scripting, coz notepad opens fastest. Will be MS Word or MS Excel template at the end with pre-entered info (company, date, operator), or similar program.
WinWaitActive ("Untitled 1 - OpenOffice.org Calc")  ; winwaitactive ("[CLASS:Notepad]")
$broj_racuna = InputBox("Broj računa", "Unesi broj računa", "")
Send("{ALT}" & "{F}")
Sleep(100)
Send("{DOWN}")
Send("{ENTER}")
WinWaitActive("Open")
Send("BEN Template")
Sleep(400)
Send("{ENTER}")
WinWaitActive ("BEN Template.ods - OpenOffice.org Calc")
Sleep(200)
Send("{PGUP 4}" & "{HOME 3}")
MouseMove(765, 195, 0)
MouseClick("left")
Send($broj_racuna)
Send("{ENTER}")
MouseMove(80, 525, 0)
MouseClick("left")


#cs Send ("Company: Samsong, Owner: Mickey Mouse")
    Send ("{ENTER}")
    Send ("Adress: Lady Gaga street, tax number: 007, country: Virgin Islands")
    Send ("{ENTER}")
    Send ("Time: 00:00:01, date: Friday, 13.")
    Send ("{ENTER}")
    Send ("Operator: Waiter 3, Donald Duck")
    Send ("{ENTER 3}")
    Send ("Products:")
    Send ("{TAB}")
    Send ("Quantity:")
    Send ("{TAB}")
    Send ("Single peace price:")
    Send ("{TAB}")
    Send ("Price (Quantity * Single peace price")
#ce Send ("{ENTER 3}")

GUISetState()



;GUI_2:
$GUI_2 = GUICreate("Quantity", 1600, 600, Default, Default, -1, -1, $GUI_1) ;==> draws GUI
GUISetBkColor(0x000000)
GUISetFont(14, 400, "", "Cambria")


;GUI_2_labels:
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)

GUICtrlCreateLabel("Price:", 490, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)


;GUI_2_buttons:
$GUI_2_OK = GUICtrlCreateButton("OK", 20, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_BACK = GUICtrlCreateButton("BACK", 490, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_7 = GUICtrlCreateButton("7", 1000, 10, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_8 = GUICtrlCreateButton("8", 1160, 10, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_9 = GUICtrlCreateButton("9", 1320, 10, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_4 = GUICtrlCreateButton("4", 1000, 170, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_5 = GUICtrlCreateButton("5", 1160, 170, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_6 = GUICtrlCreateButton("6", 1320, 170, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_1 = GUICtrlCreateButton("1", 1000, 330, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_2 = GUICtrlCreateButton("2", 1160, 330, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_3 = GUICtrlCreateButton("3", 1320, 330, 150, 150)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_1 = GUICtrlCreateButton("0", 1000, 490, 230, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_point = GUICtrlCreateButton(",", 1240, 490, 230, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetBkColor(-1, $colors_2)


;GUI_2_inputs:

;$quantity_ware_1 = GUICtrlCreateInput("", 20, 150, 450, 150)
;GUICtrlSetLimit(-1, 10)
;GUICtrlSetFont(-1, 30, 400)

;$price_ware_1 = GUICtrlCreateInput("", 490, 150, 450, 150)
;GUICtrlSetLimit(-1, 10)
;GUICtrlSetFont(-1, 30, 400)






While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If WinActive($GUI_1) Then Exit
            If WinActive($GUI_2) Then
                GUISetState(@SW_HIDE, $GUI_2)
                GUISetState(@SW_ENABLE, $GUI_1)
                WinActivate($GUI_1)
            EndIf
        Case $ware_1
            GUISetState(@SW_DISABLE, $GUI_1)

            $quantity_ware_1 = InputBox ("Količina", "Unesi količinu", "")
            $quantity_ware_1_excel = StringReplace($quantity_ware_1, ".", ",")

            $price_ware_1 = InputBox ("Cijena", "Unesi cijenu", "")
            $price_ware_1_excel = StringReplace($price_ware_1, ".", ",")

            ;GUISetState(@SW_SHOW, $GUI_2)
                ;Switch GUIGetMsg()
                    ;Case $GUI_2_7
                        ;Send ("{7}")
                ;EndSwitch
        ;Case $GUI_2_OK
            ;GUISetState(@SW_HIDE, $GUI_2)
;   $ware_1_end = GUICtrlRead($ware_1)
;   If you set $ware_1 to the value of $ware_1 then it will always be true. That means the 'Case $ware_1' statement listed above will always execute once triggered.
;   $quantity_ware_1_end = GUICtrlRead($quantity_ware_1)
;   $price_ware_1_end = GUICtrlRead($price_ware_1)
            WinActivate("Ben.ods - OpenOffice.org Calc")
            Sleep(400)
            $quantity_ware_1_comma = StringReplace($quantity_ware_1, ",", ".")
            $price_ware_1_comma = StringReplace($price_ware_1, ",", ".")
            $Total_price_ware_1 = ($quantity_ware_1_comma) * ($price_ware_1_comma)
            $Total_price_ware_1_excel = StringReplace($Total_price_ware_1, ".", ",")
            Local $redni_broj = InputBox ("Unesite redni broj", "Redni broj:", "", "", 500, 300)
            Send ($redni_broj & "{TAB }" & "000000" & "{TAB}" & GUICtrlRead($ware_1) & "{TAB }" & $quantity_ware_1_excel & "{TAB}" & "kom" & "{TAB}")
            Send ($price_ware_1_excel & "{TAB 2}" & $price_ware_1_excel & "{TAB }" & $Total_price_ware_1_excel & "{ENTER}")
            Sleep(1000)
            ;GUISetState(@SW_HIDE, $GUI_2)
            GUISetState(@SW_ENABLE, $GUI_1)
            WinActivate ($GUI_1)
        ;Case $GUI_2_BACK
            ;GUISetState(@SW_HIDE, $GUI_2)
            ;GUISetState(@SW_ENABLE, $GUI_1)
            ;WinActivate($GUI_1)
        Case $Finish
            ;GUISetState(@SW_HIDE, $GUI_2)
            ;GUISetState(@SW_DISABLE, $GUI_2)
            GUISetState(@SW_HIDE, $GUI_1)
            GUISetState(@SW_DISABLE, $GUI_1)
            ;Send ("{PGUP 4}" & "{HOME 3}")
            ;MouseMove(890, 440, 0)
            ;MouseClick("left")
            ;Send("{ENTER}" & "{TAB 6}" & "Sveukupno Kn:" & "{TAB 2}"
            ;Send ("{ENTER}" & "{TAB 7}" & $Total_price)
            ;Send("Total price (Sum of all prices:" & $Total_price)
            $save_or_not = MsgBox(4, "Spremanje dokumenta", "Spremiti račun pod brojem: " & $broj_racuna)

    EndSwitch
WEnd

And here is the file (I removed the names):

http://speedy.sh/nVcGB/For-upload.ods

The big thing is the overall sum.

Look what I had to do with mouse, so many shi** so it runs as stable as possible.

And overall, imo, it looks like s***.

Key is to acciheve I can put a product, let's say, Coca cola on the same bill, but with possible different price on the row below that or so, which means I can't save Coca cola as a variable.

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

I believe there is an OOo Calc UDF floating around the example scripts section. I can't say anything about how well it works because I don't use Calc.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I believe there is an OOo Calc UDF floating around the example scripts section. I can't say anything about how well it works because I don't use Calc.

 

Ok, but how could I make an array of a number of elements that are not fixed...

For example, a bill can have 2 rows only, but also 40.

If I would put for example an array with 200 elements, the problem is that it would print all 200, and all "zero-s" after the last product.

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

Hey CroatianPig,

I liked your orignal code so I played with it and came up with this.

It's a bit rough but should do nicely.  You can alway add and/or improve it... :idiot:

#include <GUIConstantsEx.au3>
Global $colors_1 = 0x00FF00
Global $colors_2 = 0xFFFF00



;GUI_1:
$GUI_1 = GUICreate("Products", 1600, 890, Default, Default) ;==> draws GUI
GUISetBkColor(0x000000)
GUISetFont(14, 400, "", "Comic Sans MS")


;GUI_1_inputs
$ware_1 = GUICtrlCreateButton("Coca-Cola", 10, 10, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_2 = GUICtrlCreateButton("Pizza Funghi", 10, 120, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_3 = GUICtrlCreateButton("Lasagne Bolognese", 10, 230, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_4 = GUICtrlCreateButton("Ice cream - ball", 10, 340, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_5 = GUICtrlCreateButton("Room - 2 beds", 10, 450, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_6 = GUICtrlCreateButton("Lunch - menu 1", 10, 560, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_7 = GUICtrlCreateButton("Product 7", 10, 670, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_8 = GUICtrlCreateButton("Product 8", 10, 780, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_9 = GUICtrlCreateButton("Product 9", 295, 10, 275, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 295, 120, 275, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 295, 230, 275, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 295, 340, 275, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 295, 450, 275, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 295, 560, 275, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 295, 670, 275, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 295, 780, 275, 100)

$ware_17 = GUICtrlCreateButton("Product 17", 580, 10, 275, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 580, 120, 275, 100)
$ware_19 = GUICtrlCreateButton("Product 19", 580, 230, 275, 100)
$ware_20 = GUICtrlCreateButton("Product 20", 580, 340, 275, 100)
$ware_21 = GUICtrlCreateButton("Product 21", 580, 450, 275, 100)
$ware_22 = GUICtrlCreateButton("Product 22", 580, 560, 275, 100)
$ware_23 = GUICtrlCreateButton("Product 23", 580, 670, 275, 100)
$ware_24 = GUICtrlCreateButton("Product 24", 580, 780, 275, 100)

$ware_25 = GUICtrlCreateButton("Product 25", 865, 10, 275, 100)
$ware_26 = GUICtrlCreateButton("Product 26", 865, 120, 275, 100)
$ware_27 = GUICtrlCreateButton("Product 27", 865, 230, 275, 100)
$ware_28 = GUICtrlCreateButton("Product 28", 865, 340, 275, 100)
$ware_29 = GUICtrlCreateButton("Product 29", 865, 450, 275, 100)
$ware_30 = GUICtrlCreateButton("Product 30", 865, 560, 275, 100)
$ware_31 = GUICtrlCreateButton("Product 31", 865, 670, 275, 100)
$ware_32 = GUICtrlCreateButton("Product 32", 865, 780, 275, 100)

$ware_33 = GUICtrlCreateButton("Product 33", 1150, 10, 275, 100)
$ware_34 = GUICtrlCreateButton("Product 34", 1150, 120, 275, 100)
$ware_35 = GUICtrlCreateButton("Product 35", 1150, 230, 275, 100)
$ware_36 = GUICtrlCreateButton("Product 36", 1150, 340, 275, 100)
$ware_37 = GUICtrlCreateButton("Product 37", 1150, 450, 275, 100)
$ware_38 = GUICtrlCreateButton("Product 38", 1150, 560, 275, 100)
$ware_39 = GUICtrlCreateButton("Product 39", 1150, 670, 275, 100)
$ware_40 = GUICtrlCreateButton("Product 40", 1150, 780, 275, 100)

$Finish = GUICtrlCreateButton("Finish", 1435, 10, 155, 870)

Run("Notepad.exe") ;     Using notepad for scripting, coz notepad opens fastest. Will be MS Word or MS Excel template at the end with pre-entered info (company, date, operator), or similar program.
;~ WinWaitActive("[CLASS:Notepad]")
#cs Send ("Company: Samsong, Owner: Mickey Mouse")
    Send ("{ENTER}")
    Send ("Adress: Lady Gaga street, tax number: 007, country: Virgin Islands")
    Send ("{ENTER}")
    Send ("Time: 00:00:01, date: Friday, 13.")
    Send ("{ENTER}")
    Send ("Operator: Waiter 3, Donald Duck")
    Send ("{ENTER 3}")
    Send ("Products:")
    Send ("{TAB}")
    Send ("Quantity:")
    Send ("{TAB}")
    Send ("Single peace price:")
    Send ("{TAB}")
    Send ("Price (Quantity * Single peace price")
#ce Send ("{ENTER 3}")

GUISetState()



;GUI_2:
$GUI_2 = GUICreate("Quantity", 1600, 600, Default, Default, -1, -1, $GUI_1) ;==> draws GUI
GUISetBkColor(0x000000)


;GUI_2_labels:
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)


GUICtrlCreateLabel("Price:", 490, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)


;GUI_2_buttons:
$GUI_2_OK = GUICtrlCreateButton("OK", 20, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_BACK = GUICtrlCreateButton("BACK", 490, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_7 = GUICtrlCreateButton("7", 1000, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_8 = GUICtrlCreateButton("8", 1160, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_9 = GUICtrlCreateButton("9", 1320, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_4 = GUICtrlCreateButton("4", 1000, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_5 = GUICtrlCreateButton("5", 1160, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_6 = GUICtrlCreateButton("6", 1320, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_1 = GUICtrlCreateButton("1", 1000, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_2 = GUICtrlCreateButton("2", 1160, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_3 = GUICtrlCreateButton("3", 1320, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_0 = GUICtrlCreateButton("0", 1000, 490, 230, 100)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_comma = GUICtrlCreateButton(",", 1240, 490, 230, 100)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)


;GUI_2_inputs:

$quantity_ware_1 = GUICtrlCreateInput("Touch here to enter quantity", 20, 150, 450, 150, 0x0001 + 0x0004)
GUICtrlSetLimit($quantity_ware_1, 10)
GUICtrlSetFont($quantity_ware_1, 30, 400)


$price_ware_1 = GUICtrlCreateInput("Touch here to enter price", 490, 150, 450, 150, 0x0001 + 0x0004)
GUICtrlSetLimit($price_ware_1, 10)
GUICtrlSetFont($price_ware_1, 30, 400)







While 1

     If ControlGetFocus("[Title:Quantity]", "Touch here to enter quantity") = "Edit1" Then
         GUICtrlSetData($quantity_ware_1, "")
         GUICtrlSetData($price_ware_1, "Touch here to enter price")
     ElseIf ControlGetFocus("[Title:Quantity]", "Touch here to enter price") = "Edit2" Then
         GUICtrlSetData($price_ware_1, "")
         If GUICtrlRead($quantity_ware_1) = "" Then GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
     EndIf
     If ControlGetFocus("[Title:Quantity]", GUICtrlRead($quantity_ware_1)) = "Edit1" And Not ControlGetFocus("[Title:Quantity]", "Touch here to enter price") = "Edit2" Then
         GUICtrlSetData($quantity_ware_1, "")
         GUICtrlSetData($price_ware_1, "Touch here to enter price")
     EndIf

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If WinActive($GUI_1) Then Exit
            If WinActive($GUI_2) Then
                GUISetState(@SW_HIDE, $GUI_2)
                GUISetState(@SW_ENABLE, $GUI_1)
                WinActivate($GUI_1)
            EndIf


        Case $ware_1
            GUISetState(@SW_DISABLE, $GUI_1)
            GUISetState(@SW_SHOW, $GUI_2)

            Case $GUI_2_7
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "7", 1)
                Else
                    GUICtrlSetData($price_ware_1, "7", 1)
                EndIf

            Case $GUI_2_8
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "8", 1)
                Else
                    GUICtrlSetData($price_ware_1, "8", 1)
                EndIf

            Case $GUI_2_9
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "9", 1)
                Else
                    GUICtrlSetData($price_ware_1, "9", 1)
                EndIf

            Case $GUI_2_4
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "4", 1)
                Else
                    GUICtrlSetData($price_ware_1, "4", 1)
                EndIf

            Case $GUI_2_5
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "5", 1)
                Else
                    GUICtrlSetData($price_ware_1, "5", 1)
                EndIf

            Case $GUI_2_6
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "6", 1)
                Else
                    GUICtrlSetData($price_ware_1, "6", 1)
                EndIf

            Case $GUI_2_1
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "1", 1)
                Else
                    GUICtrlSetData($price_ware_1, "1", 1)
                EndIf

            Case $GUI_2_2
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "2", 1)
                Else
                    GUICtrlSetData($price_ware_1, "2", 1)
                EndIf

            Case $GUI_2_3
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "3", 1)
                Else
                    GUICtrlSetData($price_ware_1, "3", 1)
                EndIf

            Case $GUI_2_0
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "0", 1)
                Else
                    GUICtrlSetData($price_ware_1, "0", 1)
                EndIf

            Case $GUI_2_comma
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, ".", 1); * Change to comma if you need it.
                Else
                    GUICtrlSetData($price_ware_1, ".", 1); * Change to comma if you need it.
                EndIf



        Case $GUI_2_OK
            If GUICtrlRead($quantity_ware_1) = "" Or GUICtrlRead($quantity_ware_1) = "Touch here to enter quantity" Or GUICtrlRead($price_ware_1) = "" Or GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                GUICtrlSetData($quantity_ware_1, "ERROR")
                GUICtrlSetData($price_ware_1, "ERROR")
                Sleep(1000)
                GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
                GUICtrlSetData($price_ware_1, "Touch here to enter price")
            Else
                GUISetState(@SW_HIDE, $GUI_2)
                WinActivate("Untitled - Notepad")
                Send(GUICtrlRead($ware_1) & "{TAB 2}" & GUICtrlRead($quantity_ware_1) & "{TAB 2}" & GUICtrlRead($price_ware_1) & "{ENTER}")
                Sleep(1000)
                GUISetState(@SW_HIDE, $GUI_2)
                GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
                GUICtrlSetData($price_ware_1, "Touch here to enter price")
                GUISetState(@SW_ENABLE, $GUI_1)
                WinActivate ($GUI_1)
            EndIf


        Case $GUI_2_BACK
            GUISetState(@SW_HIDE, $GUI_2)
            GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
            GUICtrlSetData($price_ware_1, "Touch here to enter price")
            GUISetState(@SW_ENABLE, $GUI_1)
            WinActivate($GUI_1)

        Case $Finish
            GUISetState(@SW_HIDE, $GUI_2)
            GUISetState(@SW_DISABLE, $GUI_2)
            GUISetState(@SW_HIDE, $GUI_1)
            GUISetState(@SW_DISABLE, $GUI_1)

            Send("Total price (Sum of all prices:")
    EndSwitch
WEnd
Link to comment
Share on other sites

 

Hey CroatianPig,

I liked your orignal code so I played with it and came up with this.

It's a bit rough but should do nicely.  You can alway add and/or improve it... :idiot:

#include <GUIConstantsEx.au3>
Global $colors_1 = 0x00FF00
Global $colors_2 = 0xFFFF00



;GUI_1:
$GUI_1 = GUICreate("Products", 1600, 890, Default, Default) ;==> draws GUI
GUISetBkColor(0x000000)
GUISetFont(14, 400, "", "Comic Sans MS")


;GUI_1_inputs
$ware_1 = GUICtrlCreateButton("Coca-Cola", 10, 10, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_2 = GUICtrlCreateButton("Pizza Funghi", 10, 120, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_3 = GUICtrlCreateButton("Lasagne Bolognese", 10, 230, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_4 = GUICtrlCreateButton("Ice cream - ball", 10, 340, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_5 = GUICtrlCreateButton("Room - 2 beds", 10, 450, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_6 = GUICtrlCreateButton("Lunch - menu 1", 10, 560, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_7 = GUICtrlCreateButton("Product 7", 10, 670, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_8 = GUICtrlCreateButton("Product 8", 10, 780, 275, 100)
GUICtrlSetBkColor(-1, $colors_1)

$ware_9 = GUICtrlCreateButton("Product 9", 295, 10, 275, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 295, 120, 275, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 295, 230, 275, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 295, 340, 275, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 295, 450, 275, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 295, 560, 275, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 295, 670, 275, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 295, 780, 275, 100)

$ware_17 = GUICtrlCreateButton("Product 17", 580, 10, 275, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 580, 120, 275, 100)
$ware_19 = GUICtrlCreateButton("Product 19", 580, 230, 275, 100)
$ware_20 = GUICtrlCreateButton("Product 20", 580, 340, 275, 100)
$ware_21 = GUICtrlCreateButton("Product 21", 580, 450, 275, 100)
$ware_22 = GUICtrlCreateButton("Product 22", 580, 560, 275, 100)
$ware_23 = GUICtrlCreateButton("Product 23", 580, 670, 275, 100)
$ware_24 = GUICtrlCreateButton("Product 24", 580, 780, 275, 100)

$ware_25 = GUICtrlCreateButton("Product 25", 865, 10, 275, 100)
$ware_26 = GUICtrlCreateButton("Product 26", 865, 120, 275, 100)
$ware_27 = GUICtrlCreateButton("Product 27", 865, 230, 275, 100)
$ware_28 = GUICtrlCreateButton("Product 28", 865, 340, 275, 100)
$ware_29 = GUICtrlCreateButton("Product 29", 865, 450, 275, 100)
$ware_30 = GUICtrlCreateButton("Product 30", 865, 560, 275, 100)
$ware_31 = GUICtrlCreateButton("Product 31", 865, 670, 275, 100)
$ware_32 = GUICtrlCreateButton("Product 32", 865, 780, 275, 100)

$ware_33 = GUICtrlCreateButton("Product 33", 1150, 10, 275, 100)
$ware_34 = GUICtrlCreateButton("Product 34", 1150, 120, 275, 100)
$ware_35 = GUICtrlCreateButton("Product 35", 1150, 230, 275, 100)
$ware_36 = GUICtrlCreateButton("Product 36", 1150, 340, 275, 100)
$ware_37 = GUICtrlCreateButton("Product 37", 1150, 450, 275, 100)
$ware_38 = GUICtrlCreateButton("Product 38", 1150, 560, 275, 100)
$ware_39 = GUICtrlCreateButton("Product 39", 1150, 670, 275, 100)
$ware_40 = GUICtrlCreateButton("Product 40", 1150, 780, 275, 100)

$Finish = GUICtrlCreateButton("Finish", 1435, 10, 155, 870)

Run("Notepad.exe") ;     Using notepad for scripting, coz notepad opens fastest. Will be MS Word or MS Excel template at the end with pre-entered info (company, date, operator), or similar program.
;~ WinWaitActive("[CLASS:Notepad]")
#cs Send ("Company: Samsong, Owner: Mickey Mouse")
    Send ("{ENTER}")
    Send ("Adress: Lady Gaga street, tax number: 007, country: Virgin Islands")
    Send ("{ENTER}")
    Send ("Time: 00:00:01, date: Friday, 13.")
    Send ("{ENTER}")
    Send ("Operator: Waiter 3, Donald Duck")
    Send ("{ENTER 3}")
    Send ("Products:")
    Send ("{TAB}")
    Send ("Quantity:")
    Send ("{TAB}")
    Send ("Single peace price:")
    Send ("{TAB}")
    Send ("Price (Quantity * Single peace price")
#ce Send ("{ENTER 3}")

GUISetState()



;GUI_2:
$GUI_2 = GUICreate("Quantity", 1600, 600, Default, Default, -1, -1, $GUI_1) ;==> draws GUI
GUISetBkColor(0x000000)


;GUI_2_labels:
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)


GUICtrlCreateLabel("Price:", 490, 20, 450, 100)
GUICtrlSetFont(-1, 40, 800)
GUICtrlSetColor(-1, $colors_2)


;GUI_2_buttons:
$GUI_2_OK = GUICtrlCreateButton("OK", 20, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_BACK = GUICtrlCreateButton("BACK", 490, 350, 450, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_7 = GUICtrlCreateButton("7", 1000, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_8 = GUICtrlCreateButton("8", 1160, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_9 = GUICtrlCreateButton("9", 1320, 10, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_4 = GUICtrlCreateButton("4", 1000, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_5 = GUICtrlCreateButton("5", 1160, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_6 = GUICtrlCreateButton("6", 1320, 170, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_1 = GUICtrlCreateButton("1", 1000, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_2 = GUICtrlCreateButton("2", 1160, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_3 = GUICtrlCreateButton("3", 1320, 330, 150, 150)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_0 = GUICtrlCreateButton("0", 1000, 490, 230, 100)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)

$GUI_2_comma = GUICtrlCreateButton(",", 1240, 490, 230, 100)
GUICtrlSetFont(-1, 50, 800)
GUICtrlSetBkColor(-1, $colors_2)


;GUI_2_inputs:

$quantity_ware_1 = GUICtrlCreateInput("Touch here to enter quantity", 20, 150, 450, 150, 0x0001 + 0x0004)
GUICtrlSetLimit($quantity_ware_1, 10)
GUICtrlSetFont($quantity_ware_1, 30, 400)


$price_ware_1 = GUICtrlCreateInput("Touch here to enter price", 490, 150, 450, 150, 0x0001 + 0x0004)
GUICtrlSetLimit($price_ware_1, 10)
GUICtrlSetFont($price_ware_1, 30, 400)







While 1

     If ControlGetFocus("[Title:Quantity]", "Touch here to enter quantity") = "Edit1" Then
         GUICtrlSetData($quantity_ware_1, "")
         GUICtrlSetData($price_ware_1, "Touch here to enter price")
     ElseIf ControlGetFocus("[Title:Quantity]", "Touch here to enter price") = "Edit2" Then
         GUICtrlSetData($price_ware_1, "")
         If GUICtrlRead($quantity_ware_1) = "" Then GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
     EndIf
     If ControlGetFocus("[Title:Quantity]", GUICtrlRead($quantity_ware_1)) = "Edit1" And Not ControlGetFocus("[Title:Quantity]", "Touch here to enter price") = "Edit2" Then
         GUICtrlSetData($quantity_ware_1, "")
         GUICtrlSetData($price_ware_1, "Touch here to enter price")
     EndIf

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            If WinActive($GUI_1) Then Exit
            If WinActive($GUI_2) Then
                GUISetState(@SW_HIDE, $GUI_2)
                GUISetState(@SW_ENABLE, $GUI_1)
                WinActivate($GUI_1)
            EndIf


        Case $ware_1
            GUISetState(@SW_DISABLE, $GUI_1)
            GUISetState(@SW_SHOW, $GUI_2)

            Case $GUI_2_7
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "7", 1)
                Else
                    GUICtrlSetData($price_ware_1, "7", 1)
                EndIf

            Case $GUI_2_8
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "8", 1)
                Else
                    GUICtrlSetData($price_ware_1, "8", 1)
                EndIf

            Case $GUI_2_9
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "9", 1)
                Else
                    GUICtrlSetData($price_ware_1, "9", 1)
                EndIf

            Case $GUI_2_4
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "4", 1)
                Else
                    GUICtrlSetData($price_ware_1, "4", 1)
                EndIf

            Case $GUI_2_5
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "5", 1)
                Else
                    GUICtrlSetData($price_ware_1, "5", 1)
                EndIf

            Case $GUI_2_6
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "6", 1)
                Else
                    GUICtrlSetData($price_ware_1, "6", 1)
                EndIf

            Case $GUI_2_1
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "1", 1)
                Else
                    GUICtrlSetData($price_ware_1, "1", 1)
                EndIf

            Case $GUI_2_2
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "2", 1)
                Else
                    GUICtrlSetData($price_ware_1, "2", 1)
                EndIf

            Case $GUI_2_3
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "3", 1)
                Else
                    GUICtrlSetData($price_ware_1, "3", 1)
                EndIf

            Case $GUI_2_0
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, "0", 1)
                Else
                    GUICtrlSetData($price_ware_1, "0", 1)
                EndIf

            Case $GUI_2_comma
                If GUICtrlRead($quantity_ware_1) <> "Touch here to enter quantity" And GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                    GUICtrlSetData($quantity_ware_1, ".", 1); * Change to comma if you need it.
                Else
                    GUICtrlSetData($price_ware_1, ".", 1); * Change to comma if you need it.
                EndIf



        Case $GUI_2_OK
            If GUICtrlRead($quantity_ware_1) = "" Or GUICtrlRead($quantity_ware_1) = "Touch here to enter quantity" Or GUICtrlRead($price_ware_1) = "" Or GUICtrlRead($price_ware_1) = "Touch here to enter price" Then
                GUICtrlSetData($quantity_ware_1, "ERROR")
                GUICtrlSetData($price_ware_1, "ERROR")
                Sleep(1000)
                GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
                GUICtrlSetData($price_ware_1, "Touch here to enter price")
            Else
                GUISetState(@SW_HIDE, $GUI_2)
                WinActivate("Untitled - Notepad")
                Send(GUICtrlRead($ware_1) & "{TAB 2}" & GUICtrlRead($quantity_ware_1) & "{TAB 2}" & GUICtrlRead($price_ware_1) & "{ENTER}")
                Sleep(1000)
                GUISetState(@SW_HIDE, $GUI_2)
                GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
                GUICtrlSetData($price_ware_1, "Touch here to enter price")
                GUISetState(@SW_ENABLE, $GUI_1)
                WinActivate ($GUI_1)
            EndIf


        Case $GUI_2_BACK
            GUISetState(@SW_HIDE, $GUI_2)
            GUICtrlSetData($quantity_ware_1, "Touch here to enter quantity")
            GUICtrlSetData($price_ware_1, "Touch here to enter price")
            GUISetState(@SW_ENABLE, $GUI_1)
            WinActivate($GUI_1)

        Case $Finish
            GUISetState(@SW_HIDE, $GUI_2)
            GUISetState(@SW_DISABLE, $GUI_2)
            GUISetState(@SW_HIDE, $GUI_1)
            GUISetState(@SW_DISABLE, $GUI_1)

            Send("Total price (Sum of all prices:")
    EndSwitch
WEnd

 

Without the help from you all, that script would still be on MsgBoxes, Sends and maybe few loops.

I was playing with StringReplace, first to replace a comma "," with a point ".", then do math operations, and then return them to comma ",".

Because this thing works with decimal point.

What would you write to sum all the prices after you finish with inputing? Let's say, you have 7 rows of coca colas, each one has different price and quantity?

And please, advice or a link of how to start a database where I could be storing all the things after I turn off the program...

Edited by CroatianPig

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

The program?  If so you can make it do just about anything you want. Decimal, comma, quotes, what ever you like.

 

This is what I have been doing previously, works solid, although proly could be done "globally" that decimal numbers are formed with a comma, instead of a point (because point must be used here by law to separate "thousands").

Can anyone answer me please how to make a database which would hold certain variables and numbers when the computer goes OFF, or the program just goes OFF?

I asked about 3 times, either people are facepalming, or just missed the question.

If facepalming, answer me so I stop asking.

:-)

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

Database... Well, that could be real easy or very hard.. You could start with IniDelete, IniRead, IniReadSection, IniReadSectionNames, IniWriteSection, IniRenameSection.

 

Means I can do a database with a notepad or so, without those MSQL things? Because, when I saw that on some other thread, I couldn't understand a s***.

YES, I know I ask facepalm questions.

YES, I know you asked the God why I had to register to the forum where normal people are.

YES, I know everything!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...