Jump to content
Sign in to follow this  
Kanit

Help file on AutoIt WIN APIs

Recommended Posts

Kanit

I am facing problems in using AutoIt WIN APIs as parameters to these APIs are bit different compared to call in the AutoIt script. Does any one know where I can get help file on AutoIt WINAPIs? along with some simple examples?

Share this post


Link to post
Share on other sites
SmOke_N

I am facing problems in using AutoIt WIN APIs as parameters to these APIs are bit different compared to call in the AutoIt script. Does any one know where I can get help file on AutoIt WINAPIs? along with some simple examples?

There's no "Help file" per say specifically on AutoIt's use of the Win API library. There are options in the help file however than have several (if not all of them) functions under _WinAPI_* functions (look at the index tab of your help file and scroll down toward the end).

You won't find many examples with them, but you will find the parameters required and what specifically you can use with them.

Edit:

And if you're using another language, I'm sure their API calls are available, so I'm left to assume that you are posting in the wrong forum... Moving to Support.

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.

Share this post


Link to post
Share on other sites
Kanit

There's no "Help file" per say specifically on AutoIt's use of the Win API library. There are options in the help file however than have several (if not all of them) functions under _WinAPI_* functions (look at the index tab of your help file and scroll down toward the end).

You won't find many examples with them, but you will find the parameters required and what specifically you can use with them.

Edit:

And if you're using another language, I'm sure their API calls are available, so I'm left to assume that you are posting in the wrong forum... Moving to Support.

Hi,

I have even looked at these _WinAPI_* functions, but it did not help me in resolving my problem.

To be specific, I am trying to use AU3_WinGetHandle() API in my project (VC++). As per the help file, it should take only Title and text as the parameter but if you look at the prototype of AU3_WinGetHandle() in AutoIt3.h it takes few more parameters.

If I try compiling my code (given only Title parameter to WinGetHandle) , it gives an error "function does not take one parameter"

Please let me know the correct place where I can post my query??

Share this post


Link to post
Share on other sites
ACS

Check out Microsoft's MSDN for a complete WinAPI function reference.

http://msdn.microsoft.com/en-us/library/aa383749(VS.85).aspx

Don't forget to expand the sidebar at the left!

MSDN is by far the best reference. If you need an example using a particular function, you can try Googling for "winapi functionaname example" or something similar (without the quotes.)

Edited by ACS

Share this post


Link to post
Share on other sites
SmOke_N

Hi,

I have even looked at these _WinAPI_* functions, but it did not help me in resolving my problem.

To be specific, I am trying to use AU3_WinGetHandle() API in my project (VC++). As per the help file, it should take only Title and text as the parameter but if you look at the prototype of AU3_WinGetHandle() in AutoIt3.h it takes few more parameters.

If I try compiling my code (given only Title parameter to WinGetHandle) , it gives an error "function does not take one parameter"

Please let me know the correct place where I can post my query??

That's a much better explanation thanks (moved back to the original forum, you did post correctly).

WinGetHandle "title" [, "text"]
Those are the two parameters you can use.

If you're being forced to use both, and don't wish to use the 2nd parameter, just send it blank.

pseudo:

HWND hWnd = oAutoIt.WinGetHandle("My Title", "")

Edit:

Keep in mind, that the "Old" source (which is what undoubtedly you are looking at with AutoIt.h) may conflict with the new. In addition, those may be helper functions for the output you receive.

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.

Share this post


Link to post
Share on other sites
Kanit

Can you please explain bit more on why you are specifying it as "Old" source?? If what I am reffering to is old then could you please tell me where I can find new source?? Because I did a full install of AutoIt from URL http://www.autoitscript.com/

and I copied autoit.h + AutoItX3.dll + AutoItX3.lib from installed directory to my VC++ project path and I am trying to use APIs defined in autoit.h file in my project (I have also included lib into my project settings).

my code is something like below:

int APIENTRY WinMain(HINSTANCE hInstance,

HINSTANCE hPrevInstance,

LPSTR lpCmdLine,

int nCmdShow)

{

HWND hwnd, pphwnd;

int item_index = 0;

// TODO: Place code here.

AU3_Sleep(200);

AU3_Send("#r", 0);

AU3_WinWaitActive("Run", "", 0);

AU3_Send("control printers", 0);

AU3_WinWaitActive("Printers", "", 10);

//Get Printers window handle

//pphwnd = AU3_WinGetHandle("Printers and Faxes","",0);

//if (pphwnd == 0)

//{

//ShowMessage (hWnd, Temp, 1);

//return 1;

//}

//Try to locate and select the printer

item_index = AU3_ControlListView(GetString(2) ,"","SysListView32","FindItem", printer);

if (item_index) {

AU3_ControlListView(GetString(2) ,"","SysListView32","Select", item_index);

}

//more code here...

}

If I try to compile above code it throws error like

error C2660: 'AU3_ControlListView' : function does not take 5 parameters.

When I looked for AU3_ControlListView prototype in the header file it takes few more parameters like "buffsize" etc about which I dont have any clue !!!!!

Regards

Kanit

That's a much better explanation thanks (moved back to the original forum, you did post correctly).

Those are the two parameters you can use.

If you're being forced to use both, and don't wish to use the 2nd parameter, just send it blank.

pseudo:

HWND hWnd = oAutoIt.WinGetHandle("My Title", "")

Edit:

Keep in mind, that the "Old" source (which is what undoubtedly you are looking at with AutoIt.h) may conflict with the new. In addition, those may be helper functions for the output you receive.

Share this post


Link to post
Share on other sites
Kanit

Can you please explain bit more on why you are specifying it as "Old" source?? If what I am reffering to is old then could you please tell me where I can find new source?? Because I did a full install of AutoIt from URL http://www.autoitscript.com/

and I copied autoit.h + AutoItX3.dll + AutoItX3.lib from installed directory to my VC++ project path and I am trying to use APIs defined in autoit.h file in my project (I have also included lib into my project settings).

my code is something like below:

int APIENTRY WinMain(HINSTANCE hInstance,

HINSTANCE hPrevInstance,

LPSTR lpCmdLine,

int nCmdShow)

{

HWND hwnd, pphwnd;

int item_index = 0;

// TODO: Place code here.

AU3_Sleep(200);

AU3_Send("#r", 0);

AU3_WinWaitActive("Run", "", 0);

AU3_Send("control printers", 0);

AU3_WinWaitActive("Printers", "", 10);

//Get Printers window handle

//pphwnd = AU3_WinGetHandle("Printers and Faxes","",0);

//if (pphwnd == 0)

//{

//ShowMessage (hWnd, Temp, 1);

//return 1;

//}

//Try to locate and select the printer

item_index = AU3_ControlListView(GetString(2) ,"","SysListView32","FindItem", printer);

if (item_index) {

AU3_ControlListView(GetString(2) ,"","SysListView32","Select", item_index);

}

//more code here...

}

If I try to compile above code it throws error like

error C2660: 'AU3_ControlListView' : function does not take 5 parameters.

When I looked for AU3_ControlListView prototype in the header file it takes few more parameters like "buffsize" etc about which I dont have any clue !!!!!

Regards

Kanit

Hello,

Anybody can help on this ???

Regards

Kanit

Share this post


Link to post
Share on other sites
Jon

1) MSDN help can be also downloaded as offline ISO files

2) In Delphi 5 is included also Win32 API documentation - free downloadable - Look here

He's not asking about anything to do with MSDN or the Win32 API he's asking about the AutoItX DLL prototypes.

Lots of the AutoIt string functions take a string pointer and a bufsize. If you pass a string pointer that was allocated like this:

LPSTR szString = new char[100];

Then the bufsize parameter would be 100.

Share this post


Link to post
Share on other sites
Kanit

He's not asking about anything to do with MSDN or the Win32 API he's asking about the AutoItX DLL prototypes.

Lots of the AutoIt string functions take a string pointer and a bufsize. If you pass a string pointer that was allocated like this:

LPSTR szString = new char[100];

Then the bufsize parameter would be 100.

Hi,

I tried this, but not very successfull.

I tried few of the functions:

char result[100]; //declared a char array of 100

AU3_ControlListView("Printers and Faxes" ,"","SysListView321","FindItem", "DocuColor 240-250 PCL v1.2","", result, 100);

Result: 1. Function AU3_ControlListView() does not succeed (AU3_error() returns 1)

2. Nothing is getting stored in result (index of the item given is expected to be stored in result)

even much simpler functions are failing:

AU3_ControlListView("Printers and Faxes" ,"","SysListView321","SelectAll","","", result, 100);

result: 1. fails to select all the items of printers and Faxes window

2. AU3_error returns 1

Regards

Kanit

Share this post


Link to post
Share on other sites
Kanit

Are you using the beta version? ControlListView was broken in 3.2.10.0 (only recently found out).

I dont think its Beta version. I installed AutoIt (version 3) from following URL http://www.autoitscript.com/

Are you sure that ControlListView was broken in 3.2.10.0??? Functions failing in my code is making me to believe what you are saying.!!!!

Any remidy???? any alternatives available??

Regards

Kanit

Share this post


Link to post
Share on other sites
Jon

I dont think its Beta version. I installed AutoIt (version 3) from following URL http://www.autoitscript.com/

Are you sure that ControlListView was broken in 3.2.10.0??? Functions failing in my code is making me to believe what you are saying.!!!!

Any remidy???? any alternatives available??

Regards

Kanit

Yes, download the beta version where it should be fixed. New non-beta version _should_ be soon.

http://www.autoitscript.com/autoit3/files/beta/autoit/

Share this post


Link to post
Share on other sites
Kanit

Yes, download the beta version where it should be fixed. New non-beta version _should_ be soon.

http://www.autoitscript.com/autoit3/files/beta/autoit/

Hi,

Thanks..it looks to be working fine in beta version :)

I am able to work successfully with controlListView API, some of the other APIs are doesnt seem to work !!!!

1. AU3_ControlClick() API ---> does not work with tabbed window

2. AU3_ControlCommand API ---> does not work with tabbed window

For example,

ret_val1 = AU3_ControlFocus("Properties", "Ports", "SysTabControl321");

ret_val1 = AU3_ControlClick("Properties","Ports","SysTabControl321","left",1,AU3_INTDEFAULT,AU3_INTDEFAULT);

does not navigate to the Ports tab.

Any Clues???

Regards

Kanit

Edited by Kanit

Share this post


Link to post
Share on other sites
Kanit

Hi,

Thanks..it looks to be working fine in beta version :)

I am able to work successfully with controlListView API, some of the other APIs are doesnt seem to work !!!!

1. AU3_ControlClick() API ---> does not work with tabbed window

2. AU3_ControlCommand API ---> does not work with tabbed window

For example,

ret_val1 = AU3_ControlFocus("Properties", "Ports", "SysTabControl321");

ret_val1 = AU3_ControlClick("Properties","Ports","SysTabControl321","left",1,AU3_INTDEFAULT,AU3_INTDEFAULT);

does not navigate to the Ports tab.

Any Clues???

Regards

Kanit

Hello,

Does anybody know

ret_val1 = AU3_ControlFocus("Properties", "Ports", "SysTabControl321");

ret_val1 = AU3_ControlClick("Properties","Ports","SysTabControl321","left",1,AU3_INTDEFAULT,AU3_INTDEFAULT);

these APIs work or not? Is it a limitation in AutoIt??

Regards

Kanit

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  

×