Jump to content

Autoit in C++


xZZTx
 Share

Recommended Posts

ok i have goten board with autoit's speed so i thought if i just had my autoit commands run right to C++ then it would fix the lack of speed

but i have no idea on how todo this...

so far i used this

but now im stuck on.. how do i add an include.. would i have to convert the scrips?!

*EDIT*

Well this is BS...

This Works

AU3_Sleep(1000);
    AU3_Run("notepad.exe", "", 1);
    AU3_WinWaitActive("Untitled -", "", 0);
    AU3_Send("Hello{!}", 0);

But This Does Not

AU3_Func TogglePause();
    $Paused = NOT $Paused;
    AU3_While $Paused;
        AU3_sleep(100);
        AU3_ToolTip('Bot is "Paused"');
    AU3_WEnd;
    AU3_ToolTip("");
    AU3_EndFunc;

WTH!

Edited by xZZTx
Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times..
Link to comment
Share on other sites

  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Ya Learning C++ 1st would be a smart move...

and i kinda have something working it just can't do variables like $Test any format i need to follow for that?!

Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times..
Link to comment
Share on other sites

Ya Learning C++ 1st would be a smart move...

and i kinda have something working it just can't do variables like $Test any format i need to follow for that?!

Variables in C++ don't begin with a '$'. :P

int x = 100;
float y = 250.245f;
double z = 12.0005;
char str[] = "hello world";

You need to learn (and I mean actually learn) C++ first. :P

Personally, I find using AutoItX in C++ pointless anyways. AutoItX is written in C++ - so every function you are calling is just calling another function in C++. Why not just do it in C++ the first time around?

Edited by cppman
Link to comment
Share on other sites

They can begin with a dollar sign. They just aren't declared by assignment.

You can declare

int $i;

if you wanted.

#include <iostream>
using namespace std;
int main() {
    char * $Text = "This is a test";
    cout<<$Text;
    getchar();
}

Hmm, That's cool. Learn something new every day.

Edited by KentonBomb
Link to comment
Share on other sites

They can begin with a dollar sign. They just aren't declared by assignment.

You can declare

int $i;

if you wanted.

I prefer dollar signs in front of my identifiers. I think this option is compiler specific though.
Link to comment
Share on other sites

weaponx is correct. Most compilers support it, but it's a non-standard feature, as I recall.

cppman, to answer your question: Because AutoIt does a lot behind the scenes. Do you use STL, ATL, MFC, WTL, TR1, boost or some other library? Those are all written in C++ so your argument for not using AutoItX applies to them as well. But I'm sure you use something to make your life easier.

Link to comment
Share on other sites

cppman, to answer your question: Because AutoIt does a lot behind the scenes. Do you use STL, ATL, MFC, WTL, TR1, boost or some other library? Those are all written in C++ so your argument for not using AutoItX applies to them as well. But I'm sure you use something to make your life easier.

I just meant because most of the functions AutoItX implements are just a couple of lines using the Windows API (as far as I've seen, in the AutoIt source). I don't especially like the STL, but I do use it every once in a while. However, I completely hate, and refuse to use ATL/MFC/WTL and boost. (Never used TR1. I don't even know what it is.)

But, I understand what you're saying. Personally, I just don't think it is worth having an external DLL for such simple functions.

Edited by cppman
Link to comment
Share on other sites

  • Moderators

I just meant because most of the functions AutoItX implements are just a couple of lines using the Windows API (as far as I've seen, in the AutoIt source). I don't especially like the STL, but I do use it every once in a while. However, I completely hate, and refuse to use ATL/MFC/WTL and boost. (Never used TR1. I don't even know what it is.)

But, I understand what you're saying. Personally, I just don't think it is worth having an external DLL for such simple functions.

So saving time in actually having to code all those functions (regardless of the few lines) isn't reason enough for you? I admit, I've written my own functions based off of autoits interpretation of use, but ... not everyone is as masochistic I'm sure.

Edit:

Oh... and Send() is just a "few" lines in C++? ... Man, the one I wrote was like 1K lines ... I suck ;) .

Edited by SmOke_N

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

So saving time in actually having to code all those functions (regardless of the few lines) isn't reason enough for you? I admit, I've written my own functions based off of autoits interpretation of use, but ... not everyone is as masochistic I'm sure.

Edit:

Oh... and Send() is just a "few" lines in C++? ... Man, the one I wrote was like 1K lines ... I suck :D .

Unless you type 3 words per minute, it isn't a problem (at least not for me). Especially when you now have the code right there to edit and modify to you're likings. If it is a problem, you could even just use the code from the AutoIt public source code. ;)

Without taking into account parsing and character case, a simple send function....

void Send(const char *text)
{
    const char *src = text;
    while (*src != '\0')
    {
        UINT vk = VkKeyScanA(*src);
        keybd_event(vk, MapVirtualKeyA(vk, 0), 0, 0);
        Sleep(10);
        src++;
    }
}
Edited by cppman
Link to comment
Share on other sites

Unless you type 3 words per minute, it isn't a problem (at least not for me).

Yes because it's the writing of code that takes the most time. <insert eye rolling emoticon here>

Especially when you now have the code right there to edit and modify to you're likings. If it is a problem, you could even just use the code from the AutoIt public source code. ;)

Without taking into account parsing and character case, a simple send function....

void Send(const char *text)
 {
     const char *src = text;
     while (*src != '\0')
     {
         UINT vk = VkKeyScanA(*src);
         keybd_event(vk, MapVirtualKeyA(vk, 0), 0, 0);
         Sleep(10);
         src++;
     }
 }
So without doing everything that makes the Send() function useful? Right. That's really an apples to apples comparison right there.

If you choose not to use libraries that's fine but please don't advocate the non-use of them, especially in threads where it's clear the OP doesn't know much if anything about C++. In most cases it makes far more sense to use well-tested libraries, even if they are "just a couple lines", than it does to write everything from scratch.

Link to comment
Share on other sites

  • Moderators

Unless you type 3 words per minute, it isn't a problem (at least not for me). Especially when you now have the code right there to edit and modify to you're likings. If it is a problem, you could even just use the code from the AutoIt public source code. ;)

Without taking into account parsing and character case, a simple send function....

void Send(const char *text)
{
    const char *src = text;
    while (*src != '\0')
    {
        UINT vk = VkKeyScanA(*src);
        keybd_event(vk, MapVirtualKeyA(vk, 0), 0, 0);
        Sleep(10);
        src++;
    }
}
That's nothing like autoit's send().

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

If you choose not to use libraries that's fine but please don't advocate the non-use of them, especially in threads where it's clear the OP doesn't know much if anything about C++. In most cases it makes far more sense to use well-tested libraries, even if they are "just a couple lines", than it does to write everything from scratch.

All right.

edit:

Yes because it's the writing of code that takes the most time. <insert eye rolling emoticon here>

If the person is going to use C++, then research comes with it. Obviously, if the original poster is trying to use real AutoIt code in C++, then the original poster shouldn't even be using AutoItX in C++ (let alone C++ itself). Just my opinion... Edited by cppman
Link to comment
Share on other sites

I don't think i could really sit down and learn C++ i just have to play with it till i get it right like i did with autoit

but right now i have learn a little bit like how to use variables...and i used $ because its what is used in autoit

i tryed this code and it kinda worked..

{

    while(1) 
    {
    int X = AU3_MouseGetPosX();
    int Y = AU3_MouseGetPosY();
    AU3_ToolTip(X & Y,"1000","300");
    }

    return 0;
}

then i got

1>.\main.cpp(20) : error C2664: 'AU3_ToolTip' : cannot convert parameter 1 from 'int' to 'const char *'

any fix?

Also..

Can i even use int X = AU3_MouseGetPosX(); ?!

Edited by xZZTx
Sorry For Any Spelling / Grammar Errors I May Make.... I Failed English Wayyyy To Many Times..
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...