Jump to content

Converting Au3 to C++?


Recommended Posts

  • Replies 72
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 2 weeks later...

only read the first two pages... and i have to go right now (5 mins ago) but isnt the point of open source code for people to make it better and make it have less bugs than it does already? how many ppl know autoit compared to how many ppl know C/C++? so in the end how many ppl would u have to help make it better in autoit? in C/C++? That is one of the only reasons i would want an Autoit to C++ converter... cya now :whistle:

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

Link to comment
Share on other sites

  • 2 months later...
  • Developers

Sorry to bump the thread but, is there ever going to be a AutoIT to C++ converter. I'd really like to see one.

depends if/when somebody will build it.... i doubt that Jon will ever start with it himself

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

don't you think it's foolish to keep this topic open?

I am sure when I close it somebody will open a new one ... :whistle:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Has anybody mentioned BCX? It's not converting AutoIt directly but should be a great tool to use if you really badly want to do a conversion. JdeB should be able to comment, I think?

Link to comment
Share on other sites

  • Moderators

Why not make a sticky containing the reasons for and against this?

A sticky? lol... I can't even see Valik being against it if he doesn't have to do the work himself. Now, the Pros and Cons of doing it maybe... but who would be against someone taking it upon themselves for such an in depth task?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I wouldn't say I'm against it but I think the idea is stupid. There's a big difference between writing something so that it works in a scripting language and writing something so that it works. A number of "simple" things in AutoIt requires lots of complex code to pull off. Lots of things do things in ways that cater to a scripting language but wouldn't necessarily be the best way to write something in C++ from scratch. Then there's also the fact that the two languages are only remotely similar. One thing that would be a major hurdle is types. The C++ code would have to use some sort of Variant class since AutoIt is typeless. Variants have special uses but are not a general purpose "type" in C++. For one thing, the notion of type safety is gone.

If you want C++ code with AutoIt functionality, use AutoItX and C++. A converter from AutoIt to C++ will generate sometimes unnecessarily complex and slow code compared to what could be written from scratch in C++.

Link to comment
Share on other sites

  • Developers

Has anybody mentioned BCX? It's not converting AutoIt directly but should be a great tool to use if you really badly want to do a conversion. JdeB should be able to comment, I think?

This exercise convinced me that it is quiet difficult to ever do something like BCX does and have everybody use it (read people without any true programming experience)

BCX converts your code perfectly, but you still get an c00005 crash when you dim a string of 10 chars and try to store 11 characters in it ....

In other words, you need to understand programming basics and C before you can work with BCX.

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I know, old topic and probably a bad idea but, instead of going AutoIt -> C++, how about C/C++ -> AutoIt? I know I have run accross a few C functions I would like to use in AutoIt but I don't know how to convert them.

A little reading goes a long way. Post count means nothing.

Link to comment
Share on other sites

The problems with converting Au3->C++ are numerous, but think of the time saver if it was done right. I mean, I can whip up a little GUI in seconds with Au3 (hell I've even written a couple framework sets in Au3) and if I could convert it to C++ and then add in the finer code later...

We all know the problems with Au3 (my biggest peeve is the lack of multi-threading) aswell as the strengths. It would be rather simple (logically speaking) to convert from Au3->C++ if a certain set of rules were kept. For example, I ALWAYS use prefixed variables which could be easily recognized.

Dim $i_Iter, $b_Even, $sz_Number

For $i_Iter = 0 to 100
    If (mod($i_Iter,2) == 0) Then
        $b_Even = True
    EndIf

    Switch ($i_Iter)
        Case 1
            $sz_String = "One"
        Case 2
            $sz_String = "Two"
        ;On and on....
    EndSwitch
Next

Rather simple code that does nothing important is easily converted to C++:

#include <stdio.h>
#include <string.h>


int main()
{
    int i_Iter;
    bool b_Even;
    char sz_String[25];

    for (i_Iter = 0;i_Iter < 100;i_Iter++)
    {
        if (i_Iter % 2) == 0) b_Even = true;

        switch (i_Iter)
        {
            case 1: {   strcpy(sz_String,"One");break;  }
            case 2: {   strcpy(sz_String,"Two");break;  }
            /* On and on and on */
        }
    }

    return 0;
}

Granted, this isn't very complex, but for the most-part, neither is Au3. Since it is written in C++, it makes sense that it could be converted to C++ by use of function copies. If I use PixelSearch, it copies the C++ Pixelsearch function (and all needed libs) to my converted code. Yes, I'm aware it isn't that easy, but the general idea is sound.

F*** it, I'll give it a shot. Time to get started writing a huge switch to encompas the general functions in Au3 to C++.

-CMR

Link to comment
Share on other sites

Good luck with that. Tell us when you give up.

oh, that was encouraging :whistle: Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

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