Sorry, but I found now that the part that should work always is not running but only the part with #If state, I will post the entire code and the 2 section will be separated by a "-----" line.
(another question, if I want the SECTION to be off the first time the file.ahk is started and then activated the first time when I press the "key that activate State", how should I change my code to do that. Maybe it's like now but with State not starting as true but as false?)
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;\\\\\\\\\\\VARIABILI\\\\\\\\\\\\\\\\\\\\
State := true
;\\\\\\\\\\ CONTROLLO PROGRAMMA \\\\\\\\\
!Space::Suspend ; sospendi Hotkey
VKB7::Suspend
;\\\\\\\\\\\\\\\\\\\ PENNA E MEDIA \\\\\\\\\\\\\\\\\\\\
^!s::State := !State
#If State
{
VK60::Send, ^z
VK69::Send, ^v
VK68::Send, ^c
VK67::Send, ^x
VK61::left
VK62::down
VK63::right
VK65::up
VK6A::Send, {f}
VK6D::Send, {esc}
VK6B::Send, {tab}
VK0D::Send, {space}
}
;---------------------------------------------------------------------------------------------------------
#If
{
SetTitleMatchMode, RegEx ; match window titles by regular expressions
#IfWinActive - OneNote$ ; ------ only in windows with title ending with "- OneNote"
;\\\\\\\\\\\\\\\\\\\ EQUAZIONI \\\\\\\\\\\\\\\\\\\\
VK5D::!VKbb ; Inserisci equazione
!x::Send, \times{Space} ; Prodotto vettoriale
!VKBE::Send, \bullet{Space} ; Prodotto vettoriale
VK78::Send, !jed{Enter}{Left} ; Parentesi
VK79::Send, !jec{Enter}{Left} ; Sottolineatura vettore
VK7A::Send, !jeb{Enter}{Left}{Left} ; Frazione
!w::Send, \omega{Space} ;omega
!e::Send, \varepsilon{Space} ;epsilon
!r::Send, \doubleR{Space} ;Insieme Reali
!t::Send, \tau{Space} ;tau
!u::Send, \theta{Space} ;theta
!i::Send, \in{Space} ;Appartiene
!o::Send, \phi{Space} ;phi
!p::Send, \pi{Space} ;pigreco
!è::Send, \Sigma{Space} ;Sigma
!a::Send, \alpha{Space} ;alpha
!d::Send, \Delta{Space} ;Delta
!f::Send, \forall{Space} ;per ogni
!g::Send, \nabla{Space} ;gradiente
!j::Send, \varphi{Space} ;varphi
!k::Send, \kappa{Space} ;k
!l::Send, \lambda{Space} ;lambda
!ò::Send, \sigma{Space} ;sigma
!b::Send, \beta{Space} ;beta
!n::Send, \doubleN{Space} ;Insieme Naturali
!m::Send, \scriptM{Space} ;M di matrice
;\\\\\\\\\\\\\\\\\\\ LAYOUT \\\\\\\\\\\\\\\\\\\\
#l::Send, !nl ; Larghezza pagina
;VK30::+VK30 ; Simbolo = (FUNZ DISABILITATA)
#VK41::Send, !hdi6{Enter} ; Dim testo 6
#VK53::Send, !hdi7{Enter} ; Dim testo 7
#VK44::Send, !hdi9{Enter} ; Dim testo 9
#VK46::Send, !hdi12{Enter} ; Dim testo 12
#f::Send, !hror!r255{Tab}0{Tab}254{Enter} ; Fucsia
#v::Send, !htiCalibri Light{Enter}!hdi7{Enter}!hror!r0{Tab}176{Tab}80{Enter} ; Calibri Light-7-Verde
#b::Send, !htiCalibri Light{Enter}!hdi9{Enter}!hror!r0{Tab}112{Tab}192{Enter} ; Calibri Light-9-Blu
#n::Send, !htiCalibri Light{Backspace}{Backspace}{Backspace}{Backspace}{Backspace}{Backspace}{Enter}!hdi12{Enter}!hror!r0{Tab}0{Tab}1{Enter} ; Calibri-12-Nero
;\\\\\\\\\\\\\\\\\\\\\ MOUSE \\\\\\\\\\\\\\\\\\\\\\
; funzione premi laterale (verso di te) e rilascia per il lazzo
VK05::
Send, !dl
KeyWait, VK05
Send, !dp
return
;\\\\\\\\\\\\\\\\\\\ TESTI \\\\\\\\\\\\\\\\\\\\\\\\\\
VK74::Send, ^b ; Grassetto
VK75::Send, ^u ; Sottolineato
VK76::Send, !cr ; Ritaglio schermata
VK77:: Send, (){Left} ; parentesi tonde
VK20 & a::Send, Allora{:}
VK20 & q::Send, Quindi{:}
VK20 & o::Send, Ossia{:}
;\\\\\\\\\\\\\\\\\\\ TASTI FN \\\\\\\\\\\\\\\\\\\\\\\\\\
#VK70::Send, {F1}
#VK71::Send, {F2}
#VK72::Send, {F3}
#VK73::Send, {F4}
#VK74::Send, {F5}
#VK75::Send, {F6}
#VK76::Send, {F7}
#VK77::Send, {F8}
#VK78::Send, {F9}
#VK79::Send, {F10}
#VK7A::Send, {F11}
#VK7B::Send, {F12}
;\\\\\\\\\\\\\\\\\ COMBINAZIONI TASTI STANDARD \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
VK7B::Send, +{F9}
VK70::Send, ^z ; Annulla
VK71::Send, ^x ; Taglia
VK72::Send, ^c ; Copia
VK73::Send, ^v ; Incolla
#IfWinActive ; ------ end of section restricted to specific windows
}