Looking for help on making a script to auto-number on mouse-click.
Left mouse click:
# (increasing by 1 for each click)
Enter
Right mouse click:
(stays the same number)
Starting at 1 would be sufficient, but any way of having a prompt or setting a starting number would be a nice addition.
Appreciate the help!
Auto-Numbering Script on Mouse Click Topic is solved
Re: Auto-Numbering Script on Mouse Click
Do you just want the number to be displayed in a Tooltip? Or do you just want the number stored in the clipboard? Be a little more specific and I'm sure we could help you out with this ez pz. Cheers.
-TL
Re: Auto-Numbering Script on Mouse Click Topic is solved
@i_warcat
I've certainly gotten rusty since I don't code much anymore, but give this a shot and lmk if this works for you:
I'm sure others might chime in here on better/simpler ways to code this. The caveat with this script is once you start running the script you wont be able to use your left or right click buttons to do their normal functions, like navigate/select (left click) and open the context menu (right click). To enable the left and/or right click functions just edit this script and add a ~ before the hotkey definition for the click button you would like to modify, like so:
Cheers.
I've certainly gotten rusty since I don't code much anymore, but give this a shot and lmk if this works for you:
Code: Select all
#SingleInstance Force ; Only allow once instance of this script at a time to run
; Set your starting number by clicking both left and right click buttons at the same time
LButton & RButton::{
global
n := InputBox("Type in the number you would like to start with", "Pick Starting Number", , "1").Value
}
; Left click to send out your starting number, then increase that number by 1 and send a line break keystroke
LButton::{
global
if (!IsSet(n)) ; if starting number is not set, do nothing
return
Send(n++ "{Enter}")
}
; Right click to send out the current number with a line break keystroke
RButton::{
global
if (!IsSet(n)) ; if starting number is not set, do nothing
return
Send(n - 1)
}
^Esc::ExitApp ; Press CTRL + ESC to exit this script
I'm sure others might chime in here on better/simpler ways to code this. The caveat with this script is once you start running the script you wont be able to use your left or right click buttons to do their normal functions, like navigate/select (left click) and open the context menu (right click). To enable the left and/or right click functions just edit this script and add a ~ before the hotkey definition for the click button you would like to modify, like so:
Code: Select all
~LButton & ~RButton::{
global
n := InputBox("Type in the number you would like to start with", "Pick Starting Number", , "1").Value
}
~LButton::{
global
if (!IsSet(n))
return
Send(n++ "{Enter}")
}
~RButton::{
global
if (!IsSet(n))
return
Send(n - 1)
}
-TL
Re: Auto-Numbering Script on Mouse Click
Hey,
I really appreciate the help!
Im using the script mainly for my work in Adobe Acrobat to numerate via Tool "Add Text".
I just tried using your code and the left click seems to work until it reaches two-digit numbers. They are not displayed horizontally but vertically. The right-click on the other hand does not seem to work at all until I remove the (~) infront of it (I dont really need my right-click for other uses while the script is running)- It outputs the same number as before but in the same Textbox as the one from the left click.
Also is there a way to bind a hotkey to close the script?
I hope my english is somewhat understandable as it is not my native language!
I really appreciate the help!
Im using the script mainly for my work in Adobe Acrobat to numerate via Tool "Add Text".
I just tried using your code and the left click seems to work until it reaches two-digit numbers. They are not displayed horizontally but vertically. The right-click on the other hand does not seem to work at all until I remove the (~) infront of it (I dont really need my right-click for other uses while the script is running)- It outputs the same number as before but in the same Textbox as the one from the left click.
Also is there a way to bind a hotkey to close the script?
I hope my english is somewhat understandable as it is not my native language!
Re: Auto-Numbering Script on Mouse Click
@Tigerlily
Regarding to my first reply (I used your second script). I fixed the vertical output by removing {Enter}. So the left-click works perfectly fine now ^^.
And I missed the ExitApp command which I also mentioned earlier.
The only problem is the right-click since it just adds the number to the same textbox as before. Could you come up with a fix?
Thanks for helping out!
Regarding to my first reply (I used your second script). I fixed the vertical output by removing {Enter}. So the left-click works perfectly fine now ^^.
And I missed the ExitApp command which I also mentioned earlier.
The only problem is the right-click since it just adds the number to the same textbox as before. Could you come up with a fix?
Thanks for helping out!
Re: Auto-Numbering Script on Mouse Click
@Tigerlily
A little update.
I changed the code a little bit and this is how it looks now. Works fine I guess.
Thanks for the great help and I wish you a great weekend!
A little update.
Code: Select all
#SingleInstance Force ; Only allow once instance of this script at a time to run
~LButton & ~RButton::{
global
n := InputBox("Type in the number you would like to start with", "Pick Starting Number", , "1").Value
}
~LButton::{
global
if (!IsSet(n))
return
Send(n++)
}
RButton::{
global
if (!IsSet(n))
return
Send("{Click}" n - 1)
}
XButton2::ExitApp ;
I changed the code a little bit and this is how it looks now. Works fine I guess.
Thanks for the great help and I wish you a great weekend!