Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 11:52

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Need help on sending keystrokes into a game window

Discussion on Need help on sending keystrokes into a game window within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
Kuraiko's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 104
Received Thanks: 19
Need help on sending keystrokes into a game window

Hello everyone,

I'm in need for some help with a script I'm coding right now. Pretty simple one, but I have one big problem.

The game i'm planning this to use in is Blade & Soul.
The use of the macro is to simply send repeatedly an F keystroke with 100ms pause between every keystroke.
When testing the macro by just sending F via "Send, F" in Notepad the macro works just fine.
Sending the key to Notepad via ControlSend also works fine. The notepad windows doesn't even need to be active this way.

So here's the code I have so far.
Code:
SetTitleMatchMode, 3				;3: A window's title must exactly match WinTitle to be a match.

^q::						; This hotkey stops the loop below and asks for continuation.
	BreakLoop = 1
	MsgBox, 4, Mine Farmer, The script will now be stopped.`nAre you sure?
	IfMsgBox, Yes
		ExitApp
	Else
		BreakLoop = 0
Return

!f::
	Loop 
		{
		Sleep, 100
		ControlSend, , f, ahk_class LaunchUnrealUWindowsClient	;This line totally works fine if I use "Notepad"
		If BreakLoop = 1					;as the ahk_class, but seems to do nothing in the
			Break						;game window when using the games ahk_class
		If BreakLoop = 0
			Continue
		}
Return
And my questions are:
Is it even possible to get my idea working via AHK in Blade & Soul?
If yes, what else could I try? Which other commands for example.

I'll totally read any documation that leads me to a solution as well!

Regards,
Kuraiko
Kuraiko is offline  
Old 04/15/2016, 19:42   #2
 
Kuraiko's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 104
Received Thanks: 19
Tiny Push

Little Push
Kuraiko is offline  
Old 04/16/2016, 16:37   #3
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
I dont know in AHK but in autoit u need to get window name or window handle.

Here is example in autoit :

Run it and press F9 to check if window exists u will get message.


Code:
#RequireAdmin


HotKeySet("{F1}", "_sendFkey")      ; key that start/pause bot
HotKeyset("{F9}", "_check_window")  ; key that check if window exists


Global $pause = False
Global $window = "window name" ; name of the window if this fail comment it and uncoment second $window variable
;~ Global $window = WinGetHandle("window name") ; this is second option if first fail uncoment this variable and comment first $window variable


While 1
    Sleep(100)
WEnd


; main function
Func _sendFkey()


    $pause = Not $pause


        While $pause


            ControlSend($window, "", "", "{F}") ; key
            Sleep(1000) ; pause, 1000 = 1 second


        WEnd
EndFunc ; => main function


Func _check_window()


    If WinExists($window) Then
        MsgBox(0, "Message", "Window exists.")
    Else
        MsgBox(0, "Error", "Window dont exists.")
    EndIf


EndFunc ; => check if window exists
mlukac89 is offline  
Thanks
1 User
Old 04/17/2016, 02:44   #4
 
Kuraiko's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 104
Received Thanks: 19
Hey mlukac89,

thanks for your answer.
Right now it says 02:43 on my clock, so I just flew over your code. I'll check it out at day time and let you know what I experience.

'Till then
Kuraiko

----------
Edit

Ha, totally forgot about this :O Sorry!
I got your solution to work, mlukac89. Thanks for your affort

Regards
Kuraiko
Kuraiko is offline  
Reply

Tags
ahk, auto hotkey, blade & soul, macro, script


Similar Threads Similar Threads
Sending Keystrokes to background-window
04/10/2014 - AutoIt - 6 Replies
Hi, i'm trying to build a simple bot for aura kingdom, that is able to send keystrokes, but i'm lacking in Auto-it and general programming-skills. I've tried the ControlSend-command but thats just sending Strings not keystrokes. I've tried the Send-command, but that just works if the game is in focus. Any help or useful hint would be nice.
sending commands to window...
07/05/2013 - Kal Online - 0 Replies
oké i'm trying to run 2x autopicker simultaneously, yet I can only do this by sending "space" replica's. Which means i need to have 1 window on top. Anyway to send those commands to a specific window instead of my computer in general? Is that detectable? kind regards
Function not sending keystrokes
01/18/2012 - C/C++ - 2 Replies
Dear readers, Probably a lot of fails in the coding but nevermind that please. I am still learning it. At the moment I made a simple GUI with just one function. Repeat a text someone shouted. It will send 3 keystrokes each loop. 1. Spacebar 2. Arrow up 3. Enter key
Help with Postmessage, Sending keystrokes.. !
04/12/2011 - AutoIt - 6 Replies
Hello everyone , i use this sourcecode that i found for sending keys on a minimized window. ; #FUNCTION# ================================================== ================================================== ================ ; Name...........: SimulKey ; Description ...: Simulate a Key-Send to a specified handle in the Background ; Author ........: Felix Lehmann ; Modified.......: If you modify this Script, please enter your name here ; Remarks .......: - ; Related .......: - ; Parameters...
Aion 1.9.0.3 sending keystrokes in background mode
08/29/2010 - Aion - 1 Replies
Hello to all! I'am trying to send keystrokes in BACKGROUND MODE to AION client using C++ (Builder2009): I do it like that: ... PostMessage(Window,WM_KEYDOWN, VK_OEM_MINUS, 0x00020001); ... This function works good for me, but as i can see i can't send WASD or VK_MENU(ALT) and more, something like game protection



All times are GMT +2. The time now is 11:52.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.