Function LCtrl=Home & Home=LCtr

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Function LCtrl=Home & Home=LCtr

Re: solved

Post by ositoMalvado » 24 Mar 2024, 19:33

Hola! Aquí te presento dos soluciones posibles, una lenta (F1) y otra rápida (F2)

Code: Select all

; Cada cuánto enviar en al presionar "F2" las teclas "A" y "D"
; Colocar 0 puede producir lag
global esperar := 1

; Optimizar el script para la máxima velocidad, si no quieres optimzar pon ";" antes de optimizar()
optimizar()

; Fin de la inicialización
Return
; Declaración de Hotkeys y Funciones

F1:: ; Hotkey F1
    rutina: ; Definimos como "rutina" la acción de presionar "A" y "D"
    toggle:=!toggle ; toggle pasara de verdadero a falso y viceversa
    If toggle
        Send, A 
    Else
        Send, D
Return

F2:: ; Hotkey F2
    While GetKeyState("F2", "P"){ ; Mientras "F2" este presionado
        Gosub, rutina ; Ahorramos código llamando a "rutina"
        Sleep, %esperar% ; Esperamos "esperar" para dar delay o bien quitarlo
    }
Return

Esc::ExitApp ; Con "Esc" saldremos

optimizar(){ ;Función para optimzar el script
    #NoEnv
    #MaxHotkeysPerInterval 99000000
    #HotkeyInterval 99000000
    #KeyHistory 0
    ListLines Off
    Process, Priority, , A
    SetBatchLines, -1
    SetKeyDelay, -1, -1
    SetMouseDelay, -1
    SetDefaultMouseSpeed, 0
    SetWinDelay, -1
    SetControlDelay, -1
    SendMode Input
}

Function LCtrl=Home & Home=LCtr

Post by Thorx » 15 Mar 2024, 14:27

Hola, necesito que a presione d y viceversa.

Top