Page 1 of 1

Using a listvars hotkey to view local variables

Posted: 06 Dec 2015, 13:17
by Peabianjay
Listvars seems somewhat unpredictable. In this sample script, it's rare for listvars to report the local variables, despite the program being in the function "permanently". With multiple attempts & refreshes, once in a while, it'll show the local variables, but mostly not.

Is there any way to make it reliably report local variables?

Code: Select all

a := "Alpha"

dostuff()
return

dostuff( )
{
    c := "Gamma"
    loop
		sleep, 55
}

F1::
    listvars
    pause
return

+Pause::
   exitapp 
return

Pause::
    Pause, Toggle, 1
Return

Re: Using a listvars hotkey to view local variables

Posted: 06 Dec 2015, 16:23
by AlphaBravo
you would have to use the command within the function

Code: Select all

a := "Alpha"
dostuff()
return
 
dostuff( )
{
    c := "Gamma"
	ListVars
}

Re: Using a listvars hotkey to view local variables

Posted: 07 Dec 2015, 10:35
by Peabianjay
Meh. Ya, that works, 'cept then I'd have to know where the problems are before I know where the problems are.

I suppose a hotkey to set a global flag, then if (DEBUG) { listvars } in every questionable place. Even doing that in every function is a lot, let alone everywhere.

If only I didn't make mistakes, then I wouldn't need to debug stuff. :-)