trancexx Posted October 21, 2011 Share Posted October 21, 2011 I've been looking at this now, seeing what all I can use it for, and so far I like it. I do have one question. Is it possible to define a default method for an object? As in, the Scripting.Dictionary can access items using either the .Item() method, or just by calling the object directly: Of course. Add method "__default__". Something like: AddMethod("__default__", "_YourMethod") ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted October 21, 2011 Share Posted October 21, 2011 (edited) Awesome, that works well. Except inside another autoitobject. I tried setting one object as a property in another object, then calling the propery using just the (), and I get "The requested action with this object has failed." Adding an error handler, I get "Invalid number of parameters." I may be doing something else wrong though... Edit: Ok, here's a small reproducer that doesn't error out, but doesn't work as I thought it should. #include "AutoitObject.au3" _AutoItObject_StartUp() Func _Class1() Local $obj = _AutoItObject_Class() $obj.AddMethod("__default__", "Hello") Return $obj.Object EndFunc Func _Class2() Local $obj = _AutoItObject_Class() $obj.AddProperty("test", $ELSCOPE_PUBLIC, _Class1()) Return $obj.Object EndFunc Func Hello($self) ConsoleWrite("Hello" & @CRLF) EndFunc ConsoleWrite("Test Class 1" & @CRLF) $temp = _Class1() $temp() $temp = 0 ConsoleWrite("Test Class 2" & @CRLF) $temp = _Class2() $temp.test() ConsoleWrite("Test Class 2b" & @CRLF) $temp2 = $temp.test $temp2() $temp = 0 It should print Hello all 3 times, but it misses Test 2, without an error. I'll have to figure out my Params error later, if I find an answer to this. Edited October 21, 2011 by SkinnyWhiteGuy Link to comment Share on other sites More sharing options...
trancexx Posted October 21, 2011 Share Posted October 21, 2011 Add destructors and you will see what the problem with your code is. (Make destructors print something when executed so that you know when they are called) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted October 21, 2011 Share Posted October 21, 2011 (edited) Well, I tried that, and added an option parameter to the default function, and still have errors. Here is the latest code I have: expandcollapse popup#include "AutoitObject.au3" ; Error monitoring Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF) Return EndFunc ;==>_ErrFunc _AutoItObject_StartUp() Func _Class1() Local $obj = _AutoItObject_Class() $obj.AddMethod("__default__", "Hello") $obj.AddDestructor("Goodbye") Return $obj.Object EndFunc Func _Class2() Local $obj = _AutoItObject_Class() $obj.AddProperty("test", $ELSCOPE_PUBLIC, _Class1()) $obj.AddDestructor("Goodbye") Return $obj.Object EndFunc Func Hello($self, $msg = "") ConsoleWrite("Hello " & $msg & @CRLF) EndFunc Func Goodbye($self) ConsoleWrite('Goodbye' & @CRLF) EndFunc ConsoleWrite("Test Class 1" & @CRLF) $temp1 = _Class1() $temp1("Test") ConsoleWrite("Test Class 2" & @CRLF) $temp2 = _Class2() $temp2.test("Error") ConsoleWrite("Test Class 2b" & @CRLF) $temp3 = $temp2.test $temp3("ReTest") If I'm looking at it right, this may not be possible. $temp2.test could be a Method of _Class2 as well as the default Method for the test object held in the Property of _Class2. I'm not sure if that might be the issue at hand or not, though... Edited October 21, 2011 by SkinnyWhiteGuy Link to comment Share on other sites More sharing options...
trancexx Posted October 21, 2011 Share Posted October 21, 2011 If I'm looking at it right, this may not be possible. $temp2.test could be a Method of _Class2 as well as the default Method for the test object held in the Property of _Class2. I'm not sure if that might be the issue at hand or not, though...There you go. Save the object first and then call its default method. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted October 21, 2011 Share Posted October 21, 2011 (edited) Thanks for this, here's what I made with it. It is based heavily on the LinkedList example, but it has all the functionality of the Scripting.Dictionary COM object.oDictionary.au3 Edited October 21, 2011 by SkinnyWhiteGuy Link to comment Share on other sites More sharing options...
ProgAndy Posted October 21, 2011 Author Share Posted October 21, 2011 (edited) Edit: Looks good Still, why don't you implement a real hashtable just like scripting.dicionary? That would be faster. Edited October 21, 2011 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted October 21, 2011 Share Posted October 21, 2011 I was bored at work today, and the Linked List implementation seemed more straight forward at the time. I was thinking about taking Nutster's old UDF here on the forums, and putting it into Object form, and compare the two. We'll see how bored I am on Monday. Link to comment Share on other sites More sharing options...
eimhym Posted May 31, 2012 Share Posted May 31, 2012 Need help inherit AutoItObject from JScriptObject () or is it possible to inherit any COM object other than AutoItObject created COM object?I have been playing with Kip's modified sample (), works with crafted object but seems failed to locate correct vtable (DllStructGetData($hHeader, 1) < 0 in ___AddMembersToLookupTable function) for other COM object (e.g. Scripting.Dictionary)Thanks Link to comment Share on other sites More sharing options...
Kip Posted June 2, 2012 Share Posted June 2, 2012 Please stop playing with my ancient modified version. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ProgAndy Posted June 2, 2012 Author Share Posted June 2, 2012 Need help inherit AutoItObject from JScriptObject () or is it possible to inherit any COM object other than AutoItObject created COM object?Modifying the JScript-Object does not save any overhead. A method call still has to go from an object to a DLLCallback and finally the requested AutoIt-function. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Andreik Posted June 7, 2012 Share Posted June 7, 2012 Is there any way to pass an array to an object method as parameter?I tried this example but fail:#include <AutoItObject.au3> #include <Array.au3> _AutoItObject_Startup() Dim $aArray[5] = [0,1,2,3,4] $oAS = ActionScript() $oAS.Run($aArray,'',True) Func ActionScript() Local $oActionScript = _AutoItObject_Class() With $oActionScript .AddMethod('Run','__as_run') .AddProperty('Script',$ELSCOPE_PRIVATE,'') EndWith Return $oActionScript.Object EndFunc Func __as_run($oSelf,$aBitmap,$sPath,$bMem=False) If $bMem Then $sPath = $oSelf.Script Test($aBitmap,$sPath,$bMem) EndFunc Func Test($a,$b,$c) _ArrayDisplay($a) MsgBox(0,"",$<img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' /> MsgBox(0,"",$c) EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted June 8, 2012 Share Posted June 8, 2012 AutoITObject Team,All links to the project homepage and documentation @ domain http://autoitobject.origo.ethz.ch/ are down. ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
eimhym Posted June 8, 2012 Share Posted June 8, 2012 (edited) Please stop playing with my ancient modified version.Well actually I like your ancient one than the new complex as it simply helps me understand the basic concept. Thanks again Kip The problem is even the new AutoItObject ends up with the same fatal error if I try to inherit from another COM object.A method call still has to go from an object to a DLLCallback and finally the requested AutoIt-function.Agreed, but in JScript Object we need another wrapper (in pure javascript) which is worsen the case My question is still, is it possible to inherit any COM object other than AutoItObject created COM object? Edited June 8, 2012 by eimhym Link to comment Share on other sites More sharing options...
trancexx Posted June 8, 2012 Share Posted June 8, 2012 Is there any way to pass an array to an object method as parameter? I tried this example but fail: #include <AutoItObject.au3> #include <Array.au3> _AutoItObject_Startup() Dim $aArray[5] = [0,1,2,3,4] $oAS = ActionScript() $oAS.Run($aArray,'',True) Func ActionScript() Local $oActionScript = _AutoItObject_Class() With $oActionScript .AddMethod('Run','__as_run') .AddProperty('Script',$ELSCOPE_PRIVATE,'') EndWith Return $oActionScript.Object EndFunc Func __as_run($oSelf,$aBitmap,$sPath,$bMem=False) If $bMem Then $sPath = $oSelf.Script Test($aBitmap,$sPath,$bMem) EndFunc Func Test($a,$b,$c) _ArrayDisplay($a) MsgBox(0,"",$<img src='http://www.autoitscript.com/forum/public/style_emoticons/default/cool.png' class='bbc_emoticon' alt='B)' /> MsgBox(0,"",$c) EndFuncThe question is: "What fails?" Answer that (yes you can) and and you will see that your question doesn't even make sense. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Andreik Posted June 8, 2012 Share Posted June 8, 2012 (edited) The question is: "What fails?"For example it fails to display the array in Test() function.LE: sorry, yes it's work but for an unknown reason my array isn't displayed by _ArrayDisplay() function but the array is valid if I put there a message box to display an item from array. So it's not AutoIt Object UDF related question, I'll try to find what's wrong with _ArrayDisplay(). Edited June 8, 2012 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted June 9, 2012 Share Posted June 9, 2012 Is it something about doing window messages when you are in a callback?Silly me, it's right there in the first post!Q. My GUI freezes! Why and how do I fix it? All methods are essentially dllcallbacks. Unfortunately this means that messages are not processed while your methods are being executed. As long as you keep your main loop outside any method, you'll be fine. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Loz Posted June 28, 2012 Share Posted June 28, 2012 Anyone know what is the latest version? I note that the home page at http://autoitobject.origo.ethz.ch/ has been failing for several weeks. The mirror has version 1.2.2.2 but in the past I downloaded version 1.2.8.2 from somewhere. Is 1.2.8.2 the latest? What is happening with http://autoitobject.origo.ethz.ch/ ? Thanks .... GOTOs? We don't need no stinkin' GOTOs! .... Link to comment Share on other sites More sharing options...
ProgAndy Posted June 28, 2012 Author Share Posted June 28, 2012 Origo has shut down. Indeed, 1.2.8.2 is the most recent version, but I have no copies on my laptop. I'll have to look on my other computer, probably something is there. At least a version more recent than 1.2.2.0 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
LarsJ Posted June 29, 2012 Share Posted June 29, 2012 (edited) This is version 1.2.8.2 Removed the attachments. Edited October 4, 2012 by LarsJ Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions 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