Another Script Length Bug

Report problems with documented functionality
abcjme
Posts: 57
Joined: 08 Mar 2018, 10:48

Another Script Length Bug

Post by abcjme » 11 May 2018, 08:09

After locking the computer then unlocking it, the hotkey-returns go all out of wack! For example, 5 should return n, but instead it returns m. Furthermore, key combos won't work anymore. The script works perfectly up to around line 280, practically anything added after that causes it to screw up. This probably relates to this other bug I found:
https://autohotkey.com/boards/viewtopic.php?f=5&t=48822

Code: Select all

;LETTERS

5::n
4::t
3::s
2::h
1::k
f5::p
f4::c
f3::f
space::space
b::capslock

9::a
0::e
-::o
=::i
m::u

5 & space::
space & 5::m
4 & space::
space & 4::d
3 & space::
space & 3::z
2 & space::
space & 2::j
1 & space::
space & 1::x
f5 & space::
space & f5::b
f4 & space::
space & f4::g
f3 & space::
space & f3::v

9 & space::
space & 9::l
0 & space::
space & 0::r
- & space::
space & -::w
= & space::
space & =::y
m & space::
space & m::q

;ONE HANDED



; MULTI STRINGS

![::
if getkeystate("capslock", "t")
send Have
else
send have
return

!]:
if getkeystate("capslock", "t")
send For
else
send for
return

!j::
if getkeystate("capslock", "t")
send Non
else
send non
return

!k::
if getkeystate("capslock", "t")
send Hyper
else
send hyper
return

!l::
if getkeystate("capslock", "t")
send Est
else
send est
return

!;::
if getkeystate("capslock", "t")
send Ing
else
send ing
return

!'::
if getkeystate("capslock", "t")
send Ness
else
send ness
return

; PUNCTUATION
y::"
t::,
r::)
e::(
w::=
q::-
h::?
g::`;
f::]
d::[
s::$
a::+
v::\
c::/
x::#
z::*

y & space::
space & y::'
t & space::
space & t::.
r & space::
space & r::}
e & space::
space & e::{
w & space::
space & w::~
q & space::
space & q::_
h & space::
space & h::!
g & space::
space & g:::
f & space::
space & f::>
d & space::
space & d::<
s & space::
space & s::@
a & space::
space & a::&
v & space::
space & v::^
c & space::
space & c::|
x & space::
space & x::send `%
z & space::
space & z::`

;NUMBERS
i::0
o::1
p::2
[::3
]::4
j::5
k::6
l::7
`;::8
'::9

; BS
f5 & f4::
f4 & f5::bs
f4 & f3::
f3 & f4::^bs
f3 & f2::
f2 & f3::^e ;not universal, this works in Ultra Edit.

4 & 3::
3 & 4::bs
3 & 2::
2 & 3::^bs
2 & 1::
1 & 2::^e ;not universal, this works in Ultra Edit.

; SPACE
0 & -::
- & 0::tab
- & =::
= & -::enter

; COPY
5 & t::
t & 5::^x
4 & r::
r & 4::^c
3 & e::
e & 3::^v
2 & w::
w & 2::+^v
1 & q::
q & 1::!+d ;This must be custom keymapped in Ultra Edit.

; CHANGE
9 & i::
i & 9::^r
0 & o::
o & 0::f2
- & p::
p & -::
send !{space}
send s
return
= & [::
[ & =::
send !{space}
send m
return
bs & ]::
] & bs::del

; BACK
t & r::
r & t::^z
r & e::
e & r::!left
e & w::
w & e::+^tab

; FORWARD
i & o::
o & i::^y
o & p::
p & o::!right
p & [::
[ & p::^tab

; URLS
t & g::
g & t::^l
r & f::
f & r::+del
e & d::
d & e::^u
w & s::
s & w::+^i
q & a::
a & q::^j

; ETC
i & j::
j & i::+^=
o & k::
k & o::^-
p & l::
l & p::send {Volume_Up 5}
[ & `;::
`; & [::send {Volume_Down 5}

; SEARCH
g & f::
f & g::^f
f & d::
d & f::f3
d & s::
s & d::#s
s & a::
a & s::
click, r
send s
return

; SAVE
j & k::
k & j::^s
k & l::
l & k::^p
l & `;::
`; & l::^d
`; & '::
' & `;::+^d

; CLOSE
g & b::
b & g::^f4
f & v::
v & f::!f4
d & c::
c & d::esc
s & x::
x & s::dllcall("LockWorkStation")
a & z::
z & a::exitapp

; OPEN
j & n::^n
n & j::^n
k & m::^t
m & k::^t
l & ,::+^t
, & l::+^t

; UN/HIDE
b & v::
send {!space}
send n
sleep 100
return
v & b::
send {!space}
send n
sleep 100
return
v & c::
send {+rclick}
send r
sleep 100
return
c & v::
send {+rclick}
send r
sleep 100
return
c & x::#m
x & c::#m
x & z::
WinGet, WindowList, List
Loop, %WindowList%
{
WinRestore, % "ahk_id " . WindowList%A_Index%
}
return
z & x::
WinGet, WindowList, List
Loop, %WindowList%
{
WinRestore, % "ahk_id " . WindowList%A_Index%
}
return


; NAVIGATE
n & m::#
m & n::#
m & ,::#x
, & m::#x
,::+tab
.::alt
/::!tab

; ARROW KEYS

; UP

up::up

numpad1 & up::
up & numpad1::
f6 & up::
up & f6::up
numpad2 & up::
up & numpad2::
f7 & up::
up & f7::pgup
numpad3 & up::
up & numpad3::
f8 & up::
up & f8::^home

numpad4 & up::
up & numpad4::
6 & up::
up & 6::+up
numpad5 & up::
up & numpad5::
7 & up::
up & 7::+pgup
numpad6 & up::
up & numpad6::
8 & up::
up & 8::+^home

numpadenter & up::
up & numpadenter::
n & up::
up & n::^up ;not universal, this works in Ultra Edit.

numpadadd & up::
up & numpadadd::
settimer a, 100
send {lwin down}
send {up}
return
up & u::
u & up::
settimer b, 100
send {lwin down}
send {up}
return

; DOWN

down::down

numpad1 & down::
down & numpad1::
f6 & down::
down & f6::down
numpad2 & down::
down & numpad2::
f7 & down::
down & f7::pgdn
numpad3 & down::
down & numpad3::
f8 & down::
down & f8::^end

numpad4 & down::
down & numpad4::
6 & down::
down & 6::+down
numpad5 & down::
down & numpad5::
7 & down::
down & 7::+pgdn
numpad6 & down::
down & numpad6::
8 & down::
down & 8::+^end

numpadenter & down::
down & numpadenter::
n & down::
down & n::^down ;not universal, this works in Ultra Edit.

numpadadd & down::
down & numpadadd::
settimer a, 100
send {lwin down}
send {down}
return
down & u::
u & down::
settimer b, 100
send {lwin down}
send {down}
return

; LEFT

left::left

numpad1 & left::
left & numpad1::
f6 & left::
left & f6::left
numpad2 & left::
left & numpad2::
f7 & left::
left & f7::^left
numpad3 & left::
left & numpad3::
f8 & left::
left & f8::home
numpad0 & left::
left & numpad0::
f9 & left::
left & f9::!left
numpaddot & left::
left & numpaddot::
f10 & left::
left & f10::!pgup

numpad4 & left::
left & numpad4::
6 & left::
left & 6::+left
numpad5 & left::
left & numpad5::
7 & left::
left & 7::+^left
numpad6 & left::
left & numpad6::
8 & left::
left & 8::+home

numpadadd & left::
left & numpadadd::
settimer a, 100
send {lwin down}
send {left}
return
left & u::
u & left::
settimer b, 100
send {lwin down}
send {left}
return

; RIGHT

right::right

numpad1 & right::
right & numpad1::
f6 & right::
right & f6::right
numpad2 & right::
right & numpad2::
f7 & right::
right & f7::^right
numpad3 & right::
right & numpad3::
f8 & right::
right & f8::end
numpad0 & right::
right & numpad0::
f9 & right::
right & f9::!right
numpaddot & right::
right & numpaddot::
f10 & right::
right & f10::!pgdn

numpad4 & right::
right & numpad4::
6 & right::
right & 6::+right
numpad5 & right::
right & numpad5::
7 & right::
right & 7::+^right
numpad6 & right::
right & numpad6::
8 & right::
right & 8::+end

numpadadd & right::
right & numpadadd::
settimer a, 100
send {lwin down}
send {right}
return
right & u::
u & right::
settimer b, 100
send {lwin down}
send {right}
return

a:
if !getkeystate("numpadadd", "p")
{
send {lwin up}
settimer a, off
}
return
b:
if !getkeystate("u", "p")
{
send {lwin up}
settimer b, off
}
return

; MOUSE

up & right::
right & up::dllcall("SetCursorPos", int, 1920, int, -1080)
right & down::
down & right::dllcall("SetCursorPos", int, 1920, int, 1080)
down & left::
left & down::dllcall("SetCursorPos", int, 0, int, 1080)
left & up::
up & left::dllcall("SetCursorPos", int, 0, int, -1080)
abcjme
Posts: 57
Joined: 08 Mar 2018, 10:48

Re: Another Script Length Bug

Post by abcjme » 11 May 2018, 16:31

I figured out a work-around. You can suspend the script before locking.

Code: Select all

esc::
suspend	
dllcall("LockWorkStation")
return
EDIT:
This works even better!

Code: Select all

esc::
suspend
dllcall("LockWorkStation")
sleep 100
suspend
return
Post Reply

Return to “Bug Reports”