Administrators Jon Posted August 30, 2005 Administrators Share Posted August 30, 2005 (edited) Ever wanted to write your own C/C++ functions in a DLL and have AutoIt treat it as just another builtin function without the horrors of DllCall?After much gnashing of teeth and Jon muttering things like "but surely a pointer to a pointer can change the result of a pointer's pointer in another memory space...cant it?" - the prototype is working Edit:Plugin SDK for AutoIt 3.1.1.72+ is at http://www.autoitscript.com/autoit3/files/beta/plugin_sdk/Tested on DevC++, Visual C++ 6 and .NET 2003It is used in AutoIt like so (although the PluginOpen syntax will be removed at some point in favour of a #plugin type directive); Plugin Test Script PluginOpen("example.dll") ... ... ... PluginFunc1("some params", 0.2) Edited August 31, 2005 by Jon Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Raindancer Posted August 30, 2005 Share Posted August 30, 2005 (edited) GREAT! Never coded in C/C++ but maybe with this feature in AutoIt I'll even start to look at a real programming language. But until now AutoIt covered everything I needed. I'm looking forward to see great Plugins comming from coders who know how to :-) Edited August 30, 2005 by Raindancer Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer Link to comment Share on other sites More sharing options...
w0uter Posted August 30, 2005 Share Posted August 30, 2005 IMO dll call isnt an horror My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Raindancer Posted August 30, 2005 Share Posted August 30, 2005 If you don't know 'how to' it is... Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer Link to comment Share on other sites More sharing options...
MHz Posted August 30, 2005 Share Posted August 30, 2005 Awesome Jon. This will open new options for AutoIt's future. It must make your fingers twitchy on working on such a evolutionary concept. Please, make it happen. Oh, and DllCall. What is that? Link to comment Share on other sites More sharing options...
layer Posted August 30, 2005 Share Posted August 30, 2005 AHHH!!! EXCITING new Jon !! Can't wait for this, omg seriously, this is going to be a-w-e-s-o-m-e !! FootbaG Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted August 30, 2005 Share Posted August 30, 2005 Will we be able to put the C++ source directly into the au3 file, or will that still need to be in a separate file, and installed like a dll? Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Josbe Posted August 30, 2005 Share Posted August 30, 2005 Excellent.IMO, this surely will cause that AutoIt's stub does not increase much and will expand the possibilities according to the necessity of everyone. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
jftuga Posted August 30, 2005 Share Posted August 30, 2005 (edited) Which compiler is used to build AutoIt? Do you have to use the same compiler when creating DLLs? Also, I would like to try my hand at adding some Active Directory functions. -John Edited August 30, 2005 by jftuga Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile Link to comment Share on other sites More sharing options...
/dev/null Posted August 30, 2005 Share Posted August 30, 2005 Which compiler is used to build AutoIt? Do you have to use the same compiler when creating DLLs?excerpt from source code readme:To compile AutoIt you need one of the following compilers- Visual C++ .NET 2003 (VC 7.1) - Use AutoIt_VC7.sln- Visual C++ v6 - Use AutoIt_VC6.dsw- DevC++ - Use AutoIt_DevC.dev (Must be updated with at least the WinApi 3.1 package)CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 30, 2005 Author Administrators Share Posted August 30, 2005 This is what the C code for a plugin function will look like: expandcollapse popup/**************************************************************************** * PluginFunc1() * * This is an example function that is a simple message box that takes 2 * parameters: * * PluginFunc1("title", "text") * ****************************************************************************/ AU3_PLUGIN_DEFINE(PluginFunc1) { /* The inputs to a plugin function are: * n_AU3_NumParams - The number of parameters being passed * p_AU3_Params - An array of variant like variables used by AutoIt * * The outputs of a plugin function are: * p_AU3_Result - A pointer to a variant variable for the result * n_AU3_ErrorCode - The value for @Error * n_AU3_ExtCode - The value for @Extended */ AU3_PLUGIN_VAR *pMyResult; char *szTitle, *szText; /* Get string representations of the two parameters passed - this works even if we * were passed numbers or floats. * Note: AU3_GetString() allocates some memory that we must manually free later. */ szTitle = AU3_GetString(&p_AU3_Params[0]); szText = AU3_GetString(&p_AU3_Params[1]); /* Do the message box */ MessageBox(NULL, szText, szTitle, MB_OK); /* Free temporary storage */ AU3_FreeString(szTitle); AU3_FreeString(szText); /* Allocate and build the return variable */ pMyResult = AU3_AllocVar(); /* Set the return variable to the integer value of 1 */ AU3_SetInt32(pMyResult, 1); /* Pass back the result, error code and extended code. * Note: AutoIt is responsible for freeing the memory used in pResult */ *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 0; *n_AU3_ExtCode = 0; return AU3_PLUGIN_OK; } This could then be called in AutoIt as "PluginFunc1("title", "text")". If the parameters were handles or numbers then just as in AutoIt they would be converted to strings (by the AU3_Getxxxxx) functions automatically. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
layer Posted August 30, 2005 Share Posted August 30, 2005 Do you have a rough estimate as to when this will be released in BETA ? FootbaG Link to comment Share on other sites More sharing options...
Josbe Posted August 30, 2005 Share Posted August 30, 2005 Do you have a rough estimate as to when this will be released in BETA ? <{POST_SNAPBACK}>Oh, recently...indeed today...Added : PluginOpen, PluginsClose. (By Jon) 30th August, 2005 - v3.1.1.72 (beta) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
layer Posted August 31, 2005 Share Posted August 31, 2005 Hehe, missread that Thanks FootbaG Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted August 31, 2005 Share Posted August 31, 2005 May I suggest that the help file clearly states that Plugin*() is designed for DLLs designed for AutoIt, and not DLLs in general, it might cause some confusion otherwise. Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 31, 2005 Author Administrators Share Posted August 31, 2005 May I suggest that the help file clearly states that Plugin*() is designed for DLLs designed for AutoIt, and not DLLs in general, it might cause some confusion otherwise.We are probably not going to use the PluginOpen/Close syntax in favour of a #plugin directive at the top of the script which will have some additional benefits especially with compiled scripts. The PluginOpen thing is just for easy testing of the DLL part to make sure that the concept works. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 31, 2005 Author Administrators Share Posted August 31, 2005 See edited first post for download instructions. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Holger Posted August 31, 2005 Share Posted August 31, 2005 See edited first post for download instructions.<{POST_SNAPBACK}>Hey,the new Dev-C++ (4.9.9.2) IDE looks very good Better than I have seen it a few month ago...Strangely is the size of a compiled dll by Dev-C++ -> is very much smaller than with VC6 or VC7 !? Maybe I did something wrong...if not then it's great But it is/will be a great enhancement to AutoIt3 with using DllCall/DllStruct/#plugin.@Jon: don't know if it is right positioned in Idealab but if this "plugin"-functionality works and is ready so far (with the #plugin) then maybe there should be a new forum entry like "Plugins" where everyone can post her/his plugins.Thanks so far Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
/dev/null Posted August 31, 2005 Share Posted August 31, 2005 See edited first post for download instructions.<{POST_SNAPBACK}>Jon,could you please post some more information on how the params are beeing passed (by value or by reference) and how (or if) one can modify the params in the plugin function. I tried to play a bit with your sample code, and after I called a newly created function in the AU3 script, I had very strange effects in the rest of the script, like:* msgbox() had a title text, although there was no one defined ??* there have been errors to parse the script, like "$var used before declared", although it has been declared just a line before that statement* "Trailing characters" error after the last character of that line.So I guess, I broke something when I tried to modifiy the passed parameters !??!Thanks!CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 31, 2005 Author Administrators Share Posted August 31, 2005 Hey,the new Dev-C++ (4.9.9.2) IDE looks very good Better than I have seen it a few month ago...Strangely is the size of a compiled dll by Dev-C++ -> is very much smaller than with VC6 or VC7 !? Maybe I did something wrong...if not then it's great But it is/will be a great enhancement to AutoIt3 with using DllCall/DllStruct/#plugin.@Jon: don't know if it is right positioned in Idealab but if this "plugin"-functionality works and is ready so far (with the #plugin) then maybe there should be a new forum entry like "Plugins" where everyone can post her/his plugins.Thanks so far HolgerLike all Mingw code it is dependant on msvcrt.dll. The visual C versions have everything built in. There is probably some switch to turn off this but it's generally "a good thing". Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now