in situations where you have more than 4 or 5 variables you want to check, it can be fairly time consuming having to arrange each of them in a msgBox on their own line, putting the name of the variable next to it so you know which one is which, and in some cases wrapping them in quotes so you can check for trailing characters etc etc ...aint nobody got time fo dat
this is much quicker:
Code: Select all
splitPath, a_ahkPath, file_name, file_dir, file_ext, name_no_ext, drive
list_vars(a_lineFile, a_lineNumber, a_thisLabel)
Code: Select all
winGetPos, x, y, width, height, a
list_vars(a_lineFile, a_lineNumber, a_thisLabel)
Code: Select all
list = one,two , three,four
counter = 5
loop, parse, % list, `,
{
lstvrs = a_index a_loopField
counter++
list_vars(a_lineFile, "q" a_lineNumber, a_thisLabel)
}
Code: Select all
show_vars = a_ahkVersion a_OSVersion a_is64bitOS a_computerName a_userName a_scriptHwnd
list_vars(a_lineFile, a_lineNumber, a_thisLabel)
Code: Select all
lstvrs =
(
a_detectHiddenWindows a_detectHiddenText a_titleMatchMode
a_titleMatchModeSpeed a_batchLines a_sendMode a_coordMode
a_stringCaseSense a_winDelay
)
list_vars(a_lineFile, a_lineNumber, a_thisLabel)
scope
the built in "listvars" command will show every variable being used, which depending on how many other scripts and functions are included into the current script, could be a lot
using just the first 2 parameters in this function will show the variables being using in the current file only.
it will also only show the variables that have been used up to the point in time where the function is used... which means that you can use it at multiple places through out a script and track how variables are changing as the script progresses.
Code: Select all
list_vars(a_lineFile, a_lineNumber)
Code: Select all
list_vars(a_lineFile, a_lineNumber, a_thisLabel)
list_vars(a_lineFile, a_lineNumber, a_thisFunc)
• a_thisFunc is used for functions but the function has to be set to global in most cases
options
lines that are longer than 55 characters are show shortened/truncated
if you want to see the full lines then put "f" into the second parameter along with a_lineNumber
Code: Select all
list_vars(a_lineFile, a_lineNumber "f", a_thisLabel)
or "q" to wrap the line in "quotes"
add "c" to add the list to the clipboard. (the full variables are added to the clipboard whether the "f" is used or not)
limitations
i cant remember what they are now (i made this a year ago) but there were definitely were a few situations where this didnt work as expected. it works by reading the contents of the current file so maybe it was the variables in an #include file or function that werent showing up. anyway, this is just a disclaimer to say that it probably wont work in every situation
to do
a listView gui that could resize depending on the size would be much better than using a msgBox but i havnt got around to trying that out yet