Help with text

BlitzPlus Forums/BlitzPlus Beginners Area/Help with text

Nike(Posted 2009) [#1]
Im making an auto typer and i would like the text to be in your chat thing. Like for instence if i was on club penguin ( I don't play but i cant think of anything else) and i need to type something really fast and i didnt fell like copy & past, how would i get the text to come out of the program? In my program you set the ]word(s) and how many seconds it waits until it repeats. But how would i get the text to the game??? Im so confused :(


xlsior(Posted 2009) [#2]
Im so confused :(


You're not the only one -- I have absolutely no idea what you're actually asking here.


Sauer(Posted 2009) [#3]
Perhaps you mean predictive text?


Nike(Posted 2009) [#4]
Ok im making an auto typer.

You type the text you want in my program.

How can I get the text from my program into a differnt program.

EX. you type "hi" in my program. It repeats "hi in notepad.

EX. you type "hello" in my program. It repeats "hello" in club penguin.

How would i get the text to repeat in the open window?


xlsior(Posted 2009) [#5]
If you type something in your program, then it must have the focus and the 'open window' would be your application's own.

The basic approach: You would need to find the window of the other program itself first, and transfer the information to it. I can't help you with BlitzPlus, but here's a Blitzmax sample that does what you want:

Const WM_SETTEXT = $00C
Const WM_COPYDATA = 74

Extern "Win32"

	Function FindWindow( lpClassName$z, lpWindowName$z ) = "FindWindowA@8"
	Function FindWindowEx( hwnd1:Int, hwnd2:Int, lpsz1$z, lpsz2$z ) = "FindWindowExA@16"
	Function SendMessage( hwnd, msg, wparam:Byte Ptr, lparam:Byte Ptr ) = "SendMessageA@16"
	Function GetLastError()

End Extern

win=FindWindow( "NotePad", "Untitled - Notepad" )
edit=FindWindowEx( win, Null, "Edit", Null )

SendMessage( edit, WM_SETTEXT, Null, "This is a test!" )


It uses the Windows API SendMessage command to send information into the edit field of Notepad. If you have notepad open (without opening any documents so the titlebar has the default "Untitled - Notepad" text in it) and run this in BlitzMax, the text "This is a test!" will appear in the notepad window.

For blitzBlus you'd need to use .decls files for the declarations, and you'd need to look for the specific window that your application is using. You may need a resource editor or the likes to find out the name(s) of the actual input field(s) that you wish to stuff the text into.


Nike(Posted 2009) [#6]
So there is no way my program could work in blitz pluse? heres the code




xlsior(Posted 2009) [#7]
Yes, it would work in blitzPlus as well, but the code I posted above would need some tweaks to be compatible... That, and you'd need to obtain the necessary information about the window layout of your target program so it knows which window element to send the info to.