2019-07-17 15:06:22

Hi. I want to start coding programs in auto it 3. How can i get started in there? I saw a few open source games originaly made by w4u, but they stated in the readme that code is messy so it should not be used for learning.

Lamas with hats, but with sponge bob as carl Stay tuned.

https://www.youtube.com/channel/UCvAUQt … subscriber

2019-07-17 15:17:29

hi,
checkout it's manual.
I'm not it's fan, and as far as i know, it doesn't have support for oop which makes it hard for you to code and organize your code.

2019-07-17 15:28:46

Hi.
I am unfortunately not good to learn from manuals, so i was looking for example code. But when we are at it, what is an oop?

Lamas with hats, but with sponge bob as carl Stay tuned.

https://www.youtube.com/channel/UCvAUQt … subscriber

2019-07-17 16:51:39

OOP is object-oriented programming and is a way of organizing data and methods of utilizing, creating, modifying and destroying that data.
Personally I wouldn't recommend AU3; while its nice, don't go making GUIs with it (its GUI handler is shit).

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-07-17 16:56:57

Well i saw a few nice gui programs in autoit.

Lamas with hats, but with sponge bob as carl Stay tuned.

https://www.youtube.com/channel/UCvAUQt … subscriber

2019-07-18 02:31:40

we have  a lot of programs with auto it. I know my friend coded an easy audio player with it.
i think python more better if you wanna learn.

----------
Best regards,
Hamad.

2019-07-18 04:31:30 (edited by magurp244 2019-07-18 04:34:42)

If it helps, I've dug around and there are various threads with examples using TTS [here], [here], [here], and [here].

The documentation on sound playing is [here]. A lot of this is fairly dated, so grain of salt and all that.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-07-18 10:28:58

Oh AutoIt3... thats what I actually started with over 10 years ago.
There should still be a TTS binding somewhere online which I added in years ago, supporting all major Screen Readers, but on the german forums I guess. At least I never posted them to the english forums.
To be serious, I cannot recommend you to walk the AutoIt3 path. It got more and more buggy over the years, the GUI interface is crap and OOP is not a thing, although there was an external library which tried to add this in afterwards which worked pretty well, but shouldn't work anymore due to not being updated anymore.
Best Regards.
Hijacker

2019-07-18 12:27:05

Hijacker wrote:

Oh AutoIt3... thats what I actually started with over 10 years ago.
There should still be a TTS binding somewhere online which I added in years ago, supporting all major Screen Readers, but on the german forums I guess. At least I never posted them to the english forums.
To be serious, I cannot recommend you to walk the AutoIt3 path. It got more and more buggy over the years, the GUI interface is crap and OOP is not a thing, although there was an external library which tried to add this in afterwards which worked pretty well, but shouldn't work anymore due to not being updated anymore.
Best Regards.
Hijacker

My story is almost the same, the difference only that I started with another language.
Autoit is good for autommating some tasks on your machine that would be hard to do it by hands and lets say write a quick - dirty tests for your real software, but other ways than that, I do not recommend it to learn. If you need something much powerfull and to be capable to write scripts with it, grab Python and yo will be fine.
If you still not convinced and decide otherwise, I shal say that GUI is slow, especially with NVDA, it's not cross platform as well (even if you think that will write software on Windows, but why to keep yourself guessing, it's better to take something that yo know for sure has great support and whatever).
You'll never be able to release something major as your creations to the public because of it's insecurity - high-compression of executables that antivirus software recognises as a malicious warme, and the other option - force your end-user to install Autoit interpretator is not acceptable either.
By staing on a topic, I can say that I wrote few scripts to bind my TTS (JAWS, NVDA and SAPI) to speak via jfw.JawsAPI, NVDAControllerClient32.dll and SAPI through obj_create if I remember them correctly. Few games by using bass.dll to balance / pan the sound and modivy the volume, etc. It has an access to TCP/IP, UDP socket connections and you can make some graphicks through the native Windows libraries, but all in all - pick another language.

2019-08-17 20:22:31

The only thing that is interesting about au3 is how does the DllStruct works, can anyone take a guess? Does it integrate a C compiler?

2019-08-17 20:47:50

It doesn't, you simply tell the struct which datatypes are stored within and it will simply reconstruct it and create the corresponding pointers if necessary. Why is it important how AutoIT3 handles its structs internally? It shouldn't bother you actually, such engines are ment to be blackboxed, means you know what to put into it and what you can expect to get out of it, but the internals shouldn't matter at all.
Best Regards.
Hijacker

2019-08-17 21:22:12

It mat interests me because I want to implement it in my new bgt

2019-08-17 23:22:24 (edited by Ethin 2019-08-17 23:38:53)

@12, you can't. Pure and simple. Its closed source.
Also, calling functions from DLLs without C headers or language bindings is hard to get right. There is no type or parameter checking, no safety nets, no safety checks, no length validation, etc. You can call a function in a DLL that requires 10 parameters and only give it 6. Or you can give it none. Even in .NET it is difficult to do and I would highly discourage it unless you have no choice and you know what you are doing. There's a reason that this is the way it is -- your calling a DLL that may not be written in the language your programming in. The compiler and runtime have absolutely no idea how the function works nor do they have its code to look at. This is exactly when the saying "Anything to do with shared libraries is dangerous" rings true -- because it is. Even in Rust there is no "safe" way to do it -- you must use unsafe to make any DLL calls. BGT may require you to put the function signature in, but internally that's only so it can type-check your code. You can put an invalid signature in there too and it wouldn't be able to stop you. It would make the call and your only thing to do would be to hope to god that you wrote the signature right and you know the library in and out. You can look up functions in a DLL but you can't look up its signature.
The only way you could do that is if you had the debugging symbols, and since no library ships that unless its open source... good luck getting those.
Also, did I mention that calling functions from DLLs is messy as all hell, even when not using the win32 API? Even in Go -- which did its best to simplify the entire process -- its messy. Here's an example of me calling a Tolk function from its DLL (since there are no Tolk bindings in go):

import (
"golang.org/x/sys/windows"
"unsafe"
)

// loading code
var (
dll *windows.DLL
load *windows.Proc
unload *windows.Proc
hasSpeech *windows.Proc
hasBraille *windows.Proc
output *windows.Proc
speak *windows.Proc
braille *windows.Proc
isSpeaking *windows.Proc
silence *windows.Proc
)

func Load() {
dll = windows.MustLoadDLL("tolk.dll")
load = dll.MustFindProc("Tolk_Load")
unload = dll.MustFindProc("Tolk_Unload")
hasSpeech = dll.MustFindProc("Tolk_HasSpeech")
hasBraille = dll.MustFindProc("Tolk_HasBraille")
output = dll.MustFindProc("Tolk_Output")
speak = dll.MustFindProc("Tolk_Speak")
braille = dll.MustFindProc("Tolk_Braille")
isSpeaking = dll.MustFindProc("Tolk_IsSpeaking")
silence = dll.MustFindProc("Tolk_Silence")
load.Call()
}

func Unload() {
unload.Call()
dll.Release()
}

func Speak(text string, interrupt bool) {
str, err := windows.UTF16PtrFromString(text)
if err != nil {
panic(err)
}
speak.Call(uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(interrupt)))
}

And with return values:

// Same code context as above
func HasSpeech() bool {
r1, _, _ := hasSpeech.Call()
return *(*bool)(unsafe.Pointer(r1))
}

Can I say that this is correct code? No, I can't. I cannot guarantee that I am doing this properly. I know that the speak code is correct -- but that's only because I tested it, though with the interrupt variable thrown in there, that may have broken things. Here's how you might do that in C++ (calling the MessageBoxA function), raw win32 API:

#include <windows.h>

// We load user32.dll instead of taking advantage of the fact that windows.h already provides this for us
typedef int(*MsgBox)(HWND, LPCSTR, LPCSTR, UINT);

int main() {
// Load our library
HINSTANCE lib = LoadLibrary("user32.dll");
if (lib != NULL) {
MsgBox msgbox = (MsgBox)GetProcAddress(lib, "MessageBoxA");
if (msgbox != NULL) {
(msgbox)(NULL, "test", "test", 0);
}
FreeLibrary(lib);
}
}

Notice how here I have left out a lot of error checking. A fuller example can be found at https://docs.microsoft.com/en-us/window … ic-linking. In C# its a lot easier:

using System;
using System.Runtime.InteropServices;
// ...
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type);

But even then you need to correlate C++ types and C# types. And this doesn't take into account C++-based DLLs which could have classes (but more often than not have C interfaces).

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-08-18 01:46:24

I think that we stumbled upon a verry nasty problem, calling a function from a dll.
As you sead, calling dll functions is dangerous because one can find the functions but not their signature. But what could stop me from disassembling the function and figuring out it's aproximate signature by hand?
I don't know anything about go, but the c++ example looks  nice. Could you do the call without the typedef? I'd do it  by creating a new  function with a variable number of arguments, buffers for storing the values and some assembly for stak manipulations and  for calling   the specified function address, how would you do it?

2019-08-18 03:01:45

@14, you could, but it would be way overcomplicated and not worth it. And disassembling it and finding the function signature? That's not exactly practical, now is it? That's what C headers, reference manuals and documentation are for. Disassembly is a drastic thing that will take quite a while to finish and should be a last resort thing.
That still doesn't help you in your "BGT remake" though. It just won't, either -- you will need to figure out a usable (please, no dictionaries...) approach to DLL calls.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-08-18 05:21:13

I should really move those three or so posts that talk about dll calling and the bgt remake in the thread that was made for this purpose but I don't know how. Moderators?
The dll calling makanism will be built around a function that uses a format string like printf to allocate  buffers of the right size for the currently parsed datatype ackording to the format string(see the end of the previous post)whos return value is the same value of the function called from the dll.

2019-08-18 05:35:51

@16, that's not going to work. You can't possibly handle every data type out there, and if you want this interface to be comfortable to use and not hackish then your going to need to return native types and allow the passing of native types. This is just another reason why I think this is a bad idea -- your attempting to overlay something that an operating system already provides you and only making it more complicated in the process.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-08-18 05:53:06

Ok, but how the hell did au3, bgt, or even python's ctypes handle the funtion calling and passing of parameters? Is there a winapi function to do it?

2019-08-18 06:26:34

@18, I don't know how AutoIt and BGT did it. As for Python... I honestly don't know. I haven't looked at the code to figure that out. What I do know is that when a DLL is loaded and you either use subscript notation or dotted notation (foo.bar() or foo["bar"]()) Python uses GetProcAddress or whatever the platform library calling interface uses to acquire the function and see if it exists. If Python does do argument checking and type checking then clearly I was wrong and just do not know how it would do that.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-08-18 06:58:27

Yes, but what follows after GetProcAddress that results in the function  being actually  called?
I searched for ond google  and,though there must be a standardised method of doing it, I could not find anything, so I could say that I found the mistery of the day unless anyone have something to add?

2019-08-18 19:29:58

@20, I would need to look at the code. I have no doubt that its a complicated mess though.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-08-18 21:02:03

Python as well doesn't do type checking behind the ctypes interface, its just type checking the values you enter from the Python side. Just like in AutoIT3, BGT and all others, you tell Python the signature of the function you're going to call, using the unified Python API that provides all primitive datatypes and even allow to form structs, but as soon as you try to call the function, all you can do is hope that the signature you provided is correct. If it isn't, you'll get a crash, no matter what. I also don't know any language except C++ that allows to properly bind C++ dlls with all the classes and stuff, maybe except Cython due its C++ functionality, but since Cython compiles down to C++ if you want to bind C++, it theoretically doesn't count.
Best Regards.
Hijacker

2019-08-18 21:34:35

@22, I thought so. Even in C++ you can only truly do type checking with classes with proper headers and good documentation. Really, the C++ side of things is really C; and with C, you have unreliable type casts. Its easy to mistype a paramter type and C will allow you to typecast to ti and then call it misproperly.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-08-19 23:21:11

I think that we deviated from the original purpose of this topic quite allot, right?
With this ockasion, I would once again request of the moderators to move the recent posts that aren't related to autoit, calling dll functions and so forth, in the topic about a new bgt implementation.
To truely finish this topic once and for all , I'd like to put forth a challenge.
Create an au3 application that embeds python3.7 as well as extend the embeded interpreter with some gui functions like GUICreate, GuiCtrlCreate* and those that are used for the event loop like GUIGetMsg.
For your solution to be accepted, it must meet the following conditions.
1: the program must be built so that it accepts the file name as the first command line argument, all the others could be safely ignored
2: the python file your program will handle should be able to open a window, create at least two gui controls and process gui events in an event loop using the functions your application provides
3: don't use any third party libraries or source code, use only built-in autoit functions
4: both the au3 and py file wich works with your solution must be present in your post in textual form, no links are allowed
5: you have only one try to do it right, any post that has edits will not be counted as solutions
6: no autoit or python sintax or obvious logical errors are allowed
7: no magic numbers are allowed, use a meaningful name instead
8: the autoit application must handle python tracebacks by displaying the information in a message box with error icon enabled, copy it to the clipboard and exit gracefully by uninitialissing the python interpreter, unloading python37.dll and terminateing

The first person who's code complies with those conditions will be declared the winner of this challenge and the first person to do it for not even the sighted did  it as far as I know.
Enjoy!

2019-08-20 23:49:01

No one is up to the challenge? I am truely impressed. Come on guys, it can't be that hard, right?