Easy calculator Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
flavio96
Posts: 2
Joined: 30 Dec 2015, 05:58

Easy calculator

30 Dec 2015, 09:45

hello i'm new at ahkforum , i readed the guide but i didn't found a way to display the result of a multiplication i learn a way to display and insert variable but i don't know how to make an expression and display it in the gui console
her's the code i use

Gui, Add, Text,, first number:
Gui, Add, edit, number vpve
Gui, Add, Text,, second number:
Gui, Add, edit, number vnpe
Gui, Add, Button, Default , result
Gui, Add, edit, result vres
submitit

Re: Easy calculator

30 Dec 2015, 09:54

You need to create a label for the result button and "Submit" - https://autohotkey.com/docs/commands/Gui.htm#Submit - to get the variables from the Gui. After that you can use GuiControl to update the result edit control.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
silvex3000
Posts: 188
Joined: 19 Dec 2015, 22:42

Re: Easy calculator

30 Dec 2015, 10:12

Wow!

I wrote this code right now, and I don't even believe that Autohotkey can't handle this:

Code: [Select all] [Expand] [Download] (Simple Calculator.ahk)GeSHi © Codebox Plus



I'm in Shock (very disappointed with AutoHotkey)
flavio96
Posts: 2
Joined: 30 Dec 2015, 05:58

Re: Easy calculator

30 Dec 2015, 10:32

thank you for support ;)
User avatar
Relayer
Posts: 115
Joined: 30 Sep 2013, 13:09
Location: Delaware, USA

Re: Easy calculator

30 Dec 2015, 13:34

Silvex3000 wrote:
I'm in Shock (very disappointed with AutoHotkey)

Don't be disappointed. The issue is with this line.
calculation := %UserType%

AutoHotkey has two equal signs: '=' and ':='
When using ':=' the line would be:
calculation := UserType
Your script runs as expected with:
calculation = %UserType%

Most prefer the former syntax. Learning when to use %var% vs just the variable name is key to using AHK.

Relayer

edit: I may have missed that you wanted the expression evaluated and not simply echoed. I think you are having that discussion in another thread. Good day!
MonuKashyap
Posts: 27
Joined: 06 Jun 2016, 21:32

Re: Easy calculator

16 Jun 2018, 04:16

"calculation = %UserType%"

That also not working.. Relayer,
is there any other option??
User avatar
Flipeador
Posts: 960
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Easy calculator [Updated 2018-07-29]  Topic is solved

16 Jun 2018, 06:36

AHKv1:

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



AHKv2:

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



Eval Function: https://github.com/flipeador/Library-AutoHotkey/blob/master/math/Eval.ahk.
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library
MonuKashyap
Posts: 27
Joined: 06 Jun 2016, 21:32

Re: Easy calculator

21 Jul 2018, 07:33

yeah this is working,
thank you Flipeador!!
Rohwedder
Posts: 1190
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Easy calculator

21 Jul 2018, 11:05

Hallo,
try:

Code: [Select all] [Download] GeSHi © Codebox Plus

InputBox, Calc, Calculation, type your Calculation e.g.: 7+Sqrt(17)
FileDelete, A.ahk
FileAppend, ClipBoard := %Calc%, A.ahk
RunWait, A.ahk
MsgBox,, Result, %Calc% = %ClipBoard%
garry
Posts: 1335
Joined: 22 Dec 2013, 12:50

Re: Easy calculator

22 Jul 2018, 10:47

thank you for examples ,
@Rohwedder, short example with input , similar here from user 'Laszlo' :

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Ask For Help”

Who is online

Users browsing this forum: nonvenomous, wideeyedguy and 45 guests