Is it possible to read the console output from a script?
Probably but why would you need that?
It's possible, Mine was able to do it.
You need to get the window offset and need to use some windows api functions though
09-05-2012, 17:26
(This post was last modified: 09-05-2012, 18:43 by kokole.)
i am able to read the last used command in black ops console so its possible (commands like, +melee -melee or even dvars)
it was just some address
0x03536C5C for black ops, i will try to update this post if i find it for mw3
EDIT: cant find.
I don't understand this offset thing can you tell me how to do this?
09-06-2012, 13:43
(This post was last modified: 09-06-2012, 13:44 by JariZ.)
CSHARP Code
unsafe string MW3Console { get { IntPtr form = *(IntPtr*)0x5933A50; IntPtr txtbox = FindWindowEx(form, IntPtr.Zero, "Edit", null); IntPtr console = FindWindowEx(form, txtbox, "Edit", null); StringBuilder sb = new StringBuilder (9999999); int result = SendMessageTimeout( console, 0x0D /*WM_GETTEXT*/, 9999999, sb, 10 /*SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG*/, 500, IntPtr.Zero); return sb.ToString(); } } [DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Ansi)] public static extern IntPtr FindWindow(string className, string windowName); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); [DllImport("User32.dll", SetLastError = true)] public static extern int SendMessageTimeout( IntPtr hWnd, uint uMsg, uint wParam, StringBuilder lParam, uint fuFlags, uint uTimeout, IntPtr lpdwResult);
The offset (line 5) is outdated and I got it from nukem.
I think (but not entirely sure) that barata's tool can tell you what it is.
This worked for me
CSHARP Code
unsafe string MW3Console { get { IntPtr form = FindWindow("IW5 WinConsole", "Call of Duty: Modern Warfare 3 Dedicated Server"); IntPtr txtbox = FindWindowEx(form,IntPtr.Zero,"Edit",null); IntPtr console = FindWindowEx(form, txtbox, "Edit", null); StringBuilder sb = new StringBuilder (9999999); int result = SendMessageTimeout( console, 0x0D /*WM_GETTEXT*/, 9999999, sb, 10 /*SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG*/, 500, IntPtr.Zero); return sb.ToString(); } } [DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Ansi)] public static extern IntPtr FindWindow(string className, string windowName); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); [DllImport("User32.dll", SetLastError = true)] public static extern int SendMessageTimeout( IntPtr hWnd, uint uMsg, uint wParam, StringBuilder lParam, uint fuFlags, uint uTimeout, IntPtr lpdwResult);
|