Jump to content

Autoit within C++


schoel
 Share

Recommended Posts

Hello,

I am sure my question has been asked before but after search for it, I can not find anything, probably because I don't know what to search for.

How do I get Autoit to work within C++? I want to do it without any IDEs

Thanks for any help

Joel

Link to comment
Share on other sites

Hello,

I am sure my question has been asked before but after search for it, I can not find anything, probably because I don't know what to search for.

How do I get Autoit to work within C++? I want to do it without any IDEs

Thanks for any help

Joel

You need AutoItX. It's supplied with the AutoIt download, look in Program Files\AutoIt3\AutoItX. There's a help file there to explain it all.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

// Empty project additions:
//      Added "AutoIt3.h" include
//      Added "AutoItX3.lib" to the input linker libraries
//
// AutoItX3.dll needs to be in the run path during execution

#include <Windows.h>
#include <tchar.h>
#include "AutoIt3.h"

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR   lpCmdLine,
                     int       nCmdShow)
{
    // You can now call AutoIt commands, e.g. to send the keystrokes "hello"
    AU3_Sleep(1000);
    AU3_Run(_T("notepad.exe"), _T(""), 1);
    AU3_WinWaitActive(_T("Untitled -"), _T(""), 0);
    AU3_Send(_T("Hello{!}"), 0);

    // Get the text in the status bar
    //char szText[1000];
    //AU3_StatusbarGetText("Untitled -", "", 2, szText, 1000);
    //MessageBox(NULL, szText, "Text:", MB_OK);

    return 0;
}

This is the example file provided with AutoIt installation. You'll need to change few things because for some reason it call function with LPCWSTR instead of LPCTSTR so you'll need to use the wide version or just change every occurrence using CTRL+H in the development environment as an easy solution. Also make sure the dll is in the same folder as the project or the system's folder, and that the linker input includes the AutoItX3.lib file.

Link to comment
Share on other sites

i look in autoitx help file but it give no help, only C++ code. could someone give example of how to do a few things in C++ with the autoit dll?

Do you mean it only give VB code?

For a C++ example look in \Program Files\AutoIt3\AutoItX\StandardDLL\VC6\Example.

For support it's best to use use the ActiveX/COM Help and Support (AutoItX) forum.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 1 year later...

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