Jump to content

AutoIt v3.3.11.3 Beta


Jon
 Share

Recommended Posts

Using this code I'm getting an error message:

#AutoIt3Wrapper_Run_AU3Check=n
$a = 2
$b = 1
If ($a > 1) Then ($b *= -1)
ConsoleWrite($b & @LF)
"C:test07.au3" (4) : ==> Missing right bracket ')' in expression.:

If ($a > 1) Then ($b *= -1)

If ($a > 1) Then ^ ERROR

For $a = 1 it works w/o an em.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

it consider it like func i guess :)

func Then($b *= -1)

endfunc

edited:tupo 

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

That is correct error message. What confuses you, I guess, is that the error is detected at runtime.

Interpreter will check the syntax of your code to a certain degree before it starts executing it, but obviously it wouldn't check whether you are trying to sell compound operators under something else.

For case when $a = 1 there are no run-time errors - because there are no run-time errors.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

For me the stuff in brackets will be executed first then outside the brackets.

I would expect that for If ($a > 1) Then ($b *= -1) $b will be set to -1 as it will be done without brackets.

 

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

your calling func Then() starting with If with no Then after func

and Then cant be func name :) conflict of interest i guess :P

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

your calling func Then() starting with If with no Then after func

and Then cant be func name :) conflict of interest i guess :P

 

Which function?  :huh:

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Function named "Then()" that cant exsist coz Then cant be Func.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

For me the stuff in brackets will be executed first then outside the brackets.

I would expect that for If ($a > 1) Then ($b *= -1) $b will be set to -1 as it will be done without brackets.

My 2 cents worth:

This sentence in the help file for Operators describes what you see: "You can use brackets to force a part of the expression to be evaluated first."

So first the expressions in the brackets are evaluated. Means

($a > 1) evaluates to True

($b *= -1) returns the error

 

If you try:

If ($a > 1) Then ($b = -1)
$b still will not be -1 because the expression in brackets is not an assignment but a comparison. Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If <expression> Then statement

When I created this code >here I wrote accidently If ($x > 200) Then ($iDir *= -1) which caused the error.

I just asked my self whether I've some logical problem to undersand why the statement in brackets is not executed as without brackets...

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

When I created this code >here I wrote accidently If ($x > 200) Then ($iDir *= -1) which caused the error.

I just asked my self whether I've some logical problem to undersand why the statement in brackets is not executed as without brackets...

Br,

UEZ

Compound assignment operators modify the value of a variable by performing an operation on it, they don't return value.

When you put expression in parentheses you ask for its value:

$x = 3
$b = 2
($b = -1)

ConsoleWrite($b & @CRLF)

...That code is equivalent to:

$x = 3
$b = 2
(False)

ConsoleWrite($b & @CRLF)

Your $iDir *= -1 doesn't yield value and therefore can't be enclosed in parentheses.

Some languages work differently.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Obviously not ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...