nopee427 Posted September 25, 2020 Share Posted September 25, 2020 I want to press a key that will work in the background in a specific window.. Is this possible with autoit? how to do? THx.. Link to comment Share on other sites More sharing options...
TheXman Posted September 25, 2020 Share Posted September 25, 2020 Your question has been asked & answered NUMEROUS times. Why don't you try using the search box and type in: keystroke AND background nopee427 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Danp2 Posted September 25, 2020 Share Posted September 25, 2020 Your question is also very vague. If you want help from the forum, I suggest that you provide more details, ie -- What keystroke do you need to send? What application are you trying to automate? Etc nopee427 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
zeenmakr Posted September 26, 2020 Share Posted September 26, 2020 HotKeySet('{F1}', '_heyNotepad') HotKeySet('{ESC}', '_Exit') Local $_CLASS_TITLE_NOTEPAD = '[CLASS:Notepad]' ; Run Notepad with the window maximized. Run("notepad.exe") ; Wait 5 seconds for the Notepad window to appear. WinWait($_CLASS_TITLE_NOTEPAD, '', 5) While Sleep(10) WEnd Func _heyNotepad() If WinActive($_CLASS_TITLE_NOTEPAD) Then Send('{HOME}'&'computer: got fetch my keyboard!'& @CRLF) Else MsgBox(0, @ScriptLineNumber&': error', 'notepad is not focus') EndIf EndFunc Func _Exit() Exit EndFunc nopee427 1 Link to comment Share on other sites More sharing options...
nopee427 Posted September 27, 2020 Author Share Posted September 27, 2020 (edited) On 9/26/2020 at 2:28 AM, TheXman said: Your question has been asked & answered NUMEROUS times. Why don't you try using the search box and type in: keystroke AND background On 9/26/2020 at 2:44 AM, Danp2 said: Your question is also very vague. If you want help from the forum, I suggest that you provide more details, ie -- What keystroke do you need to send? What application are you trying to automate? Etc On 9/26/2020 at 3:49 AM, zeenmakr said: HotKeySet('{F1}', '_heyNotepad') HotKeySet('{ESC}', '_Exit') Local $_CLASS_TITLE_NOTEPAD = '[CLASS:Notepad]' ; Run Notepad with the window maximized. Run("notepad.exe") ; Wait 5 seconds for the Notepad window to appear. WinWait($_CLASS_TITLE_NOTEPAD, '', 5) While Sleep(10) WEnd Func _heyNotepad() If WinActive($_CLASS_TITLE_NOTEPAD) Then Send('{HOME}'&'computer: got fetch my keyboard!'& @CRLF) Else MsgBox(0, @ScriptLineNumber&': error', 'notepad is not focus') EndIf EndFunc Func _Exit() Exit EndFunc I tried to do it with autohotkey, but they said that it is not possible, we cannot use sendevent and controlsend at the same time, so I discovered autoit and can I do this logic here? *** Algorithm 🧠> My goal is to just send the three keys to a app window and I want it to be still doing keystrokes when I hide the application. NOTE : You can see that I have my attempts in the comment line! I will be waiting for your help, thanks! PEACE! ❤️ My Code : expandcollapse popup#MaxThreadsPerHotkey, 2 ; aynı tuş işlemi aynı anda kaç tane çalışabilsin #SingleInstance, Force ; aynı anda scriptin tek kopyası çalışsın DetectHiddenWindows, On ; gizli pencerelerle işlem yapabilme #Warn ; uyarılar, scriptteki hatalarla ilgili ayrıntı dönme #NoEnv ; gelecekteki AutoHotkey sürümleriyle uyumluluk için #SingleInstance Force SetWorkingDir %A_ScriptDir% if not A_IsAdmin Run *RunAs "%A_ScriptFullPath%" ; (A_AhkPath is usually optional if the script has the .ahk extension.) You would typically check first. ;a = SendEvent, {SPACE down} ;b = SendEvent, {F1 down}{F1 up} ;c = SendEvent, {z down}{z up} Loop 99999999999999999 { ;ControlSend, {F1 Down}{F1 Up}, ahk_exe app.exe if (true) { SetKeyDelay 200 SendEvent, {F1 down}{F1 up} SetKeyDelay 100 SendEvent, {SPACE down} SetKeyDelay 100 SendEvent, {z down}{z up} SetKeyDelay 100 ;WinActivate, ahk_pid 4652, SendEvent {F1 down}{F1 up} ;WinActivate, ahk_exe metin2.exe, SendEvent, {SPACE down} ;ControlSend, ahk_exe metin2.exe, %a% ;ControlSend, ahk_exe metin2.exe, %b% ;ControlSend, ahk_exe metin2.exe, %c% } sleep 100 } Home:: ExitApp Edited September 27, 2020 by nopee427 Link to comment Share on other sites More sharing options...
zeenmakr Posted September 27, 2020 Share Posted September 27, 2020 9 minutes ago, nopee427 said: My goal is to just send the three keys to a game window and I want it to be still doing keystrokes when I hide the game. you might want to convert your ahk code into autoit for better assistance. use 'autoit window info' tool and get info of the game window and send a screenshot of that in. (is metin2.exe your game?) expandcollapse popupHotKeySet('{F4}', '_GameHotkeys') ;press F4 key on your keyboard to to execute F1 then SPACEBAR then z in the game HotKeySet('{ESC}', '_Exit') Global $_CLASS_TITLE_GAME = '[CLASS:MyXGame; TITLE:Game X Title]' ; <--- use 'autoit windows info' to get class and title of your game While Sleep(10) WEnd Func _GameHotkeys() Switch @HotKeyPressed Case "{F4}" ; from ahk ; SetKeyDelay 200 ; SendEvent, {F1 down}{F1 up} ; SetKeyDelay 100 ; SendEvent, {SPACE down} ; SetKeyDelay 100 ; SendEvent, {z down}{z up} ; SetKeyDelay 100 If _IsGameActive() Then ;to autoit Sleep(200) ;time in miliseconds Send('{F1}') Sleep(100) Send('{SPACE}') Sleep(100) Send('z') Sleep(100) EndIf EndSwitch EndFunc Func _IsGameActive() If WinExists($_CLASS_TITLE_GAME) Then If Not WinActive($_CLASS_TITLE_GAME) Then WinActivate($_CLASS_TITLE_GAME) WinWaitActive($_CLASS_TITLE_GAME, 10) EndIf Return 1 Else Return 0 EndIf EndFunc Func _Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
nopee427 Posted September 27, 2020 Author Share Posted September 27, 2020 (edited) 1 hour ago, zeenmakr said: you might want to convert your ahk code into autoit for better assistance. use 'autoit window info' tool and get info of the game window and send a screenshot of that in. (is metin2.exe your game?) expandcollapse popupHotKeySet('{F4}', '_GameHotkeys') ;press F4 key on your keyboard to to execute F1 then SPACEBAR then z in the game HotKeySet('{ESC}', '_Exit') Global $_CLASS_TITLE_GAME = '[CLASS:MyXGame; TITLE:Game X Title]' ; <--- use 'autoit windows info' to get class and title of your game While Sleep(10) WEnd Func _GameHotkeys() Switch @HotKeyPressed Case "{F4}" ; from ahk ; SetKeyDelay 200 ; SendEvent, {F1 down}{F1 up} ; SetKeyDelay 100 ; SendEvent, {SPACE down} ; SetKeyDelay 100 ; SendEvent, {z down}{z up} ; SetKeyDelay 100 If _IsGameActive() Then ;to autoit Sleep(200) ;time in miliseconds Send('{F1}') Sleep(100) Send('{SPACE}') Sleep(100) Send('z') Sleep(100) EndIf EndSwitch EndFunc Func _IsGameActive() If WinExists($_CLASS_TITLE_GAME) Then If Not WinActive($_CLASS_TITLE_GAME) Then WinActivate($_CLASS_TITLE_GAME) WinWaitActive($_CLASS_TITLE_GAME, 10) EndIf Return 1 Else Return 0 EndIf EndFunc Func _Exit() Exit EndFunc Bro thx. But.. Application title always change.. can we do it with application pid? add me and let me show the status on live.. Discord : Razzere#8325 Edited September 27, 2020 by nopee427 Link to comment Share on other sites More sharing options...
Somerset Posted September 27, 2020 Share Posted September 27, 2020 1 hour ago, nopee427 said: *** Algorithm 🧠> My goal is to just send the three keys to a game window and I want it to be still doing keystrokes when I hide the game. reported. Link to comment Share on other sites More sharing options...
zeenmakr Posted September 27, 2020 Share Posted September 27, 2020 1 minute ago, nopee427 said: Game title always change.. can we do it with game pid? use 'autoit window info' tool and get info of the game window and send a screenshot of that in. (is metin2.exe your game?) ; <--- use 'autoit windows info' to get class and title of your game nopee427 1 Link to comment Share on other sites More sharing options...
zeenmakr Posted September 27, 2020 Share Posted September 27, 2020 1 minute ago, Somerset said: reported. ? Link to comment Share on other sites More sharing options...
Somerset Posted September 27, 2020 Share Posted September 27, 2020 Quote Forum Posting 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Launching, automation or script interaction with games or game servers, regardless of the game. Forum rules Link to comment Share on other sites More sharing options...
nopee427 Posted September 27, 2020 Author Share Posted September 27, 2020 (edited) 8 dakika önce zeenmakr şunları söyledi: 'otomatik pencere bilgisi' aracını kullanın ve oyun penceresi hakkında bilgi alın ve bunun bir ekran sayımı içeri gönderin. (metin2.exe sizin oyununuz mu?) ; <--- oyununuzun sınıfını ve adını almak için 'otomatik bilgi bilgi' kullanın ok bro u Özel mesaj Edited September 27, 2020 by nopee427 Link to comment Share on other sites More sharing options...
nopee427 Posted September 27, 2020 Author Share Posted September 27, 2020 11 minutes ago, Somerset said: reported. You are very rude, you can be understanding bro..I'm just trying to learn that's all Link to comment Share on other sites More sharing options...
nopee427 Posted September 27, 2020 Author Share Posted September 27, 2020 (edited) 33 minutes ago, zeenmakr said: ? #Edit Edited September 27, 2020 by nopee427 rules Link to comment Share on other sites More sharing options...
zeenmakr Posted September 27, 2020 Share Posted September 27, 2020 14 minutes ago, nopee427 said: You are very rude, you can be understanding bro..I'm just trying to learn that's all rules are rules, just avoid mentioning 'game' or 'games' in the future 4 minutes ago, nopee427 said: Look picture bro.. you got it nopee427 1 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 27, 2020 Moderators Share Posted September 27, 2020 4 hours ago, nopee427 said: You are very rude, you can be understanding bro..I'm just trying to learn that's all Same old, tired excuse we hear all the time. Sad that botters can't even come up with new excuses. Earthshine 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts