Jump to content
Jon

AutoIt v3.3.15.2 Beta

Recommended Posts

It seems UDF-s has been reworked, especially _GUI* - control functions not use _WinAPI_InProcess() any more... Is there a no functionality loss in regard interaction with non-autoit GUI-s?

Share this post


Link to post
Share on other sites
Added UDF _GUICtrlHeader_GetFilterText () did not enter the help document.

Share this post


Link to post
Share on other sites

"Where two operators have the same precedence the expression is evaluated left to right.".  Tested with Excel (same approach) = same result, ie +1.

Share this post


Link to post
Share on other sites

Yes, but who said that - and ^ have the same priority?
For me, the operator ^ has higher priority than the unary operator -.
With AutoIt:
3-1^2 = 4 !!!!!!!!!!

Share this post


Link to post
Share on other sites

mdanielm,

While appreciating that the results do not appear to be what you would expect - especially in your second example - I would argue that you make a good argument for the use of parentheses to explicitly force the operators to be used in the order you require. 

M23

P.S. And you do realise that the latest version is actually 3.3.15.3? 

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
On 6/27/2020 at 5:00 PM, mdanielm said:

 -1 ^ 2 = 1

In this example, you're evaluating -1 * -1, that's what the exponent is telling you to do. Two negative numbers multiplied together always yields a positive number. I'm not sure what the precedence is in algebra because I did terribly in it, but I do know that the exponent is just telling you how many times to multiply a number by itself. If you had used -1^3, the answer would be negative.

Quote

Negative numbers with exponents
If the base is negative and the exponent is an even number, the final product will always be a positive number. If the base is negative and the exponent is an odd number, the final product will always be a negative number.

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I agree with @mdanielm about the existence of a real bug, examplified with his expression 3-1^2.

Look at the expression 1 - 1 ^ 2 which yields 2 under AutoIt.
If you expect it to be evaluated as 1 - (1 ^ 2) the result should be 0
If you expect it to be evaluated as (1 - 1) ^ 2 the result should also be 0

The only possible nonsensical evaluation path that can give 2 is 1 + ((-1) ^ 2) but that means a ghost addition has magically appeared out of thin air inside the guts of the core.


 


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
On 6/28/2020 at 8:25 AM, mdanielm said:

Yes, but who said that - and ^ have the same priority?
For me, the operator ^ has higher priority than the unary operator -.
With AutoIt:
3-1^2 = 4 !!!!!!!!!!

in this case - is not unary but a substraction. The  ^ operator as a same  priority as - operator so the 4 is logical !!! different from Excel.

Just use the () to avoid such behavior

Share this post


Link to post
Share on other sites

Sorry @jpm wrong explanation!

My previous post shows that the interpreter sees thing differently and does 3 + ((-1) ^ 2) just as it interprets 1-1^2 as 1 + ((-1) ^ 2)
If the interpreter would interpret the red minus in 1-1^2 as a substraction, it would yield 0, not 2, whatever grouping or precedence it uses.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

...interesting theme y'all have. I never got/understood clearly, all these arithmetic stuff, so I google.
When I enter "(-1^2)" in google calculator,  it reorganize it to "-(1^2)". link
Same with "3-1^2"  it reorganize it to "3-(1^2)". link
"1-1^2" to "1-(1^2)"

Did I clarify the subject with a irrefutable solution ?. Nope, nowhere near.
We as peers, should look for peer reviewed info. to fall back to, in case of disagreement. That way the matter at hand can be based in a cited previous work and errors in opinion or the presentation of an idea, not get personal. ( I'm efficient that way ) :gathering:

Share this post


Link to post
Share on other sites

Help file is our friend and it clearly states that :

 

Precedence

When more than one operator is used in an expression the order in which things happen is controlled by operator precedence. The precedence used in AutoIt is given below. Where two operators have the same precedence the expression is evaluated left to right.

From highest precedence to lowest:

Not
^
* /
+ -
&
< > <= >= = <> ==

And Or

Unary operators are not mentioned, so I thought it would be at the highest level.  But with the above examples ppl gave, I tend to believe something is wrong with precedence of ^.

Share this post


Link to post
Share on other sites

Indeed precedence of unary minus is not mentionned, but it should be.
Anyway that still doesn't explain by which perverted magic the interpretor invents a wrong & ghost + sign in the middle of the operations in 1 - 1 ^ 2.

If ^ precedence is higher than both unary minus and substraction, we get 1 - (1 ^ 2) which is 1 - 1 = 0
If ^ precedence is lower than both unary minus and substraction, we get (1 - 1) ^ 2 which is 0 ^ 2 = 0

The problem is that in this case the interpreter illogically considers the minus sign as a unary minus and then, to correct its mistake, invents a + sign to convert the now invalid syntax 1 (-1) ^2 into 1 + ((-1) ^ 2) = 1 + (1) = 2

 


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Hello,

I suggest, as a preprocessing of an algebraic expression, the replacement of the - unary by  _
with an instruction like:

              $in = StringRegExpReplace ($in, "(^|(\*|\/|^|\())-", "$1_")

Then just set the priority of _ less than ^

- greater or equal than * / and _2*3 will be calculated as (_2) * 3

or
- less than * / and _2*3 will be calculated as _ (2 * 3)

In both cases the priority of _ must remain greater than + -

Edited by mdanielm

Share this post


Link to post
Share on other sites

Operators' precedence and associativity must be formally defined and documented for all operators and strictly applied to any expression, not only algebraic.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...