# AutoIt v3.3.9.6 Beta

## Recommended Posts

• Replies 76
• Created

#### Top Posters In This Topic

Wow, that's quite a list Thanks Jon, trancexx and to all others who have contributed. I must admit I can't imagine why they call it a ternary operator. Ah well, it's not important. Thanks again!

##### Share on other sites

Ternary comes from mathematics, n-ary. FYI, Ternary is also known as Tertiary

##### Share on other sites

Ternary comes from mathematics, n-ary. FYI, Ternary is also known as Tertiary

I know the mathematical use of the terms. Like I said it's not important. It's a nice feature regardless!

Edit

I think you meant trinary, not tertiary. Anyway I just read up on it a bit:

Although many ternary operators are possible, the conditional operator is so common, and other ternary operators so rare, that the conditional operator is commonly (albeit incorrectly) referred to as the ternary operator.

Edited by czardas
##### Share on other sites

• Moderators

Hi,

For those who might be wondering how some of the new features work, here is some code which should help explain:

```#AutoIt3Wrapper_Run_AU3Check=n

#include <Constants.au3>

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

; Ternary operator
MsgBox(\$MB_OK, "Result: 1=1", (1 = 1) ? "True!" : "False!")
MsgBox(\$MB_OK, "Result: 1=2", (1 = 2) ? "True!" : "False!")

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

; Array dereferencing
Global \$sString = "0-1-2-3-4"
MsgBox(\$MB_OK, "Array Deref", StringSplit(\$sString, "-")[3]) ; Display the 3rd element of the split array

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

; Non-explicit array bound definition
Global \$aArray[] = [0, 1, 2, 3, 4] ; Note declared with no bounds, but with elements
MsgBox(\$MB_OK, "Result", \$aArray[2])

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

; Functions as first class objects

; Using native functions
\$Func = MsgBox
\$Func(0, "Native", "Hello World!")

; Using UDFs
\$Func = _UDF_Func_1
\$Func(0, "UDF", "Hello World!")

Func _UDF_Func_1(\$v1, \$v2, \$v3)
Return MsgBox(\$v1, \$v2, \$v3)
EndFunc

; UDF function return
\$Func = _UDF_Func_2()
\$Func(\$MB_OK, "UDF-Func-Return-1", "Hello World!")

\$Func = _UDF_Func_2()(0, "UDF-Func-Return-2", "Hello World!")

Func _UDF_Func_2()
Return MsgBox
EndFunc

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

; ByRef parameters in Call
Local Enum \$eParam_1, \$eParam_2, \$eParam_3
\$sByRefCall = "Before Call"
Call('_Called_Func', \$eParam_1, \$eParam_2, \$eParam_3, \$sByRefCall)
MsgBox(\$MB_OK, "After Call", \$eParam_1 & @CRLF & \$eParam_2 & @CRLF & \$eParam_3 & @CRLF & \$sByRefCall)

Func _Called_Func(\$vParam_1, \$vParam_2, \$vParam_3, ByRef \$sString)
MsgBox(\$MB_OK, " In Function", \$vParam_1 & @CRLF & \$vParam_2 & @CRLF & \$vParam_3 & @CRLF & \$sString)
\$sString = "After Call"
EndFunc```
I have added the line to disable AU3Check as this is obviously still a bit behind the core code - Jon has to decide the final syntax for some of the features before they can be correctly checked.

M23

Edited by Melba23
Ternary examples amended to be less "terrible"

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 on other sites

Hmm, it hadn't been typed into the changelog, but there were some significant changes to Aut2Exe/compiling as well. Scripts are stored as a normal resource rather than hacked onto the end of the exe.

Look in the helpfile for directives/#pragma options which allow you to control aspects of the compiled exe like icons/versions/UAC options. Most of this was available in the scite editor/autoitwrapper scripts but it's nice to have it self contained in the main compiler.

##### Share on other sites

Hmm, it hadn't been typed into the changelog, but there were some significant changes to Aut2Exe/compiling as well. Scripts are stored as a normal resource rather than hacked onto the end of the exe.

Look in the helpfile for directives/#pragma options which allow you to control aspects of the compiled exe like icons/versions/UAC options. Most of this was available in the scite editor/autoitwrapper scripts but it's nice to have it self contained in the main compiler.

I think that was trancexx too, she did some thing with it for some reason that I can't remember now.

##### Share on other sites

Yeah I know, it's in the helpfile, I was just saying that it hadn't been put in the changelog.txt file which is the only thing I paste here on release

##### Share on other sites

ByRef in Call: This does not work with CallArgArray, elements will not be changed.

For the new functions as first class objects, here is an example of possible usage, that might actually be useful.

```_EnumFolder("C:\", MyCallback)

Func MyCallback(\$sFile)
ConsoleWrite(\$sFile & @LF)
EndFunc   ;==>MyCallback

Func _EnumFolder(\$sPath, \$Callback)
If StringRight(\$sPath, 1) <> '\' Then \$sPath &= '\'

Local \$hFind = FileFindFirstFile(\$sPath & "*.*")
If \$hFind < 0 Then Return SetError(1)

Local \$sFile
While 1
\$sFile = FileFindNextFile(\$hFind)
If @error Then ExitLoop

\$Callback(\$sFile)
WEnd

FileClose(\$hFind)
EndFunc   ;==>_EnumFolder```

This does not create an empty array:

```Local \$a = []
ConsoleWrite(UBound(\$a) & @LF)```

This does:

```Local \$a[0]
ConsoleWrite(UBound(\$a) & @LF)```

Currently _ArrayAdd works with empty arrays, but _ArrayDelete probably needs to be modified to allow returning of empty arrays rather than a string.

And finally: Whatever you do, do not use the new conditional operator like the changelog does to return True or False.

##### Share on other sites

Quick update note on one of the mentioned items:

- Removed #2172: Select...EndSelect statement and replaced with an If...EndIf as well as optimised the code.

This refers only to the _StringRepeat function , Select...EndSelect haven't been removed from the language.

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 on other sites

Quick update note on one of the mentioned items:

This refers only to the _StringRepeat function , Select...EndSelect haven't been removed from the language.

Fixed.

##### Share on other sites

Fixed.

??? What's fixed?

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 on other sites

??? What's fixed?

Select...EndSelect has now been removed from the language as it should have been...

Edited by Mat
##### Share on other sites

Is there an advantage of using Select over If?

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 on other sites

I think AutoIt3_x64.exe is broken in this build. I get an 'Unable to open the script file.' when dbl clicking the exe, and 'AutoIt Error (0) : ==> Unable to open the script file.' from SciTE. Can anyone confirm?

##### Share on other sites

Thanks! Not sure if it's related, but compiled EXEs work (32-bit and 64-bit) but lack icons and any version etc info.

Edited by wraithdu

##### Share on other sites

This topic is now closed to further replies.
• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...