[BUG] AutoHotkey_2.0-a088-338ed55 Object Topic is solved

Discuss the future of the AutoHotkey language
_3D_
Posts: 186
Joined: 29 Jan 2014, 14:40

[BUG] AutoHotkey_2.0-a088-338ed55 Object

01 Feb 2018, 06:51

This effect not present in AutoHotkey_2.0-a081-cad307c.

Code: Select all

name:= "c:\path\com1_123.txt"
if RegExMatch(name, "i)COM\d+", port) {	; <<< create object port
	msgBox(isObject(port))				; <<< check is object
	port.dest:= "" 						; <<< unknown property or method
}
And the result:

Code: Select all

---------------------------
[BUG] Object.ahk
---------------------------
Error:  Unknown property or method.

Specifically: dest

	Line#
	001: name := "c:\path\com1_123.txt"
	002: if RegExMatch(name, "i)COM\d+", port)
	002: {
	003: msgBox(isObject(port))
--->	004: port.dest:= ""
	005: }
	006: Exit
	007: Exit
	007: Exit

The current thread will exit.
---------------------------
OK   
---------------------------
Next code work:

Code: Select all

port:= {}
msgBox(isObject(port))	; <<< check is object
port.dest:= "" 			; <<< work
AHKv2.0 use the future now.
Helgef
Posts: 3195
Joined: 17 Jul 2016, 01:02
Contact:

Re: [BUG] AutoHotkey_2.0-a088-338ed55 Object  Topic is solved

01 Feb 2018, 07:08

RegExMatch objects cannot be written to. You get the error now ( :thumbup: ), but it didn't work earlier, not in v1 and not in v2.

Code: Select all

; v1
regexmatch("a","O)a",m)
msgbox % m.0
m.0 := "b"
msgbox % m.0
Note,

Code: Select all

regExMatch("", "", m)
msgbox type(m) "`n" type({})

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: Ursi and 1 guest