banner banner banner
Medium and high level hacks – 2. Secrets, jokes, programming, computer knowledge. Collection of codes of my programs
Medium and high level hacks – 2. Secrets, jokes, programming, computer knowledge. Collection of codes of my programs
Оценить:
 Рейтинг: 0

Medium and high level hacks – 2. Secrets, jokes, programming, computer knowledge. Collection of codes of my programs


Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1

$oSpVoice = ObjCreateInterface ($CLSID_SpVoice, $IID_ISpVoice, $sSpVoice)

$oSpVoice.SetRate (-3)

$text = GUICtrlRead ($Input_1)

$oSpVoice. speak ($text, $SPF_DEFAULT, 0)

EndSelect

WEnd

EndFunc;==> Deeman

In general, the first lines are already familiar to you from the first book, this is the connection of some modules. Next we declare a function called Deeman. line!

Deeman ()

you can name the function as you want, the name is given in order that you would remember what each function in the program performs if there are more than one exist. After the declaration, we activate the function. line!

Func Deeman ()

Then there are 4 lines that designate constants as local, it’s like a character set or alphabet, something constant in general!

Local Const $CLSID_SpVoice =» {96749377-3391-11D2—9EE3—00C04F797396}”

Local Const $IID_ISpVoice =» {6C44DF74—72B9-4992-A1EC-EF996E0422D4}”

Local Const $SPF_DEFAULT = 0

Local Const $sSpVoice = “SetNotifySink hresult (ptr)” & _

I’m not going to get into the details, you can break the brain, but in principle, variables and functions can be called different (preferably short) names, this is also done to facilitate and remember, each variable is assigned to a command on the same line, Well, in general, move on. And then comes a long set of commands that our program transfers directly to the computer, that is, it tells the computer what to do, namely connecting the voice functions of the robot (if any), I have a standard male voice on the computer, You may have a different alien voice. The last command!

“DisplayUI hresult (hwnd; ptr; ptr; ptr; ulong);”

Next come the standard commands of our program, line!

Opt (“GUICoordMode”, 2)

assigns a coordinate mode, something like that, a line!

GUISetBkColor (0X000000)

sets the background color, in our case black. Next line!

Global $hGuiWin = GUICreate (“Robot from Deeman”, 550, 200)

in this line, the variable $ hGuiWin is assigned global (Global) and the program creates a program window (GUI) called “Robot from Deeman”, and sets the window size to 550, 550 length (horizontal), 200 height (vertical). This line is superfluous in principle, but if we add more functions, buttons or windows to the program, then it can come in handy, since we add the variable GUISetBkColor (0x000000, $ hGuiWin) in it, which was assigned global and it is possible to register on it and buttons different and all kinds of inputs (lines for entering text). This line is optional, but I decided to add and explain to you what it does!

GUICtrlCreatePic('5.jpg’, 0, 0, 0, 0)

if you put a photo called 5 with the jpg extension in the folder with our program, then in the background of the program a photo called 5.jpg will appear instead of black color, then there are 4 zeros separated by commas, these are coordinates that mean, that our photo will be placed at the corners of the program, that is, the entire size of our program window, which is now black. I will skip some lines, such as!

GUICtrlSetState (-1, $GUI_DISABLE)

they are mandatory in principle, but if I begin to explain what they are doing, it will be very long, so I will describe exactly those lines that are of interest to us. The next line in the program!

$Input_1 = GUICtrlCreateInput (“Hello, from Deeman!”, 35, 55, 480, 40)

creates a variable called $ Input_1 for the text input field, then creates the text input field itself (the commands that you will enter for the robot, what would it say), and in the text input field I will write for you an already short text Hello, from Deeman hi from me, well, the size of this field for entering is the 4 digits by commas. Next line!

$Button_1 = GUICtrlCreateButton (“Start Talk”, -150, 30, 70)

creates a button called Start Talk, the size is 3 digits and a variable for this button called $ Button_1 (button 1) is assigned to the front.

Next line!

GUISetState ()

this is the beginning of the show of our program (launch can be said).

Next line!

While 1

beginning of the cycle!

Next line!

$msg = GUIGetMsg ()

the program receives a message, and the variable is written to this command for further work! The next line!

Select

the possibility of selective mode. The next line!

Case $msg = $GUI_EVENT_CLOSE

2 lines back, we just prescribed the variable $ msg for this action, for what would the program now say, $ GUI_EVENT_CLOSE that is, when we click the button in the upper right x in general to close the program, then the program will close.