press numbers 2 3 4 and 5

Get help with using AutoHotkey and its commands and hotkeys
Noxion
Posts: 1
Joined: 06 Apr 2020, 12:37

press numbers 2 3 4 and 5

06 Apr 2020, 12:43

OK im new with this and i got hard time finishing my script,

i want my script to do when i press space it will press numbres 2 3 4 and 5 but numbrer will not hapend more offten than each 4 sec, number 3 4 and 5 each 6 sec

so when i press space it will type 2 3 4 5 BUT when i press space straight again it will not type anyhint g till time trashold of 4 sec passed for number 2

i also want to turn sscript off and on with F1 is this posible ?

thx
SSpeed
Posts: 25
Joined: 04 Jul 2018, 09:48

Re: press numbers 2 3 4 and 5

06 Apr 2020, 20:27

how's this?

Code: Select all

#NoEnv
#SingleInstance Force
SendMode Input
SetWorkingDir %A_ScriptDir%
return

;{███████████████████████████████████████████████

	Space:: 
		if not (space_sequence_active)  ; (first press will go here)
			settimer, space_sequence, -1
		else {  ; (if the sequence is already active, it should go here)
			; soundbeep
			restart_sequence := true
			settimer, pre_space_sequence, -4000
		} return

		pre_space_sequence:
		space_sequence:
			restart_sequence := false,  space_sequence_active := true
			send 2
			_wait(4000)
			send 3
			_wait(6000)
			send 4
			_wait(6000)
			send 5
			_wait(6000)
			space_sequence_active := false
			return

	;ꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤꕤ

		_wait(ms) {
			global restart_sequence
			l := Round(ms/1000)
			loop %l% {
				sleep 1000
				if (restart_sequence)
					exit
			}
		}

;{███████████████████████████████████████████████

	F1:: 
		Suspend Permit
		pause("toggle")
		return

		pause(state) {
			static pause
			pause := (state="toggle" ? !pause : state="on" ? true : false)
			if (pause) {
				Suspend on
				Pause on, 1
			} else {
				Suspend off
				Pause off
			}
		}
		
	; ~Esc:: 
	; 	Suspend Permit
	; 	ExitApp
Sorry it's not very simple... I'm still learning too.

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, ananthuthilakan, c7aesa7r, mikeyww, Netocon and 65 guests