Administrators Jon Posted August 31, 2005 Author Administrators Share Posted August 31, 2005 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!CheersKurtYou don't touch the passed parameters except through the AU3_Getnnnn Functions. Like normal internal AutoIt functions there is no byref equivalent. The only variables you can change are the single return result and @error/@extended. 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...
AznSai Posted August 31, 2005 Share Posted August 31, 2005 Quick question, will plugins be included into a compiled script or will the plugin have to be distributed along with your compiled script? Link to comment Share on other sites More sharing options...
/dev/null Posted August 31, 2005 Share Posted August 31, 2005 Quick question, will plugins be included into a compiled script or will the plugin have to be distributed along with your compiled script?<{POST_SNAPBACK}>Currently, the compiled exe needs the dll, however, you can use FileInstall() to pack the dll into the exe.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...
Josbe Posted August 31, 2005 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...ohh..thanks for the info! @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<{POST_SNAPBACK}>Yes, I agree. Like AutoItX forum. 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 Hey,the new Dev-C++ (4.9.9.2) IDE looks very good Better than I have seen it a few month ago...<{POST_SNAPBACK}>I've had the 4.9.9.2 for a few months now ... But yes, it is very nice... FootbaG Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 6, 2005 Author Administrators Share Posted September 6, 2005 Has anyone used this feature yet? I'd like to make sure it actually works for one thing before I change anything else 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 September 6, 2005 Share Posted September 6, 2005 @Jon: I started writing some Service-functions for testing. The only thing I'm missing at the moment is to return an (multi)array. At the moment I'm doing it like: A|1 B|2 C|3 returns a string "A|1 LineFeed B|2 LineFeed C|3". So long 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 September 6, 2005 Share Posted September 6, 2005 (edited) Has anyone used this feature yet? I'd like to make sure it actually works for one thing before I change anything else <{POST_SNAPBACK}>Should the following work? AU3_SetString(pMyResult,"Hello World");I used your sample code, and changed the return value from int to string but I'm not getting the string when I return that value. Instead msgbox shows this: 6581362. int and real retrun values are O.K.Here is the AU3 code:$handle = PluginOpen("example.dll") $retval = PluginFunc1("Hello", "Test") msgbox(0,"",$retval) PluginClose($handle)Am I doing something wrong? Thanks!EDIT: I'm using Dev-C++ 4.9.9.2EDIT#2: Also:This works (shows "12345" in the message box) pMyResult = AU3_AllocVar(); AU3_SetInt32(pMyResult, 12345); szText = AU3_GetString(pMyResult); MessageBox(NULL, szText, szTitle, MB_OK);while this does not (shows strange characters instead of "Hello World")pMyResult = AU3_AllocVar(); AU3_SetString(pMyResult,"Hello World"); szText = AU3_GetString(pMyResult); MessageBox(NULL, szText, szTitle, MB_OK);CheersKurt Edited September 6, 2005 by /dev/null __________________________________________________________(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...
/dev/null Posted September 6, 2005 Share Posted September 6, 2005 (edited) Should the following work?AU3_SetString(pMyResult,"Hello World");I guess the problem is the call of AU3_FreeVar() in AU3_SetString(), as at the end of AU3_FreeVar() the allocated memory for the variable is released as well, while only m_szValue should be freed.void AU3_FreeVar(AU3_PLUGIN_VAR *pVar) { if (pVar == NULL) return; if (pVar->m_nType == AU3_PLUGIN_STRING) free(pVar->m_szValue); free(pVar); <=== HERE }I "wrote" a second function, called AU3_FreeVarContent(), without the last free() and it seems to work now.CheersKurt Edited September 6, 2005 by /dev/null __________________________________________________________(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...
/dev/null Posted September 6, 2005 Share Posted September 6, 2005 ... still not working, with a strange effect.... This does not work. pMyResult = AU3_AllocVar(); /* Set the return variable to the integer value of 1 */ AU3_SetString(pMyResult,"Hello World"); szText = AU3_GetString(pMyResult); MessageBox(NULL, szText, "Title", MB_OK); AU3_FreeString(szText); *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 5555; *n_AU3_ExtCode = 6666; It triggers an error in the AU3 script: msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended) msgbox(0,"",$retval & " @error: " & ^ERROR Error: Unknown macro. While this does work (somehow at least), however the output string is kind of "damaged" ..... (i just added 12345 to the messagebox text). pMyResult = AU3_AllocVar(); /* Set the return variable to the integer value of 1 */ AU3_SetString(pMyResult,"Hello World12345"); <== ADDED 12345 !! szText = AU3_GetString(pMyResult); MessageBox(NULL, szText, "Title", MB_OK); AU3_FreeString(szText); *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 5555; *n_AU3_ExtCode = 6666; Output of msgbox: Hello World12345error5555 @extended: 6666 Should be: Hello World12345 @error: 5555 @extended: 6666 msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended) So, the @ and the : are "cut" out !???! I guess I'm doing something completely wrong..... @Holger how did you return the strings? Which compiler do you use? 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 * Link to comment Share on other sites More sharing options...
Administrators Jon Posted September 6, 2005 Author Administrators Share Posted September 6, 2005 pMyResult = AU3_AllocVar(); AU3_SetString(pMyResult,"Hello World"); *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 5555; *n_AU3_ExtCode = 6666; Don't set and then reread the result variable, just write to it once...for the result. The Get functions are for reading the input parameters only. 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 September 6, 2005 Author Administrators Share Posted September 6, 2005 @Jon: I started writing some Service-functions for testing.The only thing I'm missing at the moment is to return an (multi)array.At the moment I'm doing it like:A|1B|2C|3returns a string "A|1 LineFeed B|2 LineFeed C|3".So long HolgerHmm, yes, arrays. That will need some work - it may not be pretty either (like the internal array setting code) 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...
/dev/null Posted September 6, 2005 Share Posted September 6, 2005 (edited) pMyResult = AU3_AllocVar(); AU3_SetString(pMyResult,"Hello World"); *p_AU3_Result = pMyResult; *n_AU3_ErrorCode = 5555; *n_AU3_ExtCode = 6666;Don't set and then reread the result variable, just write to it once...for the result. The Get functions are for reading the input parameters only.<{POST_SNAPBACK}>Ah, O.K. I did that now, but I'm still getting the AU3 error.msgbox(0,"",$retval & " @error: " & @error & " @extended: " & @extended)msgbox(0,"",$retval & " @error: " & ^ERRORError: Unknown macro.Attached you'll find the plugin source code, the dll and the AU3 script. Hopefully somebody can reproduce this....Very strange: I do get different errors with the same script, when I add some comments at the end of one script !???!Can somebody please test this with the attached files?EDIT: I'm getting a different error, when I use the original AU3_FreeVar() call. See error.jpg in second attached ZIP. That's again the problem I described in my previous posts AND the output string is kind of "damaged" also here. "@extended: 6666" becomes "extended6666". Where is the "@" and ": " ??? And, what's 6581362 in the message box. It should be "Hello World"....ThanksKurtplugin_problems.zipplugin_problem_2.zip Edited September 6, 2005 by /dev/null __________________________________________________________(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 September 6, 2005 Author Administrators Share Posted September 6, 2005 Mistake in the example I did. #define NUMFUNCS should be 1 not 2 - will cause some overflow errors. Try that. Otherwise the code looks correct. 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...
/dev/null Posted September 6, 2005 Share Posted September 6, 2005 (edited) Mistake in the example I did. #define NUMFUNCS should be 1 not 2 - will cause some overflow errors. Try that. Otherwise the code looks correct.<{POST_SNAPBACK}>O.K. I changed that, unfortunately I get the same error. Do you get the same errors with the DLL I sent? Could it be a problem with Dev-C++ ?? Unfortunately I don't have VC6 to test it with.What about the "problem" in AU3_FreeVar I mentioned in an earlier post? If I don't change that code I will get that strange return value of 6581362. If I change the AU3_FreeVar code (delete free(pVar)), I get the correct return value ("Hello World"), however there seem to be some overflow errors (see last posts). EDIT:Why is the allocated memory of the variable freed in AU3_FreeVar()? AU3_FreeVar() is used at the beginning of all AU3_Setxxx functions, which will release the memory area of the plugin variable, allocated in AU3_AllocVar(). However, within the functions AU3_Setxxx the variable is still used.void AU3_SetInt32(AU3_PLUGIN_VAR *pVar, int nValue) { AU3_FreeVar(pVar); pVar->m_nType = AU3_PLUGIN_INT32; pVar->m_nValue = nValue; }CheersKurt Edited September 6, 2005 by /dev/null __________________________________________________________(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 September 6, 2005 Author Administrators Share Posted September 6, 2005 Yeah, you are correct. There is a bug Create a new function called AU3_ResetVar() in au3plugin.c /**************************************************************************** * AU3_ResetVar() ****************************************************************************/ void AU3_ResetVar(AU3_PLUGIN_VAR *pVar) { if (pVar == NULL) return; if (pVar->m_nType == AU3_PLUGIN_STRING) free(pVar->m_szValue); } And in all the AU3_Setxxx functions replace FreeVar with ResetVar. I'll update and recheck when I get chance. 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...
/dev/null Posted September 6, 2005 Share Posted September 6, 2005 Create a new function called AU3_ResetVar() in au3plugin.cAnd in all the AU3_Setxxx functions replace FreeVar with ResetVar.O.K., I already did that (see my post #29). After that changes I'm getting the errors described in my post #33. "Unknown macro @error" and "$retval used without declaration" (BTW: I did not change example.c or the AU3 script).Strange..... There seems to be still an overflow somewhere.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...
/dev/null Posted September 6, 2005 Share Posted September 6, 2005 Hmm, yes, arrays. That will need some work - it may not be pretty either (like the internal array setting code)arrays would be nice.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 September 7, 2005 Author Administrators Share Posted September 7, 2005 Ok, found the bugs. Redownload the sdk for the updated files. But, you will need to wait for the next beta release (also a bug in the AutoIt part :/ ) before it 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...
Lazycat Posted September 8, 2005 Share Posted September 8, 2005 Seems a small bug in the AU3_GethWnd functon - it's return 0 if param is actual handle. I added follows lines to fix it: case AU3_PLUGIN_HWND: return pVar->m_nValue; Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) 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