AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

List of all Vars

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Fri Nov 03, 2006 1:50 am    Post subject: List of all Vars Reply with quote

I searched the forum for this but found nothing, so i write. Is there a function or an existing variable in ahk that has a list of all the variables being used in a script, including those owned by controls (Gui, Add, Button, vMyVar, ...)

I would like to parse this list of vars and display them in a Listview control, showing each variables contents. In conjunction with Settimer I would like to do this in real-time.

Thanks for any help you can provide.
_________________
my lame sig Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
slomz



Joined: 03 Sep 2006
Posts: 608
Location: Iowa, U.S.

PostPosted: Fri Nov 03, 2006 1:55 am    Post subject: Reply with quote

Code:
ListVars

_________________
Back to top
View user's profile Send private message AIM Address
POINTS



Joined: 18 Jan 2006
Posts: 284

PostPosted: Fri Nov 03, 2006 1:56 am    Post subject: Listvars Reply with quote

Listvars

Damn too slow... lol
_________________
My AutoHotkey Program for Warcraft III:
Warkeys
http://warkeys.sourceforge.net/

Remap your hotkeys
Healthbars always on
Remap inventory
Back to top
View user's profile Send private message Visit poster's website
slomz



Joined: 03 Sep 2006
Posts: 608
Location: Iowa, U.S.

PostPosted: Fri Nov 03, 2006 2:00 am    Post subject: Reply with quote

lol
_________________
Back to top
View user's profile Send private message AIM Address
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Fri Nov 03, 2006 2:31 am    Post subject: Reply with quote

Well yes of course. I know. But this method displays to a seperate window, whose contents must be extracted and parsed , then organized before it can be used. I am looking for a simple function that can create and update a list of the variables that exist within a script. then this list can be handled in a number of ways.


ex:
ListOfAllVars = MyVar1,MyVar2,MyVar3
_________________
my lame sig Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
POINTS



Joined: 18 Jan 2006
Posts: 284

PostPosted: Fri Nov 03, 2006 3:01 am    Post subject: hmmm Reply with quote

I don't know of a way that AHK does this automatically. You might have to do it yourself.

You could write a function that keeps track of the variables that you create. It wouldn't be automatic but it would work.

Code:

iVarCount := 0

MyVar = "Hello World"
MyVar2 = "Hey you guys"
AddVar("MyVar")
AddVar("MyVar2")
; Add ListView Code here to display vars...
Return

AddVar(strVarName)
{
  global
  VarList%iVarCount% := strVarName
  iVarCount = iVarCount + 1
}


You could also grab the output from a ListVars and put that list of variables in your script.
_________________
My AutoHotkey Program for Warcraft III:
Warkeys
http://warkeys.sourceforge.net/

Remap your hotkeys
Healthbars always on
Remap inventory
Back to top
View user's profile Send private message Visit poster's website
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Fri Nov 03, 2006 11:13 am    Post subject: Reply with quote

Invalid User wrote:
I am looking for a simple function that can create and update a list of the variables that exist within a script. then this list can be handled in a number of ways.
I asked for that already, but it doesn't exist. IIRC, Laszlo shown how to grab this info from the list var window.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Fri Nov 03, 2006 2:47 pm    Post subject: Reply with quote

Heres something i did a while back....Could give ideas anyway

Code:
; #WinActivateForce
SetTitleMatchMode, 2
DetectHiddenWindows, On
; SetBatchLines -1
Nick:=1
_Debug(3,  True)
MsgBox, Nick - %Nick%

; _Debug(1, False)

_Debug(3, True)
MsgBox, End of Debug Routine

; MsgBox
ExitApp
; Pause
return
============================================

; --- Method
; --- "1" - Display the current variables
; --- "2" - Display the last lines executed
; --- "3" - 1 & 2
;
; --- Pause
; --- "0" - Do not Pause the Script
; --- "1" - Default - Pause the Script before exiting the function
_Debug(Method,PauseOn=1)
{
Global Vars_0
;
IfEqual, Method, 1
   {
   Gosub, CreateVariableWindow
   }
IfEqual, Method, 2
   {
   Gosub, ShowLastLines
   }
IfEqual, Method, 3
   {
   Gosub, CreateVariableWindow
   Gosub, ShowLastLines
   }
IfEqual, PauseOn, 1
   {
   Gui, 90:+LastFound
   Gui, 90:Default
   GuiControl, Enable, Button1
   GuiControl, Enable, VarToChange
   GuiControl, Enable, NewValue
   Gosub, ShowScriptCommander
   }
; return
 }

ShowScriptCommander:
Gui, 95:Add, Button, gPtoggle, Pause
Gui, 95:Show, ; x988 y236,
Pause, Toggle
Return

Ptoggle:
Pause, Toggle
Gui, 95:Destroy
Return

CreateVariableWindow:
   Gui, 90:Destroy
   Gui, 90:Add, ListView, h300 w400, Variable Name|Size|Capacity|Value
   Gui, 90:+LastFound
   Gui, 90:Default
   Gui, 90:Listview, SysListView321
   LV_Delete()   
   AutoTrim, On
   ListVars
   ControlGetText, CurVars, Edit1, AutoHotkey v1.0
   ; debug_WriteLogFile(CurVars)

   WinHide, AutoHotkey v1.0
   CV:= ;
   
   StringReplace, CurVars, CurVars, [, ^, A
   StringReplace, CurVars, CurVars, ], ^, A
   StringReplace, CurVars, CurVars, of, ^, A
   StringReplace, CurVars, CurVars, :, %A_Space%, A
   StringSplit, VarList_, CurVars, `n
   Loop, %VarList_0%
      {
      Loop %Vars_0%
         Vars_%A_Index%:= ;
      StringSplit, Vars_, VarList_%A_Index%, ^
      Gui, 90:+LastFound
      Gui, 90:Default
      Gui, 90:Listview, SysListView321
      Vars_1=%Vars_1%
      Vars_2=%Vars_2%
      Vars_3=%Vars_3%
      Vars_4=%Vars_4%
      Test:= ;
      StringLeft, Test, Vars_1, 3
      IfEqual, Test, ---
         Continue
      Test:= ;
      IfEqual, Vars_2, %Test%
         Continue
      LV_Add("",Vars_1,Vars_2, Vars_3,Vars_4)
      CV:=CV . Vars_1 . "|"
      }
   Loop % LV_GetCount("Column")
      LV_ModifyCol(A_Index, "AutoHdr")
   LV_ModifyCol(1, "Sort")
   Sort, CV, D|
   Gui, 90:Add, ComboBox, r6 w175 vVarToChange, %CV%
   Gui, 90:Add, Edit, r1 w300 vNewValue, New Value
   Gui, 90:Add, Button, gUpdateVarValue , Update
   Gui, 90:+Resize
   Gui, 90:Show, x28 y350, Current Variables
   ; debug_WriteLogFile(CurVars)

Return



UpdateVarValue:
Gui, 90:Submit
%VarToChange%:=NewValue
GoSub, CreateVariableWindow
Return

ShowLastLines:
   Gui, 91:Destroy
   ListLines
   ControlGetText, LastLinesEx, Edit1, AutoHotkey v1.0
   debug_WriteLogFile(LastLinesEx)
   WinHide, AutoHotkey v1.0
   Gui, 91:Add, Edit, r20 w600,%LastLinesEx%
   Gui, 91:Show, x362 y477, Last Lines Executed
Return
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group