# Change hovered values by keys

I would like to increase and decrease values of any slider/property (node or menus) which mouse is hovering over by hotkeys (let's say arrow hotkeys). It's basically the same like you can do with ctrl + mouse wheel, when you hover over sliders, but with hotkeys. Because I use tablet and pen - I am not able to use mouse wheel... I can image "simple" python script. Something like (it's just schematic):

• slider = active_slider_under_mouse_cursor
• slider.increase_value += 0.1

But I haven't found anything liek this anywhere - don't know how to acces the slider uder mouse. Please don't you know how to do it?

• While not an answer to your question, you can probably remap some keys to mouse wheel e.g. by using Autohotkey (Windows) Emulate mouse wheel scroll with keyboard Jul 7, 2021 at 14:05
• Thanks for the suggestion but I would like to avoid Autohotkey workarounds as much as I can - it's the last option @MarkusvonBroady Jul 8, 2021 at 16:36

I think I've solved it! This script can do that... it's using clipboard data.

class Nudge_plus_small(bpy.types.Operator):
"""This will increase property value"""
bl_idname = "object.nudge_plus_small"
bl_label = "Increment value +0.01 "
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):

try:
#get the value
bpy.ops.ui.copy_data_path_button(full_path=True)
exec('global value\nvalue = ' + bpy.context.window_manager.clipboard)
prop = bpy.context.window_manager.clipboard

#check the type and perform the action
if type(value) == float:
exec(prop + '+= 0.01')

elif type(value) == int:
exec(prop + '+= 1')

else:
print ('===> ERROR => Wrong value type => ' + str(type(value)))

except:
print ('===> ERROR: Wrong Context')

return {"FINISHED"}

def register():
bpy.utils.register_class(Nudge_plus_small)

def unregister():
bpy.utils.register_class(Nudge_plus_small)

if __name__ == "__main__":
register()


• ⚠ Keep in mind using exec together with clipboard data is a security risk, because if you have Bobby Tables in your clipboard, you may soon be in a world of pain... The execs can probably be easily substituted with normal statements, but the answer is missing some parts that would allow to reproduce and test the code. Jul 7, 2021 at 14:16
• You right - class, register-unregister.. stuff missing in the code, because I don't know why - when I paste that - I can see in message preview, whole message is messed up (I've never posted code like this here, so I don't know what is wrong). I can not send any picture of it in this comment - sorry :( Do you know how to avoid it? And I would like to avoid exec, but have no idea how - do you @MarkusvonBroady ? Jul 8, 2021 at 16:34
• I edited your question, look how I used triple backticks to mark the code. Jul 8, 2021 at 16:36
• Oh thank you very mcuh @MarkusvonBroady - now I know I have to add backticks for the code section :) I've also completed the code - hopefully it would work. Jul 8, 2021 at 16:43
• @MarkusvonBroady - When I tweaking values (shading node etc...) most comfortable is moving slider in small increments back and forth and watching 3dview to see changes and with this script mapped on keys it's only way how I can do it - specialy when I use tablet and pen rather then mouse. It's also good this to jump, for example, 3 times forth and then, if I decide it was better before, 3 times back and I am when I've started - with mouse scroll it's not possible. This script kind of works, except the color tweaking - it's probably some special dialog box... I wish it would be possible to.. Jul 10, 2021 at 12:23