abokdl Posted August 29, 2017 Share Posted August 29, 2017 Hola. For some reason I can't add a Pause/Resume func to my script. It always says that a variable was used without being declared, but however. What I'm trying to do is, I always want to pause the script when "1" is pressed. It should only pause the script, not resume when pressing it again. And I always want to resume the script when Enter or Space is pressed. So let's say you are going to type "Hello people" it would look like "Hello people3" (check script), and when I press 1 it should look like "Hello people". And when pressing enter it should still look like "Hello people", ENTER should only resume the script after I already paused the script and resume overall, so that it would NOT look like "Hello people3" although you have previously paused the func! I would be VERY thankful if one of you pros would help me out with this. You really don't know how thankful I would be! If you have any questions, go on and ask. HotKeySet("{ENTER}","_enter") HotKeySet("{ESC}","_exit");Exit with ESC While Sleep(100);Sleep WEnd Func _enter() HotKeySet("{ENTER}");Hotkey Send("3{ENTER}");Send 3 and afterwards Enter HotKeySet("{ENTER}","_enter");Enter EndFunc Func _exit() Exit;Bye! EndFunc Link to comment Share on other sites More sharing options...
david1337 Posted August 30, 2017 Share Posted August 30, 2017 (edited) Hi abokdl, Sorry, but that is the weirdest explanation ever I am quite sure that it's easy to create a script that does what you want, but nobody understands what that is. So let's say you are going to type "Hello people" it would look like "Hello people3"Typing "Hello people" where? Notepad?... And it would only be "Hello people3" if you hit ENTER after, right? and when I press 1 it should look like "Hello people" It should change the existing "Hello people3" to "Hello people" or just write a new "Hello people" ? Please try to explain what you are trying to achieve a little better, and I will be glad to help you - David Edited August 30, 2017 by david1337 Link to comment Share on other sites More sharing options...
232showtime Posted August 30, 2017 Share Posted August 30, 2017 Please next time use help file or google correct way of using hotkeys, here ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
abokdl Posted August 31, 2017 Author Share Posted August 31, 2017 19 hours ago, david1337 said: Hi abokdl, Sorry, but that is the weirdest explanation ever I am quite sure that it's easy to create a script that does what you want, but nobody understands what that is. Sorry. Yeah, you are right. So let's say you are going to type "Hello people" it would look like "Hello people3"Typing "Hello people" where? Notepad?... And it would only be "Hello people3" if you hit ENTER after, right? and when I press 1 it should look like "Hello people" It should change the existing "Hello people3" to "Hello people" or just write a new "Hello people" ? If you type "Hello people" without pressing "1", then yes it would be "Hello people3", but if you press "1" then it would be "Hello people", and when pressing Enter it should resume the func that puts a "3" at the end of any sentence, but when you pressed "1" before it should still look like "Hello people", as Enter should only resume the func after you already have pressed "1". For example you type "Hey" and you'd press "1", it would look like "Hey1" instead of "Hey13", right? Remember that the script puts a "3" at the end of whatever you type, typing "1" should just stop it from sending "3" and when you send what you typed (assuming you send it via Enter) it should just look like, another example "Car1", and ENTER should resume the func that puts a "3" at the very end of any sentence, ONLY after you already used "1" before in order to avoid the "3" at any sentence you're going to type. So again, let's say you type "Weather has come" and you would send it (pressing Enter), it would look like "Weather has come3", and when you press "1" it'd look like: Weather has come1", you SEND it via ENTER and the next sentence you are going to TYPE, will look like "Weather has come3" SINCE you resumed the func that (sorry, have to repeat it again) puts a "3" at the end of sentences, as long as you don't type "1" it should always have a "3" at the end. Another example is, when you type "Summer is long" and you'd make "Summer is long1 But winter is longer" out 0f it, do you notice the Spacebar I used between "long1 and But"? The Spacebar should only resume the func "3" after "1" is used, because if I leave the Spacebar out it would look like "Summer is long1 But winter is longer" instead of "Summer is long1 But winter is longer3". You know? Anyway, if Notepad++ or any other programm, it doesn't matter. It works for all programms. I hope that explains it for you mate. I really try to explain it as best as I can! - David Link to comment Share on other sites More sharing options...
Simpel Posted August 31, 2017 Share Posted August 31, 2017 4 hours ago, abokdl said: If you type "Hello people" without pressing "1", then yes it would be "Hello people3", but if you press "1" then it would be "Hello people" 4 hours ago, abokdl said: "Weather has come" and you would send it (pressing Enter), it would look like "Weather has come3", and when you press "1" it'd look like: Weather has come1" Hi, you contradict yourself as you can see in your quotes. I guess sentence one should be "Hello people1" if pressing "1". Nevertheless I tried to understand your very difficult explanation and made a script like this: expandcollapse popupGlobal $g_b1pressed = False Global $g_bPause = False HotKeySet("{ENTER}","_enter") HotKeySet("1", "_1") HotKeySet("{SPACE}", "_space") HotKeySet("{ESC}","_exit");Exit with ESC While Sleep(10);Sleep WEnd Func _enter() HotKeySet("{ENTER}");Hotkey _3() Send("{ENTER}") HotKeySet("{ENTER}","_enter");Enter $g_bPause = False $g_b1pressed = False EndFunc Func _3() If Not $g_bPause Then Send("3") EndFunc Func _1() HotKeySet("1") $g_bPause = True $g_b1pressed = True Send("1") HotKeySet("1", "_1") EndFunc Func _space() HotKeySet("{SPACE}") If $g_b1pressed = True Then $g_bPause = False Send("{SPACE}") HotKeySet("{SPACE}", "_space") EndFunc Func _exit() Exit;Bye! EndFunc Is that how it should work? Conrad abokdl 1 SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now