Help with text

BlitzPlus Forums/BlitzPlus Beginners Area/Help with text

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 :(

Im so confused :(


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

Perhaps you mean predictive text?

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?

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.

So there is no way my program could work in blitz pluse? heres the code

Global MainWindow = CreateWindow("Auto type",150,200,300,200)

;Gadgets
CreateLabel("Word(s) to type:", 5, 5, 90, 15, MainWindow)
Global word$ = CreateTextField(5, 20, 100, 20, MainWindow)
CreateLabel("Repeat in how many seconds ex. 4 seconds would be 4000.", 5, 50, 300, 15, MainWindow)
Global sec$ = CreateTextField(5, 70, 60, 20, MainWindow)
Global startButton = CreateButton("Start", ClientWidth(MainWindow) - 60, 100, 50, 20, MainWindow)

Repeat 
id = WaitEvent() 
If id = $803 Then End 
If id = $401 And EventSource()=startButton

.home
Print TextFieldText(word$)
Delay TextFieldText(sec$)
Goto home
EndIf
Forever 



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.