Eval - Evaluate Expressions in Strings Dynamically (Updated Dec, 28, 2020)

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update v1.1.7

07 Aug 2016, 11:51

Update: v1.1.7
  • Fixed bug when assigning a variable to a ternary operation.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: Eval - Evaluate Expressions in Strings Dynamically (Updated 07/08/2016)

31 Oct 2016, 01:38

for reference, AHK_H can do Eval() stuff built-in:

Code: Select all

var := 99
MsgBox var=%var%

mycode := "var2 := var+2`nMsgBox, var2 from within ahkExec = `%var2`%"
MsgBox, mycode to dynamically execute:`n`n%mycode%

ahkExec(mycode)

MsgBox, var2 from main script = %var2%
ahkExec() is one function provided to allow it, i think there are a few others for doing it in separate threads

aldrinjohnom
Posts: 77
Joined: 18 Apr 2018, 08:49

Re: Eval - Evaluate Expressions in Strings Dynamically (Updated 07/08/2016)

24 Aug 2019, 10:31

This Eval Function is great! but apparently I found some bug where some results are wrong

eg.
using the "expression tester.ahk". I tried evaluating:
-(2.6167)-193

the result generated was:
195.616700

the answer should be:
-195.616700

It will be a good news if there is a solution for this probem.
Developer of AJOM's DOTA2 MOD Master, Easiest way to MOD your DOTA2 without the use of internet :lol: . I created this program using Autohotkey thats why I love Autohotkey and the community!

GitHub:
https://github.com/Aldrin-John-Olaer-Manalansan
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.0

26 Sep 2020, 15:58

* Fixed bugs in math operations with subtraction.
* Fixed bug with negative signs before parenthesis.
* Fixed bug in assignments.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.1

07 Oct 2020, 20:29

* Fixed subtraction problem.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.2

26 Oct 2020, 11:41

  • Fixing bugs with subtraction.
Another attempt to fix the problems with negative numbers in math operations. This time instead of trying to fix the compiled expression I've removed one line of the compiler that was causing the issue, so if anyone finds another problem because of this change, please let me know because I have no idea what that line was supposed to do...
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.3

01 Nov 2020, 17:17

  • Fixed math operations as strings being evaluated (removed temporary fix from v1.2.0).
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.4

09 Nov 2020, 15:43

  • Fixed bug when assigning {} object.
  • Fixed bug with key-pair objects.
  • Fixed problem with quoted strings inside objects.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.5

13 Nov 2020, 12:13

  • Fixed bug with multiple compare operators.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.6

16 Nov 2020, 08:46

  • Fixes issue with strings concatenation.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.7

20 Nov 2020, 11:52

  • Fixed problems with quotes in strings.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Update: v1.2.8

28 Dec 2020, 17:44

  • Fixed bug with named operators.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)
alnz123
Posts: 3
Joined: 31 Jan 2021, 22:01

Re: Eval - Evaluate Expressions in Strings Dynamically (Updated Dec, 28, 2020)

31 Jan 2021, 22:13

Rodolfo - great work. I just discovered this via Jack's AutoHotkey Blog. This will save me heaps of time. I'm not sure how to get it to work with percentages though.
User avatar
Pulover
Posts: 612
Joined: 29 Sep 2013, 19:51
Location: Brazil
Contact:

Re: Eval - Evaluate Expressions in Strings Dynamically (Updated Dec, 28, 2020)

01 Feb 2021, 06:51

Thanks. What do you mean by get it to work with percentages? It should be able to deal with any math expression as if it was in ahk script. If you've found an inconsistency you can report the issue at github.
Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer)

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Epoch and 55 guests