Jump to content

Plugins (deprecated)


Jon
 Share

Recommended Posts

  • 5 months later...

Hmm... since October 18, the US preseidential election, economic turmoil, politics as usual, some screamingly bad TV programming, and not much else.

Try using the search function to find whatever it is you're looking for. Or hell, do as most others do and post in the help forum. Post exactly what you're trying to do, and any code you've already tried to do it with, and someone will most likely help you, or refer you to the information you need. This stomping around on random threads and whining doesn't do anyone any good.

Link to comment
Share on other sites

  • 1 month later...

Just a quick question.

PluginOpen and PluginClose are no longer in the help file so that left me trying to determine what PluginOpen is supposed to return. I thought that it returned a handle but from what I can tell it always returns 0. VarGetType returns Int32. @error is 0 even if the plugin fails to load. If the script continues on, it ends prematurely with an "Unknown function name.:" error.

What is the proper way to check if the plugin loaded?

Link to comment
Share on other sites

There are several plugins out already and others I'm sure will create more. Regardless of whether experimental or not, the question remains valid.

Edited by eltorro
Link to comment
Share on other sites

I remember seeing that there is an Au3Check option for adding function names that don't exist... If you find it, add PluginOpen and PluginClose. As for the return value, I have no idea what is supposed to be returned.

If I'm completely wrong on that Au3Check option, I don't know, sorry.

Edited by Richard Robertson
Link to comment
Share on other sites

Just a quick question.

PluginOpen and PluginClose are no longer in the help file so that left me trying to determine what PluginOpen is supposed to return. I thought that it returned a handle but from what I can tell it always returns 0. VarGetType returns Int32. @error is 0 even if the plugin fails to load. If the script continues on, it ends prematurely with an "Unknown function name.:" error.

What is the proper way to check if the plugin loaded?

Turn your brain on, please. If the function from the plugin is not found, then the plugin is not loading correctly. Hence the 0 return value. That's a really big duh right there and is worth about seven face-palms on your part. So figure out why the plugin isn't loading and solve that issue and I bet you'll magically have a non-zero return value and the function from the plugin will work. Amazing!
Link to comment
Share on other sites

Here's the au3_check flag for plugin function names.

#AutoIt3Wrapper_plugin_funcs= _FuncOne, _FuncTwo, _FuncISkippedAFewTen, _FuncN, _FuncThaFunc, _PlayThatFuncyMusicWhiteboy

I too get a return of "0" for a loaded plugin, regardless of the plugin. I have several, just tested a bunch and they all return 0. However, the ones I tested all work, some written in FB, others c, others c++.

So, they work fine, but $plugin always returns 0, whether successful or not.

The following works whether you have a real "plugin.dll" or not.

$plugin = PluginOpen("plugin.dll")
MsgBox("0","wutsit", $plugin)

It hard crashes on load failure (wrong dll name) or using a nonexistent function (wrong function name.) In each case it returns "ERROR: _SomeFunc(): undefined function"

Link to comment
Share on other sites

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.

It looks like PluginOpen wasn't intended as the ultimate solution, so probably wasn't written with robust debugging or returns in place.

http://www.autoitscript.com/trac/autoit/ticket/263

Maybe instead of the #import directive, it might be easier to return 1 for valid load of a plugin, 0 for fail. Then the current solution would be working as intended, and the directive system could be put off until there's time or need for it?

Either way, its just a convenience for those of us using plugins, as it all still works, it just doesn't tell us explicitly.

Link to comment
Share on other sites

Bleh, I should punch Jon in the soul. You're both wrong but it's not obvious. The first handle is 0, the next is 1 and so forth. Just like FileOpen(). It's a stupid system (handle should have been arbitrary or should have started at one). The problem is PluginOpen() returns 0 for failure, too, instead of the convention of -1. I'll change it to -1 tomorrow or whenever I remember. So in 3.3.1.0 it will return -1 on failure and >= 0 on success.

Link to comment
Share on other sites

Valik,

Thanks for the update on that. I am still quite excited about Plugin's being able to more fully access AutoIt's capabilities, and this is one step in the right direction.

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Moderators

Bleh, I should punch Jon in the soul. You're both wrong but it's not obvious. The first handle is 0, the next is 1 and so forth. Just like FileOpen(). It's a stupid system (handle should have been arbitrary or should have started at one). The problem is PluginOpen() returns 0 for failure, too, instead of the convention of -1. I'll change it to -1 tomorrow or whenever I remember. So in 3.3.1.0 it will return -1 on failure and >= 0 on success.

While you're at it... could you make it return arrays as well? :)

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.

Link to comment
Share on other sites

  • Moderators

Why would PluginOpen return an array?

It wouldn't Richard :) . He's already fixing the PluginOpen() issue.

I threw a bit of sarcasm his way to fix the other issues that some of the users requested.

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.

Link to comment
Share on other sites

Bleh, I should punch Jon in the soul. You're both wrong but it's not obvious. The first handle is 0, the next is 1 and so forth. Just like FileOpen(). It's a stupid system (handle should have been arbitrary or should have started at one). The problem is PluginOpen() returns 0 for failure, too, instead of the convention of -1. I'll change it to -1 tomorrow or whenever I remember. So in 3.3.1.0 it will return -1 on failure and >= 0 on success.

Thanks Valik.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...