Jump to content

AutoIt v3.3.13.19 Beta


Jon
 Share

Recommended Posts

  • Moderators

Hi,

Pardon my ignorance, but can someone please explain why passing such a parameter ByRef should not be an error? Surely the main purpose of passing a parameter ByRef is to allow the function to alter the value of the original - how can than happen when the parameter is a construct? :huh:

M23

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

 

Link to comment
Share on other sites

I thought the primary reason for ByRef was so a copy was not made.

Rightly or wrongly, I would have thought that the param would be treated as const and only give an error if an attempted change of the value was made.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I thought the primary reason for ByRef was so a copy was not made.

Rightly or wrongly, I would have thought that the param would be treated as const and only give an error if an attempted change of the value was made.

Reference parameters pass the handle to the original object store (variable, property, another parameter, any L-Value, etc) so that changes made are stored to the original and no copy is made for complex objects.

I don't know why trancexx would expect an R-Value to work.

Link to comment
Share on other sites

Reference parameters pass the handle to the original object store (variable, property, another parameter, any L-Value, etc) so that changes made are stored to the original and no copy is made for complex objects.

I don't know why trancexx would expect an R-Value to work.

I'm not a pro of the C++ indeed I know little, but what do I know that is not Rvalue or Lvalue that is a temporary object (that must be destroyed when no longer needed), and a temporary object is const, all standart library have already func (with paramenter) in pointer and reference and const and non-const (Operator and Function Overloading, if not this does not work after (1 + (2 + 3)) or ("String1" + ("Sring2" + "String3")) etc etc), so is not wrong to send a temporary object as (const) byref

 

Ciao.

Edited by DXRW4E

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Link to comment
Share on other sites

@OffTopic

Don't forget kids

Are you kidding me???? you're kidding right ????

 

we;re talking about AutoIt here not C or C++.

discussion is in general (see hereeeeeee ) and C++ is the best example that explains it

 

Ciao.

Edited by DXRW4E

apps-odrive.pngdrive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Link to comment
Share on other sites

Reference parameters pass the handle to the original object store (variable, property, another parameter, any L-Value, etc) so that changes made are stored to the original and no copy is made for complex objects.

 

I don't know why trancexx would expect an R-Value to work.

Because since 6 years ago AutoIt allows rvalues passed as argument byref. It's documented behaviour.

$a = 1

A(($a + 5)) ; notice extra parentheses


Func A(ByRef $x)
EndFunc
...or if it would be more obvious:

A(77)


Func A(ByRef $x)
EndFunc
 

Besides, the example I showed earlier indeed produces unexpected behaviour, which can be seen if you look at some standard UDFs and their definitions. For example take function _WinAPI_StringLenA(). Param is Const Byref, That means I can't do this:

$tStr = DllStructCreate("char[100]")
$pStr = DllStructGetPtr($tStr)

DllStructSetData($tStr, 1, "QWERTZ")


$iLen = _WinAPI_StringLenA($pStr + 1) ; one character ahead
ConsoleWrite($iLen & @CRLF)
... That example must print 5 to console, and currently it can't even be run. The person who added "Const Byref" to function definition obviously didn't expect interpreter to error-out on something like that.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I can agree Const Byref make sense but Just ByRef updating the value cannot be done so for me it is an error

Who are you? Really, who are you?

For your information developer Jpm added the feature to the language. Are you that Jpm or someone else?

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

  • 2 weeks later...

 

I see there is now v3.3.13.20 (Beta) doc

Is it mean that OnLine version of Beta Doc is updated much often / many more times then beta CHM version ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Moderators

mLipok,

No, as a Beta version is released the various files in the repository automatically update to the next version number. The files to which Jon has linked were pulled directly from the repository and so have that number. :)

M23

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

 

Link to comment
Share on other sites

FileOpen with $FO_UTF16_LE or $FO_UTF16_BE or $FO_UTF8 Or $FO_UTF8_NOBOM return binary now? Is a bug or feature?

#include 'FileConstants.au3'

$h = FileOpen('test.txt', $FO_OVERWRITE + $FO_UTF8_NOBOM)
FileWrite($h, 'ddddddddddddd')
FileClose($h)

test(0)
test($FO_BINARY)
test($FO_UTF16_LE)
test($FO_UTF16_BE)
test($FO_UTF8)
test($FO_UTF8_NOBOM)
test($FO_UTF8_FULL)

Func test($FO)
  $h = FileOpen('test.txt', $FO_READ + $FO)
  $data = FileRead($h)
  FileClose($h)
  ConsoleWrite($data & @CRLF)
EndFunc

In console:

ddddddddddddd
0x64646464646464646464646464
0x6464646464646464646464
0x6464646464646464646464
0x64646464646464646464
0x64646464646464646464646464
ddddddddddddd

Link to comment
Share on other sites

UTF8 w/o BOM is nothing but ANSI since the content is all below 0x80.

$h = FileOpen('test.txt', $FO_OVERWRITE + $FO_UTF8_NOBOM)
FileWrite($h, 'ddddddddddddd')
FileClose($h)

;                                   result from beta
test(0)                 ; 0         ANSI, correct
test($FO_BINARY)        ; 16        correct
test($FO_UTF16_LE)      ; 32        questionable: no valid BOM found (eats first 2 bytes)
test($FO_UTF16_BE)      ; 64        questionable: no valid BOM found (eats first 2 bytes)
test($FO_UTF8)          ; 128       questionable: no valid BOM found (eats first 3 bytes)
test($FO_UTF8_NOBOM)    ; 256       wrong
test($FO_UTF8_FULL)     ; 16384     correct

Func test($FO)
  $h = FileOpen('test.txt', $FO_READ + $FO)
  $data = FileRead($h)
  ConsoleWrite($FO & @TAB & '--> ' & $data & @CRLF)
  FileClose($h)
EndFunc

Beta returns:

0   --> ddddddddddddd
16  --> 0x64646464646464646464646464
32  --> 0x6464646464646464646464
64  --> 0x6464646464646464646464
128 --> 0x64646464646464646464
256 --> 0x64646464646464646464646464
16384   --> ddddddddddddd

Release returns:

0   --> ddddddddddddd
16  --> 0x64646464646464646464646464
32  --> ??????
64  --> ??????
128 --> ddddddddddddd
256 --> ddddddddddddd
16384   --> ddddddddddddd

which is correct in every case. The recent "fix" in read modes isn't correct.

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)

Link to comment
Share on other sites

When I use With / EndWith in this function it works fine until I rearrange some cases.  I can't make a reproducer because I have no idea how to in this case.

; Works fine

Func controller_main_gui_messages(Const $this)
  Local Const $message = GUIGetMsg()

  With $this
    If Not .GUIMessages($message) Then 
      Return False
    EndIf
    
    If Not .ActionMessages($message) Then 
      Return False
    EndIf
      
    If Not .VersionsFileMenu($message) Then 
      Return False
    EndIf
      
    If Not .MainTabActions($message) Then 
      Return False
    EndIf
  EndWith

  Return True
EndFunc
; doesn't work

Func controller_main_gui_messages(Const $this)
  Local Const $message = GUIGetMsg()

  With $this
    If Not .MainTabActions($message) Then 
      Return False
    EndIf
    
    If Not .GUIMessages($message) Then ; Error: (115) : Unknown name.
      Return False
    EndIf
    
    If Not .ActionMessages($message) Then 
      Return False
    EndIf
      
    If Not .VersionsFileMenu($message) Then 
      Return False
    EndIf
  EndWith

  Return True
EndFunc

The full code for this is SciTE Customization GUI in my signature.  That code is kinda large but I don't think it's my code though. 

Anyways, I know you can't do anything without a reproducer.  I thought I'd put this out there because I discovered that order seems to have a play in the issue.

Well, kthxbye.

Edited by jaberwacky
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...