Jump to content

Recommended Posts

Posted (edited)

So i do a lot of unusual stuff with AutoIt, and find weird syntax as a result...

I'll start off with this:

consolewrite("test"&Chr(65)Chr(65)Chr(65)&&&@CRLF); testAAA

Maybe it is an intentional feature of AutoIt, but i believe it is just a weird glitch in the parser.

Meaning any string concatenation can be moved to the end of string:

$x = 'a'"b"'c'&&
ConsoleWrite($x & @CRLF)

Tested with 3.3.16.1

Edited by genius257
Posted (edited)
  On 5/14/2024 at 11:46 AM, Andreik said:

Is this working with the last AutoIt version?

Expand  

Yes, 3.3.16.1, outputs "AU3" in the console.

  On 5/14/2024 at 11:46 AM, Andreik said:

What about SciTE? Doesn't throw any compile or runtime error?

Expand  

SciTE Lite is silent, dont know about full SciTE.

Edited by Werty

Some guy's script + some other guy's script = my script!

Posted (edited)

The "1-+++-1-+++-1" part has been like that for years, Try various combinations of "---++---------+----+--+" or whatever with some numbers.

The "Chr()Chr()&&" part I didnt know about.

Edited by Werty

Some guy's script + some other guy's script = my script!

  • 2 weeks later...
Posted (edited)

Does this count?

I at least haven't seen it listed in the help file anyway. (Maybe missed it)

Local $bTest

$bTest = ConsoleWrite("Hi!" & @CRLF) = 5
ConsoleWrite($bTest & @CRLF)
Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

  Reveal hidden contents

 

Posted (edited)

Here is another:

$x = 1 ? 1 : 0 : 0 : 0 : 0 : 0

Au3Check complains, but it works at runtime

The ternary expression will still work as expected.

Tested with 3.3.16.1

Edited by genius257
Posted

And here is an undocumented feature i personally love ❤️ 

$t = DllStructCreate("INT a;INT b;INT c[3];")
; DllStruct values can used via dot notation
$t.a = 123
ConsoleWrite($t.a & @CRLF)
; But i recently discovered this also applies to indexed elements:
ConsoleWrite($t.c(2) & @CRLF)
$t.c(2) = 123
ConsoleWrite($t.c(2) & @CRLF)

 

Posted (edited)

And a silly one:

Keywords like Null and Default MUST be followed with a space, when followed by operators like & and +

$x = Null+1; 
ConsoleWrite($x&@CRLF)

 

test.au3 (76) : ==> Missing separator character after keyword.: 
$x = Null+1 
$x = Null^ ERROR

Au3Check will not detect this error.

Tested with 3.3.16.1

Edited by genius257
Posted
  On 5/23/2024 at 7:31 AM, genius257 said:

And here is an undocumented feature i personally love ❤️

Expand  

I could be mis-remembering, but I'm sure this was on the chopping block at some point years ago...

Can't find the thread now, but I think it was along the lines of reserving dot notation for object datatypes.

Posted

I remember too that dot notation is not encouraged so it doesn't appear anywhere in the help file, yet it's used by many of us.

Posted
  On 5/23/2024 at 7:31 AM, genius257 said:

And here is an undocumented feature i personally love ❤️ 

$t = DllStructCreate("INT a;INT b;INT c[3];")
; DllStruct values can used via dot notation
$t.a = 123
ConsoleWrite($t.a & @CRLF)
; But i recently discovered this also applies to indexed elements:
ConsoleWrite($t.c(2) & @CRLF)
$t.c(2) = 123
ConsoleWrite($t.c(2) & @CRLF)

 

Expand  

There is also an undocumented bug about this notation that one must be aware of :

$t.c(2) = 123
ConsoleWrite($t.c(2) & @CRLF)
$i = 2
$t.c($i) = 321  ; does not work
ConsoleWrite($t.c(2) & @CRLF)
$t.c(($i)) = 321  ; now works
ConsoleWrite($t.c(2) & @CRLF)

 

Posted (edited)
  On 5/23/2024 at 2:40 AM, argumentum said:

Return Value: The amount of data written.

Expand  

Thanks, I do understand that, but what I meant is I haven't seen any documentation on comparing two items and it returning a Boolean directly to a variable like that, without a If/Ternary. But I guess on second thought, it is a poorly formatted comparison.

Edited by donnyh13

LibreOffice UDF  ; Scite4AutoIt Spell-Checker Using LibreOffice

  Reveal hidden contents

 

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...