Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scroll Lock as Keyboard Trigger
#1
Hi All,

I seem to be having trouble getting Scroll Lock to be a trigger for a macro. I know how to send it (key J) but not to detect if it has been pressed or not.

Any ideas?

Stuart
#2

Trigger? Just put 'J' as the trigger?


Or
Code:
Copy      Help
rep
,;;your code here.
,ifk(J)
,,out "Scroll lock hit."
,,break
Taking on Quick Macros one day at a time
#3
Hi QM Assistant,

Thanks for the tips.

Quote:Trigger? Just put 'J' as the trigger?

Didnt work because in the trigger entry dialog, it interprets J as the letter j not as the ScrollLock command

The second option works but I thought it would be better to find out what the status of the Scroll Lock key is - Many keyboards have a light indicator for that. Is there a way for QM to determine that? If so, then I can run a context-sensitive toggle.

Any ideas?

Stuart
#4
Macro ( Scroll Lock Check )
Code:
Copy      Help
rep
,;;your code here.
,ifk(J 1)
,,out "Scroll lock on."
,,break
,else out "Scroll lock off"
,break


If Scroll lock is on, out "Scroll lock on."

If Scroll lock is off, out "Scroll lock off."
Taking on Quick Macros one day at a time
#5
I found this in the Help Files under ifk

RealGetKeyState
if you add the 0x100, it will return a 1 or 0 based on status
See below


Code:
Copy      Help
int ScrollLockStatus=RealGetKeyState(VK_SCROLL|0x100)

out ScrollLockStatus

if ScrollLockStatus = 1; out "Scroll Lock On"; else out "Scroll Lock Off"

Thanks for pointing me toward ifk

Stuart
#6
Hi,

I tried with



Quote:rep
,;;your code here.
,ifk(J 1)
,,out "Scroll lock on."
,,break
,else out "Scroll lock off"
,break

but since I want this to be true all-the-time trigger, I took the "break" statements out. It worked but CPU usage monitor went way up to around 50%. Normal triggers don't do that so there should be a better way.

Anybody have any ideas on how to make ScrollLock Key into a regular keyboard trigger?

Stuart
#7

You need to enter capital 'J' into the trigger field.


Function ( Function14 ) Trigger ( J )
Code:
Copy      Help
out 1

[Image: 40768063oj6.jpg]

........................................

Quote:It worked but CPU usage monitor went way up to around 50%

If you add a small wait time it will take care of the high CPU problem.

rep
,0.03
,code


Attached Files
.qml   Function14.qml (Size: 150 bytes / Downloads: 323)
#8
I never used that window you showed in your screengrab. I feel kind of stupid. I was trying over and over to enter it into the regular dialog form Properties--Triggers->Keyboard but it wouldn't work via that route.
Thanks so much.
Stuart
#9
I can enter Scroll Lock in Properties, like any other key. If you can't, maybe some program uses the key, or the key is unavailable for some other reason. Then the trigger will not work, even if entered directly into the toolbar as J letter.


Forum Jump:


Users browsing this thread: 1 Guest(s)