Kip Posted October 31, 2008 Share Posted October 31, 2008 (edited) Hi, So..... quite a lot discussions about OO. At the end of every discussion it's always the same answer: NO. Too bad, because you can do a lot of nice stuff with objects. So what if there was some kind of preprocessor that can translate object oriented script to regular AutoIt script? It's far from finished, but the main stuff works. Example: $iObject1 = MyObject() $iObject2 = MyObject() $iObject1.SetString("Hello, I'm 1");hello MsgBox(0,"Test",$iObject1.GetString() &@CRLF& $iObject2.GetString()) Obj MyObject() Declare $sMyString[3], $sInt = 1; Comments are possible again;) Func SetString($sString) $sMyString[0] = $sString EndFunc Func GetString() If $sMyString[0] Then Return $sMyString[0] Return "$sMyString[0] is empty" EndFunc EndObj The messagebox will say: Hello, I'm 1 Hi, I'm 2Cool, huh. Even though you created 2 of the same objects, they can hold different data in the same variables. ; Use 'Declare' to declare variables in objects. Variables declared using Local and Dim can only be used the first time when the object is created. After that they'll be deleted. How to install: 1. Download the AutoIt3.exe from the attachments. 2. Go to the Autoit installation folder 3. Rename the orginal AutoIt3.exe to: 'AutoIt3 Original.exe' (Without the qoutes) 4. Rename 'Au3Check.exe' to 'Au3Check2.exe' 5. Create a new script and run it (from SciTE or just double-click on the icon) AutoIt3.exe Edit: If I wanted to share the source, I would have uploaded it. Since I didn't, I don't want people to decompile it and post the source on the forum. Edited November 2, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Triton Posted October 31, 2008 Share Posted October 31, 2008 What parts are done or don't exist yet? I would love to convert some of my includes to OBJs. Specially with the gui routines! Triton Link to comment Share on other sites More sharing options...
Kip Posted October 31, 2008 Author Share Posted October 31, 2008 (edited) Gui, you say? Obj Window($sTitle, $iWidth=-1, $iHeight=-1, $iX=-1, $iY=-1, $iStyle=-1, $iExStyle=-1) Declare $hWnd Func _OnCreation(); will be called when object is created $hWnd = GUICreate($sTitle, $iWidth, $iHeight, $iX, $iY, $iStyle, $iExStyle) EndFunc Func State($iState=@SW_SHOW) Return GUISetState($iState) EndFunc Func GetVar($sVar) Return Eval($sVar) EndFunc EndObj well, calling a object twice on the same line will cause trouble: Msgbox(0,"sdds",$iObject1.GetString() &@CRLF& $iObject2.GetString()) And calling Return in a function of a object will cause that 'Declare' variables, edited in that function, wont be saved. Edited October 31, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
torels Posted October 31, 2008 Share Posted October 31, 2008 (edited) How to install:1. Download the AutoIt3.exe from the attachments.2. Go to the Autoit installation folder3. Rename the orginal AutoIt3.exe to: 'AutoIt3 Orginal.exe' (Without the qoutes)4. Rename 'Au3Check.exe' to 'Au3Check2.exe'5. Create a new script and run it (from SciTE or just double-click on the icon)AutoIt3.exewhat's this for ???anyway... is the whole block of code supposed to be in autoit ??cause it's not working... Edited October 31, 2008 by torels Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
Kip Posted October 31, 2008 Author Share Posted October 31, 2008 If you copy and rename the files, SciTE automaticly runs my program. When everything is converted, the new Autoit3.exe file automaticly runs the orginal one.Let's write all steps down, to be clear.- F5 pressed in SciTE (Run)- Au3Check.exe doesnt run, because we changed the name. (otherwise it'll create syntax errors)- My AutoIt3.exe gets called:- Your OO script gets converted to a normal script- New script will be saved as __TempScript.au3- __TempScript.au3 will be executed with 'AutoIt3 Orginal.exe' (I know.. its spelled: original, but its already compiled) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted October 31, 2008 Share Posted October 31, 2008 (edited) The whole idea rather cool but what is with the new AutoIt3.exe and why do we need to replace it? Could you explain that part a little more?[Edit]I see you already replied. Edited October 31, 2008 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
Kip Posted October 31, 2008 Author Share Posted October 31, 2008 (edited) but what is with the new AutoIt3.exeObjects dont belong in the AutoIt syntax, so it should be converted first.You don't HAVE to replace it. It's just much easier.If you dont replace it, you'll have to drop your script onto the AutoIt3.exe from the zip (unzip first), and what you'll get is a new script called __TempScript.au3. That is the script you can run with the normal AutoIt3.exe (in your installation dir)If you do replace it, you dont have to drag and drop anything. You'll just have to hit Run in SciTE Edited October 31, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
trancexx Posted October 31, 2008 Share Posted October 31, 2008 I'm having problems with ";" Had to manually remove few from __TempScript.au3 in oder for script to work. This is cool. Think that Class... End Class (VBS syntax is more appropriate) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Kip Posted October 31, 2008 Author Share Posted October 31, 2008 (edited) I'm having problems with ";"Could you give me an example? Think that Class... End Class (VBS syntax is more appropriate)But Object sounds cooler Edited October 31, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
trancexx Posted October 31, 2008 Share Posted October 31, 2008 Sure This was __TempScript.au3 right after created by "new" AutoIt3.exe: expandcollapse popupGlobal $__ObjectOr_ObjectsCount = 1 Global $__ObjectOr_ObjectNames[1] Global $__ObjectOr_ObjectsCount = 1 Global $__ObjectOr_ObjectNames[1] MsgBox(0,'','') $iObject1 = __Obj_MyObject_EndObj() $iObject2 = __Obj_MyObject_EndObj() Call("__Obj_"&$__ObjectOr_ObjectNames[$iObject1]&"_EndObj_Func_SetString_EndFunc", $iObject1, "Hello, I'm 1") Call("__Obj_"&$__ObjectOr_ObjectNames[$iObject2]&"_EndObj_Func_SetString_EndFunc", $iObject2, "Hi, I'm 2") $sString1 = Call("__Obj_"&$__ObjectOr_ObjectNames[$iObject1]&"_EndObj_Func_GetString_EndFunc", $iObject1) $sString2 = Call("__Obj_"&$__ObjectOr_ObjectNames[$iObject2]&"_EndObj_Func_GetString_EndFunc", $iObject2) MsgBox(0,"Test",$sString1 &@CRLF& $sString2) Func __Obj_MyObject_EndObj_Func_SetString_EndFunc($i_InternalObjectID, $sString) Local $sMyString; = Eval("__Obj_MyObject_EndObj_Inst_"&$i_InternalObjectID&"_EndInst_Name_sMyString;_EndName") $sMyString = $sString Assign("__Obj_MyObject_EndObj_Inst_"&$i_InternalObjectID&"_EndInst_Name_sMyString;_EndName",$sMyString;,2) EndFunc Func __Obj_MyObject_EndObj_Func_GetString_EndFunc($i_InternalObjectID) Local $sMyString; = Eval("__Obj_MyObject_EndObj_Inst_"&$i_InternalObjectID&"_EndInst_Name_sMyString;_EndName") Return $sMyString Assign("__Obj_MyObject_EndObj_Inst_"&$i_InternalObjectID&"_EndInst_Name_sMyString;_EndName",$sMyString;,2) EndFunc Func __Obj_MyObject_EndObj() $__ObjectOr_ObjectsCount += 1 ReDim $__ObjectOr_ObjectNames[$__ObjectOr_ObjectsCount+1] $__ObjectOr_ObjectNames[$__ObjectOr_ObjectsCount] = "MyObject" Assign("__Obj_MyObject_EndObj_Inst_"&$__ObjectOr_ObjectsCount&"_EndInst_Name_sMyString;_EndName","",2) Return $__ObjectOr_ObjectsCount EndFunc ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Kip Posted November 1, 2008 Author Share Posted November 1, 2008 You have this twice: Global $__ObjectOr_ObjectsCount = 1 Global $__ObjectOr_ObjectNames[1] Global $__ObjectOr_ObjectsCount = 1 Global $__ObjectOr_ObjectNames[1] And I mean an example of the OO code. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
trancexx Posted November 1, 2008 Share Posted November 1, 2008 (edited) You have this twice: Global $__ObjectOr_ObjectsCount = 1 Global $__ObjectOr_ObjectNames[1] Global $__ObjectOr_ObjectsCount = 1 Global $__ObjectOr_ObjectNames[1] And I mean an example of the OO code.That shouldn't be the problem. OO is OO froom yoour first poost. Edited November 1, 2008 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Kip Posted November 1, 2008 Author Share Posted November 1, 2008 (edited) ah, I see. Will be fixed soon (I hope ) Edited November 1, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
JRowe Posted November 1, 2008 Share Posted November 1, 2008 Without rewriting the engine to take advantage of actual object oriented software benefits, what's the advantage of a syntax change? I'm not saying this to be snarky, I'm genuinely curious. This looks pretty cool [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Kip Posted November 1, 2008 Author Share Posted November 1, 2008 what's the advantage of a syntax change?Eeerm.... you can do stuff you couldn't do before. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
i542 Posted November 1, 2008 Share Posted November 1, 2008 (edited) I stay... I prey... I see you in heaven one day.... Respect (Yap, thats why you need to be MVP.) Edited November 1, 2008 by MByte I can do signature me. Link to comment Share on other sites More sharing options...
ludocus Posted November 1, 2008 Share Posted November 1, 2008 cool it works..! after I got rid of the comment (; Use 'Declare' to declare variables in objects. Variables declared using Local and Dim can only be used the first time when the object is created. After that they'll be deleted.) also it can be confusing that the name should be Autoit3 Orginal and not Autoit3 Original Link to comment Share on other sites More sharing options...
BillLuvsU Posted November 1, 2008 Share Posted November 1, 2008 Well obviously anything you can do with this you could do without it, or it wouldn't work... then again I never really saw OO as that big of a benefit. [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
mmavipc Posted November 1, 2008 Share Posted November 1, 2008 (edited) recompiled script Heres an unicode version with the autoit exe spelled correctlyEdit: uploadingEdit: http://www.sendspace.com/file/1px67j Edited November 1, 2008 by mmavipc [size="10"]Pure Au3 crypt funcs(I'm currently also working on making a dll from this)[/size][Y] Be more active in the community[Y] Get 200 posts[N] Get 300 posts[N] Make a Topic in the example scripts forum with at least 50 replies.People who currently hate me:ValikSmOke_N Link to comment Share on other sites More sharing options...
Kip Posted November 1, 2008 Author Share Posted November 1, 2008 (edited) Did you decompiled my script?anything you can do with this you could do without itTrue, but this is so much easier. Edited November 1, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. 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