Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Plugins (deprecated)


  • Please log in to reply
221 replies to this topic

#1 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 30 August 2005 - 08:07 AM

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 :whistle:

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 2003

It 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 by Jon, 31 August 2005 - 08:18 AM.








#2 Raindancer

Raindancer

    Polymath

  • Active Members
  • PipPipPipPip
  • 229 posts

Posted 30 August 2005 - 08:11 AM

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 by Raindancer, 30 August 2005 - 08:12 AM.

Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer

#3 w0uter

w0uter

    resreveR nA

  • Active Members
  • PipPipPipPipPipPip
  • 2,262 posts

Posted 30 August 2005 - 11:03 AM

IMO dll call isnt an horror :whistle:
My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

#4 Raindancer

Raindancer

    Polymath

  • Active Members
  • PipPipPipPip
  • 229 posts

Posted 30 August 2005 - 11:06 AM

If you don't know 'how to' it is...
Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer

#5 MHz

MHz

    Just simple

  • MVPs
  • 5,726 posts

Posted 30 August 2005 - 12:10 PM

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? :whistle:

#6 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 30 August 2005 - 02:22 PM

AHHH!!! EXCITING new Jon !! :dance:

Can't wait for this, omg seriously, this is going to be a-w-e-s-o-m-e !! :( :D :whistle: :dance:
FootbaG

#7 MSLx Fanboy

MSLx Fanboy

    Local $Clue = 0

  • Active Members
  • PipPipPipPipPipPip
  • 1,046 posts

Posted 30 August 2005 - 02:23 PM

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())

#8 Josbe

Josbe

    Infrequent ghost ☺

  • Active Members
  • PipPipPipPipPipPip
  • 1,585 posts

Posted 30 August 2005 - 04:49 PM

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

#9 jftuga

jftuga

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 335 posts

Posted 30 August 2005 - 07:21 PM

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 by jftuga, 30 August 2005 - 07:28 PM.


#10 /dev/null

/dev/null

    Universalist

  • MVPs
  • 2,946 posts

Posted 30 August 2005 - 07:39 PM

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)


Cheers
Kurt
__________________________________________________________(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 *

#11 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 30 August 2005 - 10:53 PM

This is what the C code for a plugin function will look like:

Plain Text         
/****************************************************************************  * 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.

#12 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 30 August 2005 - 11:40 PM

Do you have a rough estimate as to when this will be released in BETA ? :whistle:
FootbaG

#13 Josbe

Josbe

    Infrequent ghost ☺

  • Active Members
  • PipPipPipPipPipPip
  • 1,585 posts

Posted 30 August 2005 - 11:48 PM

Do you have a rough estimate as to when this will be released in BETA ? :dance:

<{POST_SNAPBACK}>

Oh, recently...indeed today...
Added : PluginOpen, PluginsClose. (By Jon)
30th August, 2005 - v3.1.1.72 (beta) :whistle:

#14 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 31 August 2005 - 12:00 AM

Hehe, missread that :whistle: Thanks :dance:
FootbaG

#15 MSLx Fanboy

MSLx Fanboy

    Local $Clue = 0

  • Active Members
  • PipPipPipPipPipPip
  • 1,046 posts

Posted 31 August 2005 - 12:48 AM

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())

#16 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 31 August 2005 - 07:32 AM

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.

<{POST_SNAPBACK}>

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.

#17 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 31 August 2005 - 08:18 AM

See edited first post for download instructions.

#18 Holger

Holger

    AutoIt Spammer

  • Developers
  • 1,384 posts

Posted 31 August 2005 - 01:36 PM

See edited first post for download instructions.

<{POST_SNAPBACK}>

Hey,

the new Dev-C++ (4.9.9.2) IDE looks very good :dance:
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 !? :whistle:
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 :dance:
Holger

#19 /dev/null

/dev/null

    Universalist

  • MVPs
  • 2,946 posts

Posted 31 August 2005 - 01:45 PM

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!

Cheers
Kurt
__________________________________________________________(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 *

#20 Jon

Jon

    Up all night to get lucky

  • Administrators
  • 10,630 posts

Posted 31 August 2005 - 02:12 PM

Hey,

the new Dev-C++ (4.9.9.2) IDE looks very good :dance:
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 !?  :whistle:
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 :dance:
Holger

<{POST_SNAPBACK}>

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users