Page 1 of 1

returning object values

Posted: 10 Nov 2019, 21:33
by keokio
im new to objects, and i have this code at the bottom. Is there a way to just put the 'list_search.returnstring' into the third line instead of the %x%. This way I can omit the 2nd line with setting a value x:= list_search.returnstring. Thanks.

Code: Select all

list_search.string("ish", "combobox5", "Font")
x := list_search.returnstring
control, choosestring, %x%, combobox5, Font

Re: returning object values

Posted: 10 Nov 2019, 22:13
by gregster
Try to force an expression:

Code: Select all

list_search.string("ish", "combobox5", "Font")
control, choosestring, % list_search.returnstring, combobox5, Font
https://www.autohotkey.com/docs/Variables.htm#Expressions wrote:Force an expression: An expression can be used in a parameter that does not directly support it (except OutputVar parameters) by preceding the expression with a percent sign and a space or tab. In [v1.1.21+], this prefix can be used in the InputVar parameters of all commands except the traditional IF commands (use If (expression) instead). This technique is often used to access arrays.

Re: returning object values

Posted: 10 Nov 2019, 22:55
by keokio
gregster wrote:
10 Nov 2019, 22:13
Try to force an expression:

Code: Select all

list_search.string("ish", "combobox5", "Font")
control, choosestring, % list_search.returnstring, combobox5, Font
https://www.autohotkey.com/docs/Variables.htm#Expressions wrote:Force an expression: An expression can be used in a parameter that does not directly support it (except OutputVar parameters) by preceding the expression with a percent sign and a space or tab. In [v1.1.21+], this prefix can be used in the InputVar parameters of all commands except the traditional IF commands (use If (expression) instead). This technique is often used to access arrays.
wow that worked perfectly, thank you!