Jump to content

Once U is pressed, stop a Function, resume function with Backspace and Enter


Recommended Posts

What's up everyone.

 

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

I want to to change this script so, that when I press "U" the function _enter is going to be paused, it should basically no longer send "3" until I press "Backspace", as it should be resumed. Not only that, let's say I press "Enter" (for example, it'd look like this: You type "hello", it's going to be "hello3", but when I press "U" it should look like "hello", but Enter should resume the function so that the next would look like "hello3". Backspace should be like Enter, just so, for example, if you'd type "hello" and you press "U", it would exclude "3" from being placed at the end of a sentence, but now, you didn't press Enter right? So Backspace should function like Enter, it should resume function _enter. It should always be like this. Sorry if my explanation isn't good enough. I tried to explain it as best as I can. :P

If you can help me out with this, I would TRULY appreciate it!

 

Edited by abokdl
Link to comment
Share on other sites

  • Developers

Funny you return after a year and are still working on the same script only this time really AutoIt3?
I see this script only has a bit on your wishes implemented, so what have you tried to make the rest working and what are your issues?
It would also be helpful to understand what program you are trying to automate as I can't think of one where you always want to add a 3 before the enter.

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.
  :)

Link to comment
Share on other sites

42 minutes ago, Jos said:

Funny you return after a year and are still working on the same script only this time really AutoIt3?
I see this script only has a bit on your wishes implemented, so what have you tried to make the rest working and what are your issues?
It would also be helpful to understand what program you are trying to automate as I can't think of one where you always want to add a 3 before the enter.

Jos

 

I don't have any issues with the script. I just want to improve it. I have tried adding a Resume/Pause function, but it seems I can't find a working one. I need it for Notepad.

This is how my script currently looks like:

HotKeySet("{ENTER}","EnableSend2")
HotKeySet("{ENTER}","_enter")
HotKeySet("U","_StopSend")
HotKeySet("[Backspace]","_EnableSend")
HotKeySet("{ESC}","_exit");
HotKeySet("{F11}","_TogglePause")
While Sleep(100);
WEnd
Func _enter()
    HotKeySet("{ENTER}");
    Send("3{ENTER}");Send 3
    HotKeySet("{ENTER}","_enter");
EndFunc
Func _exit()
    Exit
 EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0); Doesn't work(?)
    WEnd
    ToolTip("")
 EndFunc
 Func EnableSend()
 EndFunc; Don't know what to put in here
 Func StopSend()
 EndFunc; Don't know what to put in here
  Func EnableSend2()
 EndFunc; Don't know what to put in here

I edited it a bit. I think I need to make a function that enables, or disables a other function. I'm not sure. Can you help me a bit? Pretty complicated if you ask me. :/

Edited by abokdl
Link to comment
Share on other sites

  • Developers
14 minutes ago, abokdl said:

I need it for Notepad.

Makes sense ...  really? :)

Try this for starters:

HotKeySet("{ENTER}", "_enter")
HotKeySet("{ESC}", "_exit") ;
HotKeySet("{F11}", "_TogglePause")
Global $Paused = False
While 1
    Sleep(100) ;
WEnd
Func _enter()
    HotKeySet("{ENTER}")
    If Not $Paused Then
        Send("3") ;Send 3
    EndIf
    Send("{ENTER}")
    HotKeySet("{ENTER}", "_enter")
EndFunc   ;==>_enter
Func _exit()
    Exit
EndFunc   ;==>_exit
Func _TogglePause()
    $Paused = Not $Paused
    Return
EndFunc   ;==>_TogglePaus

Jos

Edited 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.
  :)

Link to comment
Share on other sites

28 minutes ago, Jos said:

Makes sense ...  really? :)

Try this for starters:

HotKeySet("{ENTER}", "_enter")
HotKeySet("{ESC}", "_exit") ;
HotKeySet("{F11}", "_TogglePause")
Global $Paused = False
While 1
    Sleep(100) ;
WEnd
Func _enter()
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : _enter() ' & $Paused & @CRLF) ;### Debug Console
    HotKeySet("{ENTER}")
    If Not $Paused Then
        Send("3") ;Send 3
    EndIf
    Send("{ENTER}")
    HotKeySet("{ENTER}", "_enter")
EndFunc   ;==>_enter
Func _exit()
    Exit
EndFunc   ;==>_exit
Func _TogglePause()
    $Paused = Not $Paused
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : _TogglePause() ' & $Paused & @CRLF) ;### Debug Console
    Return $Paused
EndFunc   ;==>_TogglePaus

Jos

Thanks for the tip! That helped me alot!

HotKeySet("{ENTER}", "_enter")
HotKeySet("{ESC}", "_exit") ;
HotKeySet("{?}", "_TogglePause")
HotKeySet("{SPACE}", "_TogglePause")
Global $Paused = False
While 1
    Sleep(100) ;
WEnd
Func _enter()
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : _enter() ' & $Paused & @CRLF) ;### Debug Console
    HotKeySet("{ENTER}")
    If Not $Paused Then
        Send("3") ;Send 3
    EndIf
    Send("{ENTER}")
    HotKeySet("{ENTER}", "_enter")
EndFunc   ;==>_enter
Func _exit()
    Exit
EndFunc   ;==>_exit
Func _TogglePause()
    $Paused = Not $Paused
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : _TogglePause() ' & $Paused & @CRLF) ;### Debug Console
    Return $Paused
EndFunc   ;==>_TogglePaus

I believe I'm almost done. I just need to figure out a few things. Can you only help me with two things? I decided to change "F2" into "?", but that does not work for me. I googled but I couldn't find the question mark. As I understand, it's not even possible? Or did I misunderstand something?

Also "SPACE" resumes the function which is very nice, but Space is basically broken then. I can't type sentences like "What's up guys." It'd look like "Whatsupguys." D:

Edited by abokdl
Forgot something.
Link to comment
Share on other sites

  • Developers

Don't need the curly braces around the ?, but that works fine for me. As to your second issue: Disable the HotKey for Space when you want to type space in a send , like you've done for {Enter}.

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.
  :)

Link to comment
Share on other sites

11 minutes ago, Jos said:

Don't need the curly braces around the ?, but that works fine for me. As to your second issue: Disable the HotKey for Space when you want to type space in a send , like you've done for {Enter}.

Jos 

Oh okay, thanks. For some reason "?" still doesn't work for me. I honestly have no idea why. "?" should just trigger TogglePaus, you know. Do you have any idea why it couldn't be working?

 

Regarding the Spacebar, I removed the HotKey. I'm trying to find a way to not make the Spacebar reserved by AutoIt, also basically I should still be able to use the Spacebar, but at the same time it should trigger the Pause func as well.

 

HotKeySet("{ENTER}", "_enter")
HotKeySet("?", "_TogglePause")
Global $Paused = False
While 1
    Sleep(1) ;
WEnd
Func _enter()
    HotKeySet("{ENTER}")
    If Not $Paused Then
        Send("3") ;Send 3
    EndIf
    Send("{ENTER}")
    HotKeySet("{ENTER}", "_enter")
 EndFunc   ;==>_enter
Func _TogglePause()
    _IsPressed ( 20 [, $vDLL = 'user32.dll'] )
    $Paused = Not $Paused
    Return
 EndFunc   ;==>_TogglePaus

This is the script at the moment. I'm sorry if it looks bad, I'm really trying my best. I really want to get this working mate!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...