My script is actioned with #l, but Win-7 also reacts

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
colmik
Posts: 83
Joined: 11 Mar 2014, 18:21

My script is actioned with #l, but Win-7 also reacts

18 Jul 2017, 16:55

I run a background script all the time. It has lots of hotkeys and functions in it, but today, I added a new one with the line...

Code: Select all

#l::    ; lower-case L
; this line is contained in my resident script, "atb.ahk"
Run C:\Users\mik\Documents\AutoHotKey\MakeLabel\MakeLabel.ahk
Return
The script that it runs is as follows (as far as I've got)...

Code: Select all

; Script : MakeLabel

#Singleinstance force
#noenv
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode,2
CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen

IfWinNotExist, ahk_exe audacity.exe
{ msgbox, Audacity not active
    return
}
InputBox, Label_1,,Enter first label of book
num := ""   ; clear num
c = 
Loop
{ c := SubStr(Label_1, A_index , 1)
  if c is number
    num .= c
  else if(c = "")
    break
  else
    Title .= c
}

msgbox %A_index% : %Label_1% : %num% : %Title% : %c%
As far as it has progressed, it is doing what I want - it gets an input string and parses it - but here's my problem :
When I press Win + l, it starts running my script "MakeLabel.ahk" and I see the InputBox flash on the screen, then it locks Windows-7. It's not a big deal - it goes to the log-on screen, but as there are no other users, all I have to do is press Enter, and it comes back to my script.

Why is this happening, and how can I stop it?

Thanks Folks.
colmik
Posts: 83
Joined: 11 Mar 2014, 18:21

Re: My script is actioned with #l, but Win-7 also reacts

18 Jul 2017, 17:13

Aha! I just found https://autohotkey.com/docs/misc/Override.htm
You can disable all built-in Windows hotkeys except Win+L and Win+U [...]
I guess I'll just have to find another hotkey. Damn!

colmik
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: My script is actioned with #l, but Win-7 also reacts

21 Jul 2017, 22:19

You are misreading (and misquoting) the documentation. By cutting off the second half of the sentence, you have changed its meaning.
You can disable all built-in Windows hotkeys except Win+L and Win+U by making the following change to the registry
Meaning: Making the following change to the registry has the effect of disabling all built-in Windows hotkeys except Win+L and Win+U.

It does not say that you cannot disable Win+L or Win+U some other way.

In fact, Win+U can be overridden quite simply with #u::. As far as I am aware, the only way to prevent Win+L from locking the computer is to disable the Lock Workstation functionality. This also prevents DllCall("LockWorkStation") from having any effect, but you can still "switch user", which has a similar effect.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: gongnl, ntepa and 242 guests