floz94 Posted April 20, 2018 Posted April 20, 2018 Hey, I was wondering if someone can write me a simple script that would press enter - type text - press enter again when pressed binded key,
aa2zz6 Posted April 20, 2018 Posted April 20, 2018 (edited) Consider reviewing this posting below and see if your solution is there. I would also recommend reading how to use _IsPressed and Send("") functions. _IsPressed > https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm send() > https://www.autoitscript.com/autoit3/docs/functions/Send.htm Edited April 20, 2018 by aa2zz6
floz94 Posted April 20, 2018 Author Posted April 20, 2018 I'm trying to make this work, but for some reason I cant compile this, can you find why? Quote HotKeySet("{10}", "_Toggle1") Global $Toggle1 = False While 1 If $Toggle1 Then SendInfo (" PM for more information. ")) Sleep(50) WEnd ; Func SendInfo ($text) Send("{ENTER}") Sleep(100) Send($text) Sleep(100) Send("{ENTER}") Sleep(1000) EndFunc ;==>SendInfo ; Func _Toggle1 () $Toggle1 = Not $Toggle1 EndFunc ;==>_Toggle1 ; Func _Exit () Exit EndFunc ;==>_Exit
aa2zz6 Posted April 20, 2018 Posted April 20, 2018 (edited) It looks like your syntax and structure is not correct. What kind of program are you trying to automate? Your current script isn't setting an active screen to write to and because it's in a while loop it'll write for ever. I'll post an example script that you can take a look at. I would recommend using the WinActive function to activate the desired screen before using send("...") to write. Example script: _IsPressed Codes > https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm ; #include <Misc.au3> #include <MsgBoxConstants.au3> HotKeySet("{F5}", "Terminate") Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("10", $hDLL) Then ; This is the Shift key << press to hold ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send("This is some text.") ; Wait until key is released. While _IsPressed("10", $hDLL) WEnd ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF) ElseIf _IsPressed("1B", $hDLL) Then MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.") ExitLoop EndIf Sleep(250) WEnd DllClose($hDLL) Func Terminate() Exit EndFunc ;==>Terminate Edited April 20, 2018 by aa2zz6
floz94 Posted April 20, 2018 Author Posted April 20, 2018 Well I just want to find a script that will send simple msg in game, is there a one i can copy?
aa2zz6 Posted April 20, 2018 Posted April 20, 2018 Just now, floz94 said: Well I just want to find a script that will send simple msg in game, is there a one i can copy? I don't mean to be rude but if you don't want to learn from the example and links I provided then I won't be able to help you ^^
floz94 Posted April 21, 2018 Author Posted April 21, 2018 Im looking for simple script that would type for me in game previously set text once pressed the bind key
Developers Jos Posted April 21, 2018 Developers Posted April 21, 2018 (edited) 7 hours ago, floz94 said: Well I just want to find a script that will send simple msg in game, is there a one i can copy? @floz94, Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. (there is also a link in my signature) Please read them now particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. Also see that patience isn't your strongest point. Make sure you get some when continuing in these forums. See you soon with a legitimate question I hope. Jos Edited April 21, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts