I think your best bet is another script to read your script... How about something like this? #include <Array.au3>
Dim $filename = "Your Script File.au3"
Dim $variables[1]
Dim $RegExp
$varFileContents = FileRead ($filename)
$RegExp = StringRegExp ($varFileContents, "(\$\w{1,50})(?:\s|\[)", 3)
If Not @error Then
For $i = 0 to UBound($RegExp) - 1
StringReplace ($varFileContents, $RegExp[$i], "")
;~ MsgBox (0, "", "Variable Name: " & $RegExp[$i] & @CRLF & "Number of times it occurs: " & @extended)
If @extended = 1 Then
$variables[UBound($variables)-1] = $RegExp[$i]
ReDim $variables[UBound($variables+1)]
EndIf
Next
EndIf
_ArrayDisplay($variables, "Variables Used Only Once") I'm pretty sure the Regular Expression should cover most variable/array names, but it could require a little tweaking.