Jump to content

GUI beginner attempt, cash register


Recommended Posts

;http://www.autoitscript.com/forum/topic/153239-gui-beginner-attempt-cash-register/page-2
;Post #40
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\photo-81449.jpg
;by CroatianPig

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

#include <GUIConstantsEx.au3>

$GUI_1 = GUICreate("Articles", 975, 635, Default, Default) ;==> draws GUI
GUISetFont(25, 400, "", "Comic Sans MS")
$ware_1 = GUICtrlCreateButton("Product 1", 5, 5, 250, 100)
$ware_2 = GUICtrlCreateButton("Product 2", 5, 110, 250, 100)
$ware_3 = GUICtrlCreateButton("Product 3", 5, 215, 250, 100)
$ware_4 = GUICtrlCreateButton("Product 4", 5, 320, 250, 100)
$ware_5 = GUICtrlCreateButton("Product 5", 5, 425, 250, 100)
$ware_6 = GUICtrlCreateButton("Product 6", 5, 530, 250, 100)
$ware_7 = GUICtrlCreateButton("Product 7", 260, 5, 250, 100)
$ware_8 = GUICtrlCreateButton("Product 8", 260, 110, 250, 100)
$ware_9 = GUICtrlCreateButton("Product 9", 260, 215, 250, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 260, 320, 250, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 260, 425, 250, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 260, 530, 250, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 515, 5, 250, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 515, 110, 250, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 515, 215, 250, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 515, 320, 250, 100)
$ware_17 = GUICtrlCreateButton("Product 17", 515, 425, 250, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 515, 530, 250, 100)
$Finish = GUICtrlCreateButton("Finish", 770, 5, 200, 625)
GUISetState()

$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI
$input_1 = GUICtrlCreateInput("Enter quantity", 20, 280, 920, 240)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 60, 800)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
$GUI_2_OK = GUICtrlCreateButton("OK", 490, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x00ffff)

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)
        Case $GUI_2_OK
            MsgBox("", "Confirm quantity:", GUICtrlRead($input_1))
    EndSwitch
WEnd

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

;http://www.autoitscript.com/forum/topic/153239-gui-beginner-attempt-cash-register/page-2
;Post #40
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\photo-81449.jpg
;by CroatianPig

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

#include <GUIConstantsEx.au3>

$GUI_1 = GUICreate("Articles", 975, 635, Default, Default) ;==> draws GUI
GUISetFont(25, 400, "", "Comic Sans MS")
$ware_1 = GUICtrlCreateButton("Product 1", 5, 5, 250, 100)
$ware_2 = GUICtrlCreateButton("Product 2", 5, 110, 250, 100)
$ware_3 = GUICtrlCreateButton("Product 3", 5, 215, 250, 100)
$ware_4 = GUICtrlCreateButton("Product 4", 5, 320, 250, 100)
$ware_5 = GUICtrlCreateButton("Product 5", 5, 425, 250, 100)
$ware_6 = GUICtrlCreateButton("Product 6", 5, 530, 250, 100)
$ware_7 = GUICtrlCreateButton("Product 7", 260, 5, 250, 100)
$ware_8 = GUICtrlCreateButton("Product 8", 260, 110, 250, 100)
$ware_9 = GUICtrlCreateButton("Product 9", 260, 215, 250, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 260, 320, 250, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 260, 425, 250, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 260, 530, 250, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 515, 5, 250, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 515, 110, 250, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 515, 215, 250, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 515, 320, 250, 100)
$ware_17 = GUICtrlCreateButton("Product 17", 515, 425, 250, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 515, 530, 250, 100)
$Finish = GUICtrlCreateButton("Finish", 770, 5, 200, 625)
GUISetState()

$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI
$input_1 = GUICtrlCreateInput("Enter quantity", 20, 280, 920, 240)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 60, 800)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
$GUI_2_OK = GUICtrlCreateButton("OK", 490, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x00ffff)

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)
        Case $GUI_2_OK
            MsgBox("", "Confirm quantity:", GUICtrlRead($input_1))
    EndSwitch
WEnd

 

But which line did I make a mistake so that it spamms me that msgbox, and it doesnt on the autoit link?

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

you made a whole bunch of mistakes and it's your turn to find out where. you can easily compare the scripts.

 

Ok I will do it again.

But I didn't know there are other mistakes also...

cc

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'm so freakin bad...

#include <GUIConstantsEx.au3>

$GUI_1 = GUICreate("Articles", 975, 635, Default, Default) ;==> draws GUI
GUISetFont(25, 400, "", "Comic Sans MS")
$ware_1 = GUICtrlCreateButton("Product 1", 5, 5, 250, 100)
$ware_2 = GUICtrlCreateButton("Product 2", 5, 110, 250, 100)
$ware_3 = GUICtrlCreateButton("Product 3", 5, 215, 250, 100)
$ware_4 = GUICtrlCreateButton("Product 4", 5, 320, 250, 100)
$ware_5 = GUICtrlCreateButton("Product 5", 5, 425, 250, 100)
$ware_6 = GUICtrlCreateButton("Product 6", 5, 530, 250, 100)
$ware_7 = GUICtrlCreateButton("Product 7", 260, 5, 250, 100)
$ware_8 = GUICtrlCreateButton("Product 8", 260, 110, 250, 100)
$ware_9 = GUICtrlCreateButton("Product 9", 260, 215, 250, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 260, 320, 250, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 260, 425, 250, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 260, 530, 250, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 515, 5, 250, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 515, 110, 250, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 515, 215, 250, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 515, 320, 250, 100)
$ware_17 = GUICtrlCreateButton("Product 17", 515, 425, 250, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 515, 530, 250, 100)
$Finish = GUICtrlCreateButton("Finish", 770, 5, 200, 625)
GUISetState()

$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI
$input_1 = GUICtrlCreateInput("Enter quantity", 20, 280, 920, 240)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 60, 800)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
$GUI_2_OK = GUICtrlCreateButton("OK", 490, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x00ffff)

$GUI_3 = GUICreate("Confirm", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI
$input_confirm = GUICtrlCreateInput("Confirm quantity", 20, 280, 920, 240)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 60, 800)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
$GUI_3_OK = GUICtrlCreateButton("OK", 490, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x00ffff)

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
                If WinActive($GUI_1) Then Exit
                If WinActive($GUI_2) Then Exit
                If WinActive($GUI_3) Then
                    GUISetState(@SW_HIDE,$GUI_1)
                    GUISetState(@SW_HIDE,$GUI_2)
                    GUISetState(@SW_ENABLE,$GUI_3)
                    WinActivate($GUI_3)
                EndIf
                Case $GUI_3_OK Then     ; added or enter
                    MsgBox("", "Confirm quantity:", GUICtrlRead($input_confirm))
                EndIf
            EndIf
            EndSwitch
WEnd

How to make a loop in a loop? What is the thing that separates them?

I'm so mad, I still can't understand that "22" number, there is absolute nothing in the script that has number 22, and I checked the 22. line... It's something else.

I asked already, you probobly missed in a haste, is this the same always? 

Case $GUI_2_OK or ("{ENTER}")
                MsgBox("", "Confirm quantity:", $input_1)


Case $GUI_2_OK or ("{ENTER}")
MsgBox("", "Confirm quantity:", $input_1)


Case $GUI_2_OK or ("{ENTER}")
                                            MsgBox("", "Confirm quantity:", $input_1)

ie. the "margins"...

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

As you were told something similar before, $input_1 holds the control ID of the input control, it does not give you the text that is in the control. You have to use GUICtrlRead($Input_1) before you can see what the input control's text is.

You REALLY need to start reading the help file before trying something like this, you clearly are way over your head right now. Start small and work your way up to bigger projects.

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

@CroationPig

in post 41 i gave you a clean script with 2 gui, now you added a 3rd gui and you messed up the code. didn't you notice that autoit throws out an error about an "endif" statement ? why don't you first look it up and remove the reported error ?

and you do not need another loop, what makes you think that ? and i did not miss the other questions, i simply don't answer them because the answer is obvious.

E.

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

As you were told something similar before, $input_1 holds the control ID of the input control, it does not give you the text that is in the control. You have to use GUICtrlRead($Input_1) before you can see what the input control's text is.

You REALLY need to start reading the help file before trying something like this, you clearly are way over your head right now. Start small and work your way up to bigger projects.

 

That's my problem, I'm trying to go 3 steps at once. 

Anyway, I was pissed because of the day, not because of the script. We have 3 German and 1 Italian familes, and 3 lesbian girls, all about 25 year old from Czech Republic on a vacation at the moment. 

Preparing 2 or 3 meals every day, each lunch like 8 kilograms (4 kilograms of rice for a lunch - a big bag), and crawling after each of them to make them very happy, makes a person stressed sometimes.

So, can I please ask only as what the "separator" between loops is?

I'm trying to use help, but it's not very helpfull sometimes :(

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

@CroationPig

in post 41 i gave you a clean script with 2 gui, now you added a 3rd gui and you messed up the code. didn't you notice that autoit throws out an error about an "endif" statement ? why don't you first look it up and remove the reported error ?

and you do not need another loop, what makes you think that ? and i did not miss the other questions, i simply don't answer them because the answer is obvious.

E.

 

I need, because I wanted 3 GUIs. 

I thought the 3. one should be the verification of the quantity.

I would like to make that, and shouldn't be a problem, but I lose myself in the script sometimes, because I'm not so familiar with the "commands" yet, to understand everything by a fast eye blick, and it's too complicated sometimes.

P.S. I didn't mess your code.

I have all the codes from the whole thread saved (I get lost there also sometimes for a minute or so, searching and trying to remember what I saved last).

How does this part call for the first GUI we made, the GUI_1 (I think those lines call for it):

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE

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

Removing GUI 3, seriously not needed. You were right.

Any way to do these in Autoit?      { }

I always go to MS Word to put alt+b and alt+n, but in autoit it does something else..

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

nono, i didn't mean to remove it, but anyway, you can add it when you understand the rest. but right now you are not on the right track.

i thought about how to help you, and i make another attempt. i always found 'If - Then' more intuitive for beginners than 'Switch - Case' or other expressions. so look at this:

.

;http://www.autoitscript.com/forum/topic/153239-gui-beginner-attempt-cash-register/page-2
;Post #40
;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\photo-81449.jpg
;by CroatianPig

;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575

#include <GUIConstantsEx.au3>

$GUI_1 = GUICreate("Articles", 975, 635, Default, Default) ;==> draws GUI
GUISetFont(25, 400, "", "Comic Sans MS")
$ware_1 = GUICtrlCreateButton("Product 1", 5, 5, 250, 100)
$ware_2 = GUICtrlCreateButton("Product 2", 5, 110, 250, 100)
$ware_3 = GUICtrlCreateButton("Product 3", 5, 215, 250, 100)
$ware_4 = GUICtrlCreateButton("Product 4", 5, 320, 250, 100)
$ware_5 = GUICtrlCreateButton("Product 5", 5, 425, 250, 100)
$ware_6 = GUICtrlCreateButton("Product 6", 5, 530, 250, 100)
$ware_7 = GUICtrlCreateButton("Product 7", 260, 5, 250, 100)
$ware_8 = GUICtrlCreateButton("Product 8", 260, 110, 250, 100)
$ware_9 = GUICtrlCreateButton("Product 9", 260, 215, 250, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 260, 320, 250, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 260, 425, 250, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 260, 530, 250, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 515, 5, 250, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 515, 110, 250, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 515, 215, 250, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 515, 320, 250, 100)
$ware_17 = GUICtrlCreateButton("Product 17", 515, 425, 250, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 515, 530, 250, 100)
$Finish = GUICtrlCreateButton("Finish", 770, 5, 200, 625)
GUISetState()

$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI
$input_1 = GUICtrlCreateInput("Enter quantity", 20, 280, 920, 240)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 60, 800)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
$GUI_2_OK = GUICtrlCreateButton("OK", 490, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x00ffff)

While 56558858          ;==> can be anything, not important
    $msg=GUIGetMsg()
    If $msg=$GUI_EVENT_CLOSE Then
        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
    ElseIf $msg=$ware_1 Then
        GUISetState(@SW_DISABLE, $GUI_1)
        GUISetState(@SW_SHOW, $GUI_2)
    ElseIf $msg=$GUI_2_OK Then
        MsgBox("", "Confirm quantity:", GUICtrlRead($input_1))
    EndIf
WEnd

.

not sure if that helps at all

n.b. there are always several possibilities to do the same thing

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

Yea, I suppose practically endless possibilities. 

I am adding things to this script you made (97% you, rest me):

#include <GUIConstantsEx.au3>

$GUI_1 = GUICreate("Articles", 975, 635, Default, Default) ;==> draws GUI
GUISetFont(25, 400, "", "Comic Sans MS")
$ware_1 = GUICtrlCreateButton("Product 1", 5, 5, 250, 100)
$ware_2 = GUICtrlCreateButton("Product 2", 5, 110, 250, 100)
$ware_3 = GUICtrlCreateButton("Product 3", 5, 215, 250, 100)
$ware_4 = GUICtrlCreateButton("Product 4", 5, 320, 250, 100)
$ware_5 = GUICtrlCreateButton("Product 5", 5, 425, 250, 100)
$ware_6 = GUICtrlCreateButton("Product 6", 5, 530, 250, 100)
$ware_7 = GUICtrlCreateButton("Product 7", 260, 5, 250, 100)
$ware_8 = GUICtrlCreateButton("Product 8", 260, 110, 250, 100)
$ware_9 = GUICtrlCreateButton("Product 9", 260, 215, 250, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 260, 320, 250, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 260, 425, 250, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 260, 530, 250, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 515, 5, 250, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 515, 110, 250, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 515, 215, 250, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 515, 320, 250, 100)
$ware_17 = GUICtrlCreateButton("Product 17", 515, 425, 250, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 515, 530, 250, 100)
$Finish = GUICtrlCreateButton("Finish", 770, 5, 200, 625)
GUISetState()

$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI
$input_1 = GUICtrlCreateInput("Enter quantity", 20, 280, 920, 240)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 60, 800)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
$GUI_2_OK = GUICtrlCreateButton("OK", 490, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x00ffff)

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)
        Case $GUI_2_OK
            MsgBox("", "Confirm quantity:", GUICtrlRead($input_1))
    EndSwitch
WEnd

Among other things, I thought I edit this line:

Case $GUI_2_OK

by adding this: 

or ("{ENTER}")

but it instantly puts the msgbox instantly on gui_1 when I run it.

If the explanation is simple and you are willing, please :-)

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

Will that voice recognition be possible in autoit?

I know I'm far from it, but I just hope that you tell me "You have to be a pro like a boss, but it's possible".

Btw, what do you think about this? 

#include <GUIConstantsEx.au3>

$GUI_1 = GUICreate("Products", 975, 635, Default, Default) ;==> draws GUI
GUISetFont(14, 400, "", "Comic Sans MS")
$ware_1 = GUICtrlCreateButton("Coca-Cola 0,25l", 5, 5, 250, 100)
$ware_2 = GUICtrlCreateButton("Pizza Funghi", 5, 110, 250, 100)
$ware_3 = GUICtrlCreateButton("Lasagne Bolognese", 5, 215, 250, 100)
$ware_4 = GUICtrlCreateButton("Ice cream - ball", 5, 320, 250, 100)
$ware_5 = GUICtrlCreateButton("Apartment - day", 5, 425, 250, 100)
$ware_6 = GUICtrlCreateButton("Lunch - menu 1", 5, 530, 250, 100)
$ware_7 = GUICtrlCreateButton("Product 7", 260, 5, 250, 100)
$ware_8 = GUICtrlCreateButton("Product 8", 260, 110, 250, 100)
$ware_9 = GUICtrlCreateButton("Product 9", 260, 215, 250, 100)
$ware_10 = GUICtrlCreateButton("Product 10", 260, 320, 250, 100)
$ware_11 = GUICtrlCreateButton("Product 11", 260, 425, 250, 100)
$ware_12 = GUICtrlCreateButton("Product 12", 260, 530, 250, 100)
$ware_13 = GUICtrlCreateButton("Product 13", 515, 5, 250, 100)
$ware_14 = GUICtrlCreateButton("Product 14", 515, 110, 250, 100)
$ware_15 = GUICtrlCreateButton("Product 15", 515, 215, 250, 100)
$ware_16 = GUICtrlCreateButton("Product 16", 515, 320, 250, 100)
$ware_17 = GUICtrlCreateButton("Product 17", 515, 425, 250, 100)
$ware_18 = GUICtrlCreateButton("Product 18", 515, 530, 250, 100)
$Finish = GUICtrlCreateButton("Finish", 770, 5, 200, 625)
GUISetState()

$GUI_2 = GUICreate("Quantity", 960, 540, Default, Default,-1,-1,$GUI_1) ;==> draws GUI
$input_1 = GUICtrlCreateInput("Enter quantity", 20, 280, 920, 240)
GUICtrlSetLimit(-1, 10)
GUICtrlSetFont(-1, 60, 800)
GUICtrlCreateLabel("Quantity:", 20, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
$GUI_2_OK = GUICtrlCreateButton("OK", 490, 20, 450, 240)
GUICtrlSetFont(-1, 60, 800)
GUICtrlSetBkColor(-1, 0x00ffff)

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)
        Case $GUI_2_OK
            MsgBox(4, "Confirm quantity:", GUICtrlRead($input_1))
            GUISetState(@SW_HIDE,$GUI_2)
            GUISetState(@SW_ENABLE,$GUI_1)
            WinActivate($GUI_1)
        Case $Finish
            Run("Notepad.exe")    ;     Notepad opens fastest. Will be MS Word template at the end, or similar program.
            WinWaitActive ("Untitled - Notepad")
            Send ("{ENTER 3}")
            Send ("{TAB 3}")
            $ware_1_end = GUICtrlRead($ware_1)
            $input_1_end = GUICtrlRead($input_1)
            Send ($ware_1_end & "{TAB 2}" & $input_1_end)
    EndSwitch
WEnd

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

this looks like real progress...  :thumbsup:

better use this line

.

WinWaitActive ("[CLASS:Notepad]")

.

and voice recognition is not possible with autoit, unless you find it in the forum.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

this looks like real progress...  :thumbsup:

better use this line

.

WinWaitActive ("[CLASS:Notepad]")

.

and voice recognition is not possible with autoit, unless you find it in the forum.

 

I found it on youtube actually, but the guy doesn't want to share to anyone, which is ok, if he thinks it should be private.

But tell me what you think about this... this was my "rough" idea:

So, for example, I record myself 10 different times saying, let's say number "seven", and I save it in some folder. 

At some line, I somehow use "input" to speak, and when I say something, it scans that folder and my recordings if it can find a match.

If it doesn't, then it asks me if I would like to try again, and hopefully recognizes and continues on...

Is something like that possible at this time (year, decade)?

It's a rough idea, but do you have idea about something to acchieve that?

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

absolutely no.....  how do you think you can compare two sound files ? and how do you think you can produce two exactly equal files ??? forget it.

a bar code scanner ... that could be useful and probably achievable for you maybe in 3 or 4 years.

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Link to comment
Share on other sites

absolutely no.....  how do you think you can compare two sound files ? and how do you think you can produce two exactly equal files ??? forget it.

a bar code scanner ... that could be useful and probably achievable for you maybe in 3 or 4 years.

 

Well, they probobly don't have to be 100% equal, right? I have on my cp Google Chrome that accepts voice commands, and it works nicely, until I start speaking Croatian. Then I get a strange error saying: Retard, retard !

3 or 4 years for a lame bar code scanner? Pfff

How much for a touch screen?

Websites can't be made using autoit, right?

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 did some changes, and updated it.

Need to multiply variables, and put global values of quantity, single item price, and price, as numbers with 2 decimals.

 

Found this: http://www.autoitscript.com/autoit3/docs/functions/Round.htm

but can't get it going.

#include <GUIConstantsEx.au3>

$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)
            GUISetState(@SW_SHOW, $GUI_2)
        Case $GUI_2_OK
            GUISetState(@SW_HIDE,$GUI_2)
            $ware_1 = GUICtrlRead($ware_1)
            $quantity_ware_1_end = GUICtrlRead($quantity_ware_1)
            $quantity_ware_1_end_decimals = Round($quantity_ware_1_end, 2)
            $price_ware_1 = GUICtrlRead($price_ware_1)
            WinActivate("Untitled - Notepad")
            Send ($ware_1 & "{TAB 2}" & $quantity_ware_1_end_decimals & "{TAB 2}" & $price_ware_1)
            GUISetState(@SW_HIDE,$GUI_2)
            GUISetState(@SW_DISABLE,$GUI_2)
        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

P.S. There is a reason why I changed this, I need it to tab and put a text in Office bill template after putting an item every time, SPECIFICALLY the same item, because we serve for example calamari (squids), but not all are the same price, depending if Adriatic or Californian, the Adriatic squids are 50% more expensive, coz fresh from a boat and small, and hard to clean, etc etc etc.

And I don't want to put 3000 GUI buttons (those 40 will be enough lol), because these prices often vary alot, and it can't remember 2 different values for the same variable.

The point of this what I'm barking about is this, there could be easy a bill that looks like this (or it's part):

...

Product                               Quantity                                       Price (kilogram)                                 Price

Calamari                              0,75                                             30 EUR                                             22,50 EUR

Calamari                              0,50                                             50 EUR                                             25 EUR

 

Or many more similar products.

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

Hi CroatianPig,

I notice some areas that could be improved.

#include <GUIConstantsEx.au3>

$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)
            GUISetState(@SW_SHOW, $GUI_2)
        Case $GUI_2_OK
            GUISetState(@SW_HIDE, $GUI_2)
;~             $ware_1 = 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)
            $quantity_ware_1_end_decimals = Round($quantity_ware_1_end, 2)
            $price_ware_1 = GUICtrlRead($price_ware_1)
            WinActivate("Untitled - Notepad")
;~          Send ($ware_1 & "{TAB 2}" & $quantity_ware_1_end_decimals & "{TAB 2}" & $price_ware_1)
;~ $ware_1 will not be used this way.
            Send(GUICtrlRead($ware_1) & "{TAB 2}" & $quantity_ware_1_end_decimals & "{TAB 2}" & $price_ware_1); Try this instead.
            GUISetState(@SW_HIDE, $GUI_2)
;~             GUISetState(@SW_DISABLE,$GUI_2)
;~ 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)
        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

Overall I say you are doing a good job.  Just keep at it and you will AutoIt Master someday.

Good luck.

Link to comment
Share on other sites

NewPlaza. 

I'm feeling embarassed. 

Coz everyone is so nice here.

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.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 >?

...3 hours later... EUREKA !

It works like charm !

Good feeling seriously, despite I still have some work to do, such as:

-touch screen input

-figure how to put decimal numbers everywhere (quantities, single item prices, prices overall price of the bill), and be sure the script sums and multiplies them correctly

-make a template in office

-finish the steps for the remaining 39 products

-figure out if voice command will do

-add somehow a picture and logo of our family company to the template

-make a new epic website of our family company (this one is from 2003. I think, it looks like Flintstones style)

-auto insert date and time at the end of each bill

-insert details of a buyer if it's a voucher from another country, Austria, Switzerland or Italy

Here's the script, I can enter 10 times coca colas as different price and quantity. 

include <GUIConstantsEx.au3>

$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)
            GUISetState(@SW_SHOW, $GUI_2)
        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

I need to make a template in Open Office or MS Office. 

I will be buying a new touch screen monitor, such as this, it's cheap, about 400 $: 

http://www.gadgetreview.com/wp-content/uploads/2011/04/Dell-ST2220T-21.5-Inch-Widescreen-Multi-Touch-LCD-Monitor.jpg

Anything I should pay attention to, while buying it? Hope it has full HD resolution 1920*1080, to avoid Minecraft style.

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

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...