Maths Calculations With AutoHotKey
Posted: 28 Nov 2017, 12:55
....
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=40608
Code: Select all
!c:: ; press Alt + c to "google" using the content of your clipboard
Send, ^c
Run, % "https://goosh.org/#calculate " . ClipBoard
Return
BoBo wrote:... now you need to parse the content of the responseCode: Select all
!c:: ; press Alt + c to "google" using the content of your clipboard Send, ^c Run, % "https://goosh.org/#calculate " . ClipBoard Return
Another toy: https://code.google.com/archive/p/cli4g/
Probably you can use the "="-character to create an AHK hotstring that triggers the calculation ?!
Yes preferably an in-client virtual game.BoBo wrote:So you want to use it for a game as well?!
Code: Select all
InputBox, Calc, Calculation, type your Calculation e.g.`n 3*(1+2)
FileDelete, A.ahk
FileAppend , ClipBoard := %Calc%, A.ahk
RunWait, A.ahk
MsgBox,, Result, Result = %ClipBoard%
How do I run this under normal notepad autohotkey script.Rohwedder wrote:Hallo,
try:Code: Select all
InputBox, Calc, Calculation, type your Calculation FileDelete, A.ahk FileAppend , ClipBoard := %Calc%, A.ahk RunWait, A.ahk MsgBox,, Result, Result = %ClipBoard%
Thank you so much, I was concerned about the Msgbox appearing before I then paste and press enter. Whereas your replacement of Msgbox to Send ^v automatically drops it into my textbox and then I press enter.Exaskryz wrote:Have you done the tutorial Manlikezab? Rohwedder's code works as is. If you save this into its own AHK script and launch it, it will do the calculation for you. Do note that it won't correctly do something like 3^2=9, because AHK does not recognize the ^ operator as the exponent operator. You would need to enter into the InputBox 3**2.
The way Roh's script is working is by creating a new AHK script called A.ahk. The command is for it to do ClipBoard := ____ where ___ is the equation you typed into the InputBox. This works because of the nature of the Clipboard variable being shared across scripts (and the entire system). The := is the assign operator which evaluates any equations, like 2+2 to result in 4, putting 4 on the clipboard.
You would be able to replace the MsgBox line with a Send ^v to paste it if you'd like.
It's going to take more work to figure out how to trigger it natively in Chrome. You'd need to be able to identify what the equation is. I personally suggest using a hotkey like Ctrl+= ^=:: when you start to type your equation. Have it use the Input command. And wait for the = operator as the ending character; you may use the V (visible) parameter. If you use the V parameter, you will want to send as many {BackSpace}s as there are characters in your equation. Easily done by using the StrLen() function to check the length of the variable you captured in the Input command.
Exaskryz wrote:Have you done the tutorial Manlikezab? Rohwedder's code works as is. If you save this into its own AHK script and launch it, it will do the calculation for you. Do note that it won't correctly do something like 3^2=9, because AHK does not recognize the ^ operator as the exponent operator. You would need to enter into the InputBox 3**2.
The way Roh's script is working is by creating a new AHK script called A.ahk. The command is for it to do ClipBoard := ____ where ___ is the equation you typed into the InputBox. This works because of the nature of the Clipboard variable being shared across scripts (and the entire system). The := is the assign operator which evaluates any equations, like 2+2 to result in 4, putting 4 on the clipboard.
You would be able to replace the MsgBox line with a Send ^v to paste it if you'd like.
It's going to take more work to figure out how to trigger it natively in Chrome. You'd need to be able to identify what the equation is. I personally suggest using a hotkey like Ctrl+= ^=:: when you start to type your equation. Have it use the Input command. And wait for the = operator as the ending character; you may use the V (visible) parameter. If you use the V parameter, you will want to send as many {BackSpace}s as there are characters in your equation. Easily done by using the StrLen() function to check the length of the variable you captured in the Input command.
Nightwolf85 wrote:Have you tried using this?
https://github.com/davebrny/in-line-calculator/releases
from here:
https://autohotkey.com/boards/viewtopic.php?t=27431
Edit:
To have it do what you requested just open the settings.ini file and set the trigger key to nothing.
You are running it when it is still compressed, this doesn't allow it to access the lib folder and it contains required functions.Manlikezab12 wrote:...
So after I unzip how does it work? I type 2*2 it will come up as 4? or do I have to modify something as you said.Nightwolf85 wrote:You are running it when it is still compressed, this doesn't allow it to access the lib folder and it contains required functions.Manlikezab12 wrote:...
unzip it first.
Open the settings file and make the trigger key equal nothingManlikezab12 wrote:So after I unzip how does it work? I type 2*2 it will come up as 4? or do I have to modify something as you said.
Code: Select all
[settings]
enable_hotstrings = yes
trigger_key = (DELETE what was here)
result_endkey = =
equation_endkey = #
result_hotkey = !=
equation_hotkey = !#
history_hotkey = ^!=
history_max = 15
enable_number_row = yes
enable_number_pad = yes
numpadEnter_endKey = no
timeout = T60
It would depend on what code you ended up running.Manlikezab12 wrote:Exaskryz wrote:Have you done the tutorial Manlikezab? Rohwedder's code works as is. If you save this into its own AHK script and launch it, it will do the calculation for you. Do note that it won't correctly do something like 3^2=9, because AHK does not recognize the ^ operator as the exponent operator. You would need to enter into the InputBox 3**2.
The way Roh's script is working is by creating a new AHK script called A.ahk. The command is for it to do ClipBoard := ____ where ___ is the equation you typed into the InputBox. This works because of the nature of the Clipboard variable being shared across scripts (and the entire system). The := is the assign operator which evaluates any equations, like 2+2 to result in 4, putting 4 on the clipboard.
You would be able to replace the MsgBox line with a Send ^v to paste it if you'd like.
It's going to take more work to figure out how to trigger it natively in Chrome. You'd need to be able to identify what the equation is. I personally suggest using a hotkey like Ctrl+= ^=:: when you start to type your equation. Have it use the Input command. And wait for the = operator as the ending character; you may use the V (visible) parameter. If you use the V parameter, you will want to send as many {BackSpace}s as there are characters in your equation. Easily done by using the StrLen() function to check the length of the variable you captured in the Input command.
I am experiencing some delay with the input of calculation, would you know why?
Like if I type a calculation in the textbox and then immediately after I do another one it doesn't paste the answer.
I did the Roh's script where I changed Msgbox to Send ^vExaskryz wrote:It would depend on what code you ended up running.Manlikezab12 wrote:Exaskryz wrote:Have you done the tutorial Manlikezab? Rohwedder's code works as is. If you save this into its own AHK script and launch it, it will do the calculation for you. Do note that it won't correctly do something like 3^2=9, because AHK does not recognize the ^ operator as the exponent operator. You would need to enter into the InputBox 3**2.
The way Roh's script is working is by creating a new AHK script called A.ahk. The command is for it to do ClipBoard := ____ where ___ is the equation you typed into the InputBox. This works because of the nature of the Clipboard variable being shared across scripts (and the entire system). The := is the assign operator which evaluates any equations, like 2+2 to result in 4, putting 4 on the clipboard.
You would be able to replace the MsgBox line with a Send ^v to paste it if you'd like.
It's going to take more work to figure out how to trigger it natively in Chrome. You'd need to be able to identify what the equation is. I personally suggest using a hotkey like Ctrl+= ^=:: when you start to type your equation. Have it use the Input command. And wait for the = operator as the ending character; you may use the V (visible) parameter. If you use the V parameter, you will want to send as many {BackSpace}s as there are characters in your equation. Easily done by using the StrLen() function to check the length of the variable you captured in the Input command.
I am experiencing some delay with the input of calculation, would you know why?
Like if I type a calculation in the textbox and then immediately after I do another one it doesn't paste the answer.
Nightwolf85 wrote:Open the settings file and make the trigger key equal nothingManlikezab12 wrote:So after I unzip how does it work? I type 2*2 it will come up as 4? or do I have to modify something as you said.
i.e.then you just type out 4+4= and it will auto erase and put 8Code: Select all
[settings] enable_hotstrings = yes trigger_key = (DELETE what was here) result_endkey = = equation_endkey = # result_hotkey = != equation_hotkey = !# history_hotkey = ^!= history_max = 15 enable_number_row = yes enable_number_pad = yes numpadEnter_endKey = no timeout = T60
by default I think you would need to type =4+4=, so to do what I think you described you need to make that modification in the settings.
Sorry in your OP you listed out equations ending in an equal sign.Manlikezab12 wrote:Yeah that's the problem, I don't want to type = button before it will give me answer. I want to type it plain without = and then it gives answer.
Is there a trigger key such as enter key? Like It triggers when you press enter key? I'm not too sure if that would work. I'm new to this so I'm struggling.
Code: Select all
[settings]
enable_hotstrings = yes
trigger_key =
result_endkey = enter
equation_endkey = #
result_hotkey = !=
equation_hotkey = !#
history_hotkey = ^!=
history_max = 15
enable_number_row = yes
enable_number_pad = yes
numpadEnter_endKey = no
timeout = T60