I'm trying to make a function that takes coordinates, copies that field and name a variable, but the variable seems to be local and doesn't transfer out of the function. The coordinates (x,y) and delay seem to be working fine, but the desc variable always comes out blank. Please help!
newest(x, y, delay, variable)
{
sleep, %delay%
click, %x%,%y% ;desc machine field
clipboard = ; empty the clipboard
Loop
{
If GetKeyState("F2","P") ; terminate the loop whenever you want by pressing F2
break
Send {Ctrl Down}c{Ctrl Up}
if clipboard is not space
break ; Terminate the loop
}
variable := clipboard ;
msgbox %variable%
return
}
^k::
newest(654, 199, 200, desc)
msgbox %desc%
return