Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

ListVars


  • Please log in to reply
33 replies to this topic

Poll: What do you think about this wsh (25 member(s) have cast votes)

What do you think about this wsh

  1. Cmon Chris, add this FFS ! (23 votes [88.46%])

    Percentage of vote: 88.46%

  2. No Chris, don't listen to them ! (3 votes [11.54%])

    Percentage of vote: 11.54%

Vote Guests cannot vote
majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
Not that big - 16,350.

I voted yes, but, er.. was the poll here before or was just introduced ?

Obviously not :)

BTW, I acctually can't imagine why would somebody vote negative here.... :roll:
Posted Image

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

BTW, I acctually can't imagine why would somebody vote negative here.... :roll:


Just trying to be imaginative... I pray god it was not Mr.Chris

:D

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
OH :shock: Lets pray together.....

Just trying to be imaginative

Damn, this hurts...
Posted Image

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

Not that big - 16,350.

Not even that big. The buffer AutoHotkey uses is 65534 bytes. It's based on the limit of an Edit control on Win9x.

I did a simple test, creating 17000 empty variables named v%A_Index%. It hit the buffer limit at 3465 variables. That would be even less if the variables weren't empty...

majkinetor
  • Moderators
  • 4512 posts
  • Last active: May 20 2019 07:41 AM
  • Joined: 24 May 2006
OMG!!!! That is so not good... so we can get in normal scenarios mostly 2K variables....
Posted Image

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
override the limit... and/or use richedit internally instead :?: :idea:

sbc
  • Members
  • 321 posts
  • Last active: Jun 07 2011 10:24 AM
  • Joined: 25 Aug 2009

Edit @ 2010-10-21 - Unicode builds of AutoHotkey_L require the additions shown in green (optional for the ANSI build):

pSFW := DllCall("GetProcAddress", "uint", hmod, "[color=green]a[/color]str", "SetForegroundWindow")
        pSW := DllCall("GetProcAddress", "uint", hmod, "[color=green]a[/color]str", "ShowWindow")

In my environment(Windows 7 64bit), the script crashes with those lines. I had to change it to "str" but if I do so, the AutoHotkey main window gets activated.

build := A_PtrSize*8
Msgbox AHK Version: %A_AhkVersion% Build: %build%  Unicode: %A_IsUnicode%
The result of the above code:

AHK Version: 1.0.48.05.L61 Build: 64 Unicode: 1



Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
My code isn't x64-compatible. You could try replacing "uint" with "ptr" for the pointer/handle parameters. I'm fairly certain it's safe to do so for any "uint" parameters. If the function accepts uint, it should just ignore the upper half of the 64-bit integer. I'm not sure whether the machine code (see NumPut) is x64-compatible.

Btw, "astr" is absolutely necessary on Unicode builds. GetProcAddress cannot work if you pass it a Unicode string.

sbc
  • Members
  • 321 posts
  • Last active: Jun 07 2011 10:24 AM
  • Joined: 25 Aug 2009

You could try replacing "uint" with "ptr" for the pointer/handle parameters.

Hmm, I haven't been successful doing it. Thanks for the info. However, I seem to have found a workaround. Do you think this slows down the script or causes any side effects?
Loop {
    tick := A_TickCount
    ToolTip % ListGlobalVars()
	sleep 100
}

~Esc::ExitApp

ListGlobalVars() {
	static hwndEdit, hwnd_owner, hwnd_hidden, hwnd_tray
	dhw := A_DetectHiddenWindows
	DetectHiddenWindows, On	
	
    if !hwndEdit {
		PID := DllCall("GetCurrentProcessId")
        ControlGet, hwndEdit, Hwnd,, Edit1, ahk_class AutoHotkey ahk_pid %PID%
		WinGet, hwnd_tray, ID, ahk_pid %PID%
		hwnd_owner := DllCall("GetWindow", "uint", hwnd_tray, "uint", "4" )
		Gui, 99:+LastFound
		hwnd_hidden := WinExist()		
    }
	
	DllCall("SetParent", "uint", hwnd_tray, "uint", hwnd_hidden)	
    ListVars
    ControlGetText, text,, ahk_id %hwndEdit%
    RegExMatch(text, "sm)(?<=^Global Variables \(alphabetical\)`r`n-{50}`r`n).*", text)

	WinSet, Style, +0x40000000, ahk_id %hwnd_tray%
	WinHide, ahk_id %hwnd_tray%
	DllCall("SetParent", "uint", hwnd_tray, "uint", hwnd_owner)	
	
	WinSet, Style, -0x40000000, ahk_id %hwnd_tray%
	DetectHiddenWindows, %dhw%	
    return text
}


lexikos-nli
  • Guests
  • Last active:
  • Joined: --
Your approach is similar to corrupt's. See my reply to his post.

sbc
  • Members
  • 321 posts
  • Last active: Jun 07 2011 10:24 AM
  • Joined: 25 Aug 2009

See my reply to his post.

ok,

If you set the parent to "int", -3 (HWND_MESSAGE) instead of UInt,WinExist("ahk_class Shell_TrayWnd"), AutoHotkey becomes a message-only window. This prevents it from stealing the focus, so getting variables,etc. doesn't interrupt the user.

It does still cause the active window to flicker, though...

So I tried
DllCall("SetParent", "uint", hwnd_tray, "int", -3)
instead of
DllCall("SetParent", "uint", hwnd_tray, "uint", hwnd_hidden)
I'm not seeing any window flickering but indeed it steals the focus. hmm.

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
See my updated post. It should work on all current builds of AutoHotkey Basic and AutoHotkey_L.

sbc
  • Members
  • 321 posts
  • Last active: Jun 07 2011 10:24 AM
  • Joined: 25 Aug 2009

See my updated post. It should work on all current builds of AutoHotkey Basic and AutoHotkey_L.

Works perfectly, thanks. :)

ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008
Great!!

JoeSchmoe
  • Members
  • 304 posts
  • Last active: Feb 28 2013 05:39 PM
  • Joined: 17 Feb 2008
I love this little bit of code. (Lexikos' workaround)

I just dealt with a frustrating bug related to it. The code appeared to simply stop working. I began trying to figure out what the f%^& VirtualProtect, etc. , did (not fun for me!), but then eventually figured out what actually happened. I had run AutoSyntaxTidy on my whole script with Case-Correction turned on, and it had changed the RegEx that the function uses to find the global variables section of ListVars. Specifically,

RegExMatch(text, "sm)(?<=^Global Variables \(alphabetical\)`r`n-{50}`r`n).*", text)

had become

RegExMatch(text, "sm)(?<=^global Variables \(Alphabetical\)`r`n-{50}`r`n).*", text)

Frustrating!

I've prevented this from happening in the future (I love AST and have it hotkeyed) by adding the "i" option to the relevant regex, like so:

RegExMatch(text, "ism)(?<=^Global Variables \(alphabetical\)`r`n-{50}`r`n).*", text)

Since this doesn't happen often, I'd totally understand if Lexikos doesn't want to add it to his code, but I thought I'd share it anyway (and perhaps if I paste Lexikos' code in again, I'll have this to remind me if things go wrong.)