Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

how to make scroll lock toggle a hotkey


  • Please log in to reply
3 replies to this topic
hamsolo474
  • Guests
  • Last active:
  • Joined: --
hey, im trying to figure out how to have scroll lock toggle a hotkey

$space:: 
	if GetKeyState, ScrollLock = "t"
		send _
	Else
		send {space}
	return

i have looked through previous posts about scroll lock and while they seem similar to what im doing i dont know to to implement them or understand why it works

when i run my code, it always defaults to else, and sends a normal space

i want this script to replace the space with an underscore while scroll lock is on but this is primarily an example script for me as i will have more things toggled by scroll lock int he future should this turn out well

  • Guests
  • Last active:
  • Joined: --
... where did u get that syntax from?
have u check the help file?

OceanMachine
  • Members
  • 790 posts
  • Last active: Aug 23 2013 02:10 PM
  • Joined: 15 Oct 2007
$space::
   if ( GetKeyState("ScrollLock", "T") ) ; this will be 'true' if ScrollLock is toggled 'on'
      send _
   Else
      send {space}
return

or, an alternative way of using GetKeyState:

$space::
   GetKeyState, state, ScrollLock, T ; state will be 'D' if ScrollLock is on or 'U' if it is off

   if ( state = "D" )
      send _
   Else
      send {space}
return


hamsolo474
  • Guests
  • Last active:
  • Joined: --
thx ocean the code worked perfectly

and i apologise for the syntax, before this i was debugging some python