Jump to content
Sign in to follow this  
schoel

Autoit within C++

Recommended Posts

schoel

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

Share this post


Link to post
Share on other sites
Authenticity

Like what? calling AutoIt functions within your C++ project?

Share this post


Link to post
Share on other sites
schoel

Yes, that's what I meant.

Share this post


Link to post
Share on other sites
martin

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.

Share this post


Link to post
Share on other sites
syko

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?

Share this post


Link to post
Share on other sites
Authenticity

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

Share this post


Link to post
Share on other sites
martin

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.

Share this post


Link to post
Share on other sites
rahoolm

Thanks to Authenticity!

Edited by rahoolm

Share this post


Link to post
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
Sign in to follow this  

×