@ntepa
Thanks for the help, would never have thought about using the error stack trace.
And I made a small method out of it, but with In- and SubStr because I'm not that familiar with the RegEx needles.
Thanks for the help, would never have thought about using the error stack trace.
And I made a small method out of it, but with In- and SubStr because I'm not that familiar with the RegEx needles.
CODE:
#Requires AutoHotkey v2.0
#SingleInstance
MyFirstInstance := MyClass()
MySecondInstance := MyClass()
class MyClass {
__new() {
InstanceName := this.GetInstanceName() ; must be used inside the __New method
this.CreateGui(InstanceName)
}
GetInstanceName() => SubStr((Err := Error(,-2), S := Err.Stack), P := InStr(S, "]",,, 2)+2 , InStr(S, ":=",,,2)-P)
CreateGui(InstanceName) {
MyGui := Gui()
MyGui.AddText(, "This Gui was created by`n`nClass name: " this.__Class "`nInstanceName: " InstanceName)
MyGui.Show("w300")
}
}
Statistics: Posted by Noitalommi_2 — Today, 18:26