Maths Calculations With AutoHotKey Topic is solved
Maths Calculations With AutoHotKey
....
Last edited by Guest on 17 Mar 2023, 22:27, edited 2 times in total.
Re: Maths Calculations With AutoHotKey
Code: 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 ?!
Re: Maths Calculations With AutoHotKey
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 ?!
This wasn't what I was looking for. I don't want another tab to open up. I just want to type a calculation into any text box and the answer will appear. Please refer to this thread as it is similar to what I'm looking for but on that one it only works for notepad. https://autohotkey.com/boards/viewtopic.php?f=5&t=2394
Re: Maths Calculations With AutoHotKey Topic is solved
So you want to use it for a game as well?!
Re: Maths Calculations With AutoHotKey
Yes preferably an in-client virtual game.BoBo wrote:So you want to use it for a game as well?!
Last edited by Guest on 07 Jul 2018, 08:42, edited 1 time in total.
Re: Maths Calculations With AutoHotKey
Hallo,
try:
try:
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%
Last edited by Rohwedder on 28 Nov 2017, 14:43, edited 1 time in total.
Re: Maths Calculations With AutoHotKey
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%
Re: Maths Calculations With AutoHotKey
Hallo,
do not use "="
simple e.g.
3*(1+2)
do not use "="
simple e.g.
3*(1+2)
Re: Maths Calculations With AutoHotKey
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.
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.
Re: Maths Calculations With AutoHotKey
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.
Re: Maths Calculations With AutoHotKey
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.
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: Maths Calculations With AutoHotKey
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.
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.
Re: Maths Calculations With AutoHotKey
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.
What is going on? I double clicked the script icon and it's not functioning
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: Maths Calculations With AutoHotKey
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.
Re: Maths Calculations With AutoHotKey
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.
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: Maths Calculations With AutoHotKey
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.
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
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.
Re: Maths Calculations With AutoHotKey
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.
Re: Maths Calculations With AutoHotKey
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.
- Attachments
-
- lol.ahk
- (146 Bytes) Downloaded 71 times
Last edited by Guest on 29 Nov 2017, 12:52, edited 1 time in total.
Re: Maths Calculations With AutoHotKey
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.
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.
-
- Posts: 302
- Joined: 05 Feb 2017, 00:03
Re: Maths Calculations With AutoHotKey
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.
Just change the result_endkey to enter
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