Jump to content

Recommended Posts

Posted

It's an autoit thing I'm pretty sure because try this too.

#include-once

#include "AutoItObject.au3"

_AutoItObject_StartUp()

Global $this = _AutoItObject_Class()

$this.AddProperty("E", $elscope_readonly, '~')

ConsoleWrite($this.Object.E & @CRLF)

_AutoItObject_Shutdown()

E being used for exponents.

Posted

Question to the authors of this UDF:

Given some of the functionality being released in the more recent AU3 betas.

Are there any plans to further enhance this UDF?

  • 4 weeks later...
Posted (edited)

Classes are great I like the idea you got there I view classes as fundamental.

What about adding your own modifications to the text editor that AutoIt uses so you can create stuff like:

Class MessageBox
       Local $Text;
       Local $Title;
       Local $Opt;

       Func Construct()
            // whateva....
       EndFunc

       Func Destruct()
            // free stuff whateva....
       EndFunc

       Func Call($Title, $Text, $Opt)
            $self.$Title= $Title
            $self.$Text = $Text
            $self.$Opt= $Opt
            return dllcall() ; bla bla
       EndFunc
EndClass
$var = new MessageBox(");
$ret = $var.call("My title", "MyText", "myopt");

Basically it could use what you already have but make it MUCH easier to code and much more user friendly.

The text editor could translate what I typed above into the appropriate strings and stuff before executing the script.

Its just an idea...

Edited by UberFoX
Posted

I'm really sorry to see this project has been left behind.

I'm still using it, enjoying it, and AutoIt should proud to itself for existence of AO.

#include-once
#include "..\Libraries\AutoItObject.au3"
#include <Array.au3>

Func Account($sUsername, $sPassword = "", $sServers = "", $sAfkRoom = "", $sSpamWhisperRoom = "", $sExpiryDate = "", $sComments = "")
    If (Not FileExists(@ScriptDir & "\Databases")) Then DirCreate(@ScriptDir & "\Databases")

    Local $oClass = _AutoItObject_Class()
    With $oClass
        #region Variables (Private)
            .AddProperty("File", $ELSCOPE_PRIVATE, @ScriptDir & "\Databases\Accounts.ggm")

            .AddProperty("Username", $ELSCOPE_PRIVATE, $sUsername)
            .AddProperty("Password", $ELSCOPE_PRIVATE, $sPassword)
            .AddProperty("Servers", $ELSCOPE_PRIVATE, $sServers)
            .AddProperty("AfkRoom", $ELSCOPE_PRIVATE, $sAfkRoom)
            .AddProperty("SpamWhisperRoom", $ELSCOPE_PRIVATE, $sSpamWhisperRoom)
            .AddProperty("ExpiryDate", $ELSCOPE_PRIVATE, $sExpiryDate)
            .AddProperty("Comments", $ELSCOPE_PRIVATE, $sComments)
        #endregion Variables (Private)


        #region Methods (Public)
            .AddMethod("Add", "Account_Add")
            .AddMethod("Delete", "Account_Delete")
            .AddMethod("Array", "Account_Array")
        #endregion Methods (Public)


        #region Methods (Private)
            .AddMethod("Exists", "Account_Exists", True)

            .AddMethod("Read", "Account_Read", True)
            .AddMethod("Write", "Account_Write", True)

            .AddMethod("Encrypt", "Account_Encrypt", True)
            .AddMethod("Decrypt", "Account_Decrypt", True)
        #endregion Methods (Private)

        Return .Object
    EndWith
EndFunc

#region Methods (Public)
    Func Account_Add($oSelf, $bOverwrite = False)
        If ((Not $oSelf.Exists()) Or ($bOverwrite)) Then
            $oSelf.Write($oSelf.Username, "Password", $oSelf.Password)
            $oSelf.Write($oSelf.Username, "Servers", $oSelf.Servers)
            $oSelf.Write($oSelf.Username, "AFK Room", $oSelf.AfkRoom)
            $oSelf.Write($oSelf.Username, "Spam/Whisper Room", $oSelf.SpamWhisperRoom)
            $oSelf.Write($oSelf.Username, "Expiry Date", $oSelf.ExpiryDate)
            $oSelf.Write($oSelf.Username, "Comments", $oSelf.Comments)

            Return True
        EndIf

        Return False
    EndFunc

    Func Account_Delete($oSelf)
        IniDelete($oSelf.File, $oSelf.Encrypt($oSelf.Username))
    EndFunc

    Func Account_Array($oSelf)
        Local $aAccounts = IniReadSectionNames($oSelf.File)
        If (@error) Then Return

        For $i = 1 To $aAccounts[0]
            $aAccounts[$i] = $oSelf.Decrypt($aAccounts[$i])
        Next

        _ArrayDelete($aAccounts, 0)

        Return $aAccounts
    EndFunc
#endregion Methods (Public)


#region Methods (Private)
    Func Account_Exists($oSelf)
        Return IsArray(IniReadSection($oSelf.File, $oSelf.Encrypt($oSelf.Username)))
    EndFunc

    Func Account_Read($oSelf, $sSection, $sKey)
        Return $oSelf.Decrypt(IniRead($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), ""))
    EndFunc

    Func Account_Write($oSelf, $sSection, $sKey, $sValue)
        If ($sValue) Then
            IniWrite($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), $oSelf.Encrypt($sValue))
        Else
            IniDelete($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey))
        EndIf
    EndFunc

    Func Account_Encrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = StringToBinary($sInput)
        $sOutput = StringTrimLeft($sOutput, 2)
        $sOutput = StringLower($sOutput)

        Return $sOutput
    EndFunc

    Func Account_Decrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = "0x" & $sInput
        $sOutput = BinaryToString($sOutput)

        Return $sOutput
    EndFunc
#endregion Methods (Private)
#include-once
#include "..\Libraries\AutoItObject.au3"
#include <MsgBoxConstants.au3>

Func Show()
    Local $oClass = _AutoItObject_Class()
    With $oClass
        #region Variables (Private)
            .AddProperty("Title", $ELSCOPE_PRIVATE, $oConstants.Title)
        #endregion Variables (Private)


        #region Methods (Public)
            .AddMethod("Error", "Show_Error")
            .AddMethod("Information", "Show_Information")
            .AddMethod("Question", "Show_Question")
            .AddMethod("Warning", "Show_Warning")
        #endregion Methods (Public)


        #region Methods (Private)
            .AddMethod("GetParent", "Show_GetParent", True)
        #endregion Methods (Private)

        Return .Object
    EndWith
EndFunc

#region Methods (Public)
    Func Show_Error($oSelf, $sText, $oParent = 0)
        MsgBox(BitOR($MB_OK, $MB_ICONHAND), $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent))
    EndFunc

    Func Show_Information($oSelf, $sText, $oParent = 0)
        MsgBox(BitOR($MB_OK, $MB_ICONASTERISK), $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent))
    EndFunc

    Func Show_Question($oSelf, $sText, $oParent = 0, $bSecondButton = False)
        Local $uFlag = BitOR($MB_YESNO, $MB_ICONQUESTION)
        If ($bSecondButton) Then $uFlag = BitOR($uFlag, $MB_DEFBUTTON2)

        Return (MsgBox($uFlag, $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent)) = $IDYES)
    EndFunc

    Func Show_Warning($oSelf, $sText, $oParent = 0)
        MsgBox(BitOR($MB_OK, $MB_ICONEXCLAMATION), $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent))
    EndFunc
#endregion Methods (Public)


#region Methods (Private)
    Func Show_GetParent($oSelf, $oParent)
        #forceref $oSelf
        Return (IsObj($oParent)) ? ($oParent.Handle) : (0)
    EndFunc
#endregion Methods (Private)
#include-once
#include "..\Libraries\AutoItObject.au3"

Func Settings()
    If (Not FileExists(@ScriptDir & "\Databases")) Then DirCreate(@ScriptDir & "\Databases")

    Local $oClass = _AutoItObject_Class()
    With $oClass
        #region Variables (Private)
            .AddProperty("File", $ELSCOPE_PRIVATE, @ScriptDir & "\Databases\Settings.ggm")
        #endregion Variables (Private)


        #region Methods (Public)
            .AddMethod("Username", "Settings_Username")
            .AddMethod("Password", "Settings_Password")
            .AddMethod("LogInAutomatically", "Settings_LogInAutomatically")
        #endregion Methods (Public)


        #region Methods (Private)
            .AddMethod("Read", "Settings_Read", True)
            .AddMethod("Write", "Settings_Write", True)

            .AddMethod("Encrypt", "Settings_Encrypt", True)
            .AddMethod("Decrypt", "Settings_Decrypt", True)
        #endregion Methods (Private)

        Return .Object
    EndWith
EndFunc

#region Methods (Public)
    Func Settings_Username($oSelf, $sUsername = "")
        If (@NumParams = 2) Then
            $oSelf.Write("Login", "Username", $sUsername)
        Else
            Return $oSelf.Read("Login", "Username")
        EndIf
    EndFunc

    Func Settings_Password($oSelf, $sPassword = "")
        If (@NumParams = 2) Then
            $oSelf.Write("Login", "Password", $sPassword)
        Else
            Return $oSelf.Read("Login", "Password")
        EndIf
    EndFunc

    Func Settings_LogInAutomatically($oSelf, $sLogInAutomatically = "")
        If (@NumParams = 2) Then
            $oSelf.Write("Login", "Log in Automatically", $sLogInAutomatically)
        Else
            Return $oSelf.Read("Login", "Log in Automatically")
        EndIf
    EndFunc
#endregion Methods (Public)


#region Methods (Private)
    Func Settings_Read($oSelf, $sSection, $sKey)
        Return $oSelf.Decrypt(IniRead($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), ""))
    EndFunc

    Func Settings_Write($oSelf, $sSection, $sKey, $sValue)
        If ($sValue) Then
            IniWrite($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), $oSelf.Encrypt($sValue))
        Else
            IniDelete($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey))
        EndIf
    EndFunc

    Func Settings_Encrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = StringToBinary($sInput)
        $sOutput = StringTrimLeft($sOutput, 2)
        $sOutput = StringLower($sOutput)

        Return $sOutput
    EndFunc

    Func Settings_Decrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = "0x" & $sInput
        $sOutput = BinaryToString($sOutput)

        Return $sOutput
    EndFunc
#endregion Methods (Private)

OO support in AutoIt would be great, However AO is still good but not enough.

Posted

Is there any good tutorial available for AutoItObject? To learn from some code examples might be a problem to get in touch with it. It would be great to introduce oop with examples in a more details way than it is currently.

Maybe then more people will learn new things.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted (edited)

<snip>

 

UEZ,

The OO features and concepts remains same for all programming languages, there are only some differences in syntax based on the programming language you are using.

 

you can start studying it from available tutorials for C#, VB or C++:

http://en.wikipedia.org/wiki/Object-oriented_programming

http://msdn.microsoft.com/en-us/library/vstudio/dd460654.aspx

http://www.cplusplus.com/doc/tutorial/classes/

http://www.cplusplus.com/doc/tutorial/classes2/

 

Then taking a look at AO UDF's documentation will do the rest.

Edited by Melba23
Posted

I'm really sorry to see this project has been left behind.

I'm still using it, enjoying it, and AutoIt should proud to itself for existence of AO.

#include-once
#include "..\Libraries\AutoItObject.au3"
#include <Array.au3>

Func Account($sUsername, $sPassword = "", $sServers = "", $sAfkRoom = "", $sSpamWhisperRoom = "", $sExpiryDate = "", $sComments = "")
    If (Not FileExists(@ScriptDir & "\Databases")) Then DirCreate(@ScriptDir & "\Databases")

    Local $oClass = _AutoItObject_Class()
    With $oClass
        #region Variables (Private)
            .AddProperty("File", $ELSCOPE_PRIVATE, @ScriptDir & "\Databases\Accounts.ggm")

            .AddProperty("Username", $ELSCOPE_PRIVATE, $sUsername)
            .AddProperty("Password", $ELSCOPE_PRIVATE, $sPassword)
            .AddProperty("Servers", $ELSCOPE_PRIVATE, $sServers)
            .AddProperty("AfkRoom", $ELSCOPE_PRIVATE, $sAfkRoom)
            .AddProperty("SpamWhisperRoom", $ELSCOPE_PRIVATE, $sSpamWhisperRoom)
            .AddProperty("ExpiryDate", $ELSCOPE_PRIVATE, $sExpiryDate)
            .AddProperty("Comments", $ELSCOPE_PRIVATE, $sComments)
        #endregion Variables (Private)


        #region Methods (Public)
            .AddMethod("Add", "Account_Add")
            .AddMethod("Delete", "Account_Delete")
            .AddMethod("Array", "Account_Array")
        #endregion Methods (Public)


        #region Methods (Private)
            .AddMethod("Exists", "Account_Exists", True)

            .AddMethod("Read", "Account_Read", True)
            .AddMethod("Write", "Account_Write", True)

            .AddMethod("Encrypt", "Account_Encrypt", True)
            .AddMethod("Decrypt", "Account_Decrypt", True)
        #endregion Methods (Private)

        Return .Object
    EndWith
EndFunc

#region Methods (Public)
    Func Account_Add($oSelf, $bOverwrite = False)
        If ((Not $oSelf.Exists()) Or ($bOverwrite)) Then
            $oSelf.Write($oSelf.Username, "Password", $oSelf.Password)
            $oSelf.Write($oSelf.Username, "Servers", $oSelf.Servers)
            $oSelf.Write($oSelf.Username, "AFK Room", $oSelf.AfkRoom)
            $oSelf.Write($oSelf.Username, "Spam/Whisper Room", $oSelf.SpamWhisperRoom)
            $oSelf.Write($oSelf.Username, "Expiry Date", $oSelf.ExpiryDate)
            $oSelf.Write($oSelf.Username, "Comments", $oSelf.Comments)

            Return True
        EndIf

        Return False
    EndFunc

    Func Account_Delete($oSelf)
        IniDelete($oSelf.File, $oSelf.Encrypt($oSelf.Username))
    EndFunc

    Func Account_Array($oSelf)
        Local $aAccounts = IniReadSectionNames($oSelf.File)
        If (@error) Then Return

        For $i = 1 To $aAccounts[0]
            $aAccounts[$i] = $oSelf.Decrypt($aAccounts[$i])
        Next

        _ArrayDelete($aAccounts, 0)

        Return $aAccounts
    EndFunc
#endregion Methods (Public)


#region Methods (Private)
    Func Account_Exists($oSelf)
        Return IsArray(IniReadSection($oSelf.File, $oSelf.Encrypt($oSelf.Username)))
    EndFunc

    Func Account_Read($oSelf, $sSection, $sKey)
        Return $oSelf.Decrypt(IniRead($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), ""))
    EndFunc

    Func Account_Write($oSelf, $sSection, $sKey, $sValue)
        If ($sValue) Then
            IniWrite($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), $oSelf.Encrypt($sValue))
        Else
            IniDelete($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey))
        EndIf
    EndFunc

    Func Account_Encrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = StringToBinary($sInput)
        $sOutput = StringTrimLeft($sOutput, 2)
        $sOutput = StringLower($sOutput)

        Return $sOutput
    EndFunc

    Func Account_Decrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = "0x" & $sInput
        $sOutput = BinaryToString($sOutput)

        Return $sOutput
    EndFunc
#endregion Methods (Private)
#include-once
#include "..\Libraries\AutoItObject.au3"
#include <MsgBoxConstants.au3>

Func Show()
    Local $oClass = _AutoItObject_Class()
    With $oClass
        #region Variables (Private)
            .AddProperty("Title", $ELSCOPE_PRIVATE, $oConstants.Title)
        #endregion Variables (Private)


        #region Methods (Public)
            .AddMethod("Error", "Show_Error")
            .AddMethod("Information", "Show_Information")
            .AddMethod("Question", "Show_Question")
            .AddMethod("Warning", "Show_Warning")
        #endregion Methods (Public)


        #region Methods (Private)
            .AddMethod("GetParent", "Show_GetParent", True)
        #endregion Methods (Private)

        Return .Object
    EndWith
EndFunc

#region Methods (Public)
    Func Show_Error($oSelf, $sText, $oParent = 0)
        MsgBox(BitOR($MB_OK, $MB_ICONHAND), $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent))
    EndFunc

    Func Show_Information($oSelf, $sText, $oParent = 0)
        MsgBox(BitOR($MB_OK, $MB_ICONASTERISK), $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent))
    EndFunc

    Func Show_Question($oSelf, $sText, $oParent = 0, $bSecondButton = False)
        Local $uFlag = BitOR($MB_YESNO, $MB_ICONQUESTION)
        If ($bSecondButton) Then $uFlag = BitOR($uFlag, $MB_DEFBUTTON2)

        Return (MsgBox($uFlag, $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent)) = $IDYES)
    EndFunc

    Func Show_Warning($oSelf, $sText, $oParent = 0)
        MsgBox(BitOR($MB_OK, $MB_ICONEXCLAMATION), $oSelf.Title, $sText, 0, $oSelf.GetParent($oParent))
    EndFunc
#endregion Methods (Public)


#region Methods (Private)
    Func Show_GetParent($oSelf, $oParent)
        #forceref $oSelf
        Return (IsObj($oParent)) ? ($oParent.Handle) : (0)
    EndFunc
#endregion Methods (Private)
#include-once
#include "..\Libraries\AutoItObject.au3"

Func Settings()
    If (Not FileExists(@ScriptDir & "\Databases")) Then DirCreate(@ScriptDir & "\Databases")

    Local $oClass = _AutoItObject_Class()
    With $oClass
        #region Variables (Private)
            .AddProperty("File", $ELSCOPE_PRIVATE, @ScriptDir & "\Databases\Settings.ggm")
        #endregion Variables (Private)


        #region Methods (Public)
            .AddMethod("Username", "Settings_Username")
            .AddMethod("Password", "Settings_Password")
            .AddMethod("LogInAutomatically", "Settings_LogInAutomatically")
        #endregion Methods (Public)


        #region Methods (Private)
            .AddMethod("Read", "Settings_Read", True)
            .AddMethod("Write", "Settings_Write", True)

            .AddMethod("Encrypt", "Settings_Encrypt", True)
            .AddMethod("Decrypt", "Settings_Decrypt", True)
        #endregion Methods (Private)

        Return .Object
    EndWith
EndFunc

#region Methods (Public)
    Func Settings_Username($oSelf, $sUsername = "")
        If (@NumParams = 2) Then
            $oSelf.Write("Login", "Username", $sUsername)
        Else
            Return $oSelf.Read("Login", "Username")
        EndIf
    EndFunc

    Func Settings_Password($oSelf, $sPassword = "")
        If (@NumParams = 2) Then
            $oSelf.Write("Login", "Password", $sPassword)
        Else
            Return $oSelf.Read("Login", "Password")
        EndIf
    EndFunc

    Func Settings_LogInAutomatically($oSelf, $sLogInAutomatically = "")
        If (@NumParams = 2) Then
            $oSelf.Write("Login", "Log in Automatically", $sLogInAutomatically)
        Else
            Return $oSelf.Read("Login", "Log in Automatically")
        EndIf
    EndFunc
#endregion Methods (Public)


#region Methods (Private)
    Func Settings_Read($oSelf, $sSection, $sKey)
        Return $oSelf.Decrypt(IniRead($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), ""))
    EndFunc

    Func Settings_Write($oSelf, $sSection, $sKey, $sValue)
        If ($sValue) Then
            IniWrite($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey), $oSelf.Encrypt($sValue))
        Else
            IniDelete($oSelf.File, $oSelf.Encrypt($sSection), $oSelf.Encrypt($sKey))
        EndIf
    EndFunc

    Func Settings_Encrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = StringToBinary($sInput)
        $sOutput = StringTrimLeft($sOutput, 2)
        $sOutput = StringLower($sOutput)

        Return $sOutput
    EndFunc

    Func Settings_Decrypt($oSelf, $sInput)
        #forceref $oSelf

        If ($sInput = "") Then Return ""

        Local $sOutput = "0x" & $sInput
        $sOutput = BinaryToString($sOutput)

        Return $sOutput
    EndFunc
#endregion Methods (Private)

OO support in AutoIt would be great, However AO is still good but not enough.

AutoItObject was more of an idea, and it was proof that things can be done differently and that the box some people live in is just a tiny part of much bigger programming space. And no, it's not the way how things should be done. This whole thing can be done much nicely by AutoIt internally but in order to do that you have to make AutoIt better, maybe even change it a bit.

♡♡♡

.

eMyvnE

  • 1 month later...
Posted

I am using AutoIt to interface with an application via COM and have ran into a problem of a method using "ref" to return a value. From reading this thread and the AIO help file, I feel like I should be able to do this either in AU3 or AIO.

See '?do=embed' frameborder='0' data-embedContent>> for specifics on what I am dealing with.

Am I on the right track, or is AIO not a solution to getting "ref" (C#) and "ByRef" (VB) functionality in AutoIt.

  • 3 weeks later...
Posted (edited)

I have 2 problem/question:

In the following code, the Child class doesn't inherits from the Parent class. I guess something is wrong with .Create method:

#include "AutoItObject.au3"

_AutoItObject_Startup()

Global $b = Child()
$b.Method()
$b = 0

_AutoItObject_Shutdown()

Func Parent()
    Local $oClass = _AutoItObject_Class()
    With $oClass
        .AddDestructor("Parent_Destructor")

        .AddProperty("Property", $ELSCOPE_PUBLIC, "Parent Property")

        .AddMethod("Method", "Parent_Method", False)
    EndWith
    Return $oClass.Object
EndFunc

Func Parent_Destructor($this)
    MsgBox(0, "", "Parent Destructor")
EndFunc

Func Parent_Method($this)
    MsgBox(0, "", $this.Property)
EndFunc

Func Child()
    Local $oClass = _AutoItObject_Class()
    With $oClass
        .Create(Parent())
    EndWith
    Return $oClass.Object
EndFunc

How ever doing that in this way will fix the problem:

#include "AutoItObject.au3"

_AutoItObject_Startup()

Global $b = Child()
$b.Method()
$b = 0

_AutoItObject_Shutdown()

Func Parent()
    Local $oClass = _AutoItObject_Class()
    With $oClass
        .AddDestructor("Parent_Destructor")

        .AddProperty("Property", $ELSCOPE_PUBLIC, "Parent Property")

        .AddMethod("Method", "Parent_Method", False)
    EndWith
    Return $oClass.Object
EndFunc

Func Parent_Destructor($this)
    MsgBox(0, "", "Parent Destructor")
EndFunc

Func Parent_Method($this)
    MsgBox(0, "", $this.Property)
EndFunc

Func Child()
    Local $oClass = _AutoItObject_Create(Parent())

    Return $oClass
EndFunc

But even in the second code, I think there is some problem.

The Parent class's destructor gets called after creating the Child class. However it seems to be normal, but just want to ask, am I doing it in the right way?

I'm using AutoItObject 1.2.8.2.

Is there any newer version of AutoItObject? Or anything else that I should probably know?

Thanks.

Edited by D4RKON3
  • 3 months later...
  • 2 weeks later...
Posted

the link is out, would reup?

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

  • 4 months later...
Posted

I have encountered an issue which I think is AutoItObject related if anybody is interested.

If I use With/EndWith in the following code, the second parameter must be accessed using the full variable.  The method sets the title of a window.  The third commented line is why I think that this isn't an AutoIt issue as much as it is an AIO issue.  The code should be self explanatory.  This is just a silly reproducer I cooked up quickly.

#include "AutoItObject.au3"

#include <GUIConstantsEx.au3>

_AutoItObject_StartUp()

Const $gui_view = GUIView()

With $gui_view
  .SetTitle(.Title1, .Title2)                    ; doesn't work
  .SetTitle(.Title1, $gui_view.Title2)           ; works fine
  WinSetTitle(.GUI, '', .Title1 & ' ' & .Title2) ; also works fine
 
  .Show()
EndWith

Do
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      _AutoItObject_Shutdown()
      Exit
  EndSwitch
Until False

Func GUIView()
  Local $this = _AutoItObject_Class()

  $this.AddMethod("SetTitle", "_setTitle")
  $this.AddMethod("Show",     "_show")

  $this.AddProperty("GUI",    $elscope_readonly, GUICreate(""))
  $this.AddProperty("Title1", $elscope_readonly, "Test1")
  $this.AddProperty("Title2", $elscope_readonly, "Test2")

  Return $this.Object
EndFunc

Func _setTitle(Const $this, Const $title1, Const $title2)
  WinSetTitle($this.GUI, '', $this.Title1 & ' ' & $this.Title2)
EndFunc

Func _show(Const $this)
  GUISetState(@SW_SHOWNORMAL, $this.GUI)
EndFunc

Is this something that can/will be fixed?

Posted (edited)

Interesting.  Weird how this line works: WinSetTitle(.GUI, '', .Title1 & ' ' & .Title2) but you demonstrate in your example that it is an au3 issue after all.  Guess I should file a bug report.

Trac: http://www.autoitscript.com/trac/autoit/ticket/2789#ticket

Edited by jaberwacky

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
  • Recently Browsing   0 members

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