Jump to content

AutoIt v.3.3.13.18 Beta


Jon
 Share

Recommended Posts

  • Administrators

File Name: AutoIt v.3.3.13.18 Beta

File Submitter: Jon

File Submitted: 20 Aug 2014

File Category: Beta



3.3.13.18 (20th August, 2014) (Beta)
AutoIt:
- Fixed #2639: Unable to Copy/Paste from Embedded IE object.
- Fixed #2839: GUISetAccelerators() with an invalid array can cause a hard crash.

UDFs:
- Changed: _ArrayInsert() now uses constants to change addition behaviour and datatype forcing.



Click here to download this file

Link to comment
Share on other sites

I apologize if I've missed something because I have not read deeply everything in previous beta's regarding Maps.

If I have an array in a map, it appears I cannot alter an element of it...

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_AU3Check=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


#Region Pseudo Object

Global $aArray[4] = [7, 8, 9, 0]
Global $nPseudoObject[]
$nPseudoObject.int = 123
$nPseudoObject.string = "Hello"
$nPseudoObject.array = $aArray

$nPseudoObject.GetInt = Get_Int
$nPseudoObject.GetString = Get_String
$nPseudoObject.GetArray = Get_Array
$nPseudoObject.SetInt = Set_Int
$nPseudoObject.SetString = Set_String
$nPseudoObject.SetArray = Set_Array

Func Get_Int()
    Return $nPseudoObject.int
EndFunc   ;==>Get_Int

Func Get_String()
    Return $nPseudoObject.string
EndFunc   ;==>Get_String

Func Get_Array($i)
    Return $nPseudoObject.array[$i]
EndFunc   ;==>Get_Array

Func Set_Int($int)
    $nPseudoObject.int = $int
EndFunc   ;==>Set_Int

Func Set_String($string)
    $nPseudoObject.string = $string
EndFunc   ;==>Set_String

Func Set_Array($i, $v)
    $nPseudoObject.array[$i] = $v ; variable must be of type "Object"
EndFunc   ;==>Set_Array

#EndRegion Pseudo Object


ConsoleWrite(($nPseudoObject.GetInt) () & @LF)
ConsoleWrite(($nPseudoObject.GetString) () & @LF)
ConsoleWrite(($nPseudoObject.GetArray) (2) & @LF)

($nPseudoObject.SetInt) (456)
($nPseudoObject.SetString) ("World")
($nPseudoObject.SetArray) (2, 18) ; This call produces above error
;$nPseudoObject.array[2] = 18 ; This also fails

ConsoleWrite(($nPseudoObject.GetInt) () & @LF)
ConsoleWrite(($nPseudoObject.GetString) () & @LF)
ConsoleWrite(($nPseudoObject.GetArray) (2) & @LF)

EDIT: I see the way around it is to extract the array, but is this by design?

Func Set_Array($i, $v)
    Local $a = $nPseudoObject.array
    $a[$i] = $v
    $nPseudoObject.array = $a
EndFunc   ;==>Set_Array
Edited by JohnOne

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

Use this:

Func Set_Array($i, $v)
    ($nPseudoObject.array)[$i] = $v ; works
EndFunc   ;==>Set_Array

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

That's correct, the array element remains untouched and it looks like a bug. But there is something even more troublesome. I'll post soon a simplified version to demonstrate.

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

Sorry for bumping this way.

Two issues in fact:

Local $aArray = [7, 8, 9]
Local $mMap[]
$mMap.array = $aArray

; first issue
ConsoleWrite(($mMap.array)[1] & @LF)    ; --> 8
($mMap.array)[1] = 18                   ; does nothing
ConsoleWrite(($mMap.array)[1] & @LF)    ; --> 8

; second issue
Local $mMap[]
$mMap.element = "I am only son."
$mMap.fct = _function

ConsoleWrite(@LF & ">>> Content of $mMap (" & UBound($mMap) & " elements) before calling _function" & @LF)
For $key In MapKeys($mMap)
    ConsoleWrite($key & " --> " & $mMap[$key] & @LF)
Next

_function("We now are twins!")

ConsoleWrite(@LF & ">>> Content of $mMap (" & UBound($mMap) & " elements) after calling _function" & @LF)
For $key In MapKeys($mMap)
    ConsoleWrite($key & " --> " & $mMap[$key] & @LF)
Next

Func _function($s)
    $mMap.element = $s
EndFunc

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

  • Administrators

Once you use (...) around something it becomes an expression and results a simple value rather than a reference to the original element. So the ()[1] is creating a copy of the array and then accessing element 1 of that copy. By design, due to the limits of the parser.

Link to comment
Share on other sites

Seems to imply that we can't write inside an array stored in a Map, is that correct?  <-- No!

A little unfortunate since we can successfully write inside a Map stored in a Map. But if that requires to melt down the whole building, then fine.

EDIT: yes we can. See modified example code below where the array-in-map is passed byref to a function which udpates the array.

Note that this trick can be used as well for arrays-in-arrays to avoid copying the inner array to a temporary variable to perform the update and copying it back to the outer array.

What about the unexpected twins?

Even simpler repro:

Local $mMap[]
$mMap.first = "abc"
ConsoleWrite(@LF & ">>> Content of $mMap (" & UBound($mMap) & " elements) before changing first" & @LF)
For $key In MapKeys($mMap)
    ConsoleWrite($key & " --> " & $mMap[$key] & @LF)
Next
$mMap.first = "def"
ConsoleWrite(@LF & ">>> Content of $mMap (" & UBound($mMap) & " elements) after  changing first" & @LF)
For $key In MapKeys($mMap)
    ConsoleWrite($key & " --> " & $mMap[$key] & @LF)
Next
Edited by jchd

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

johnone,

You can use a slightly modified version which is what I believe to be the only way to modify an inner array in the light of what Jon said about ().

Global $aArray[4] = [7, 8, 9, 0]
Global $nPseudoObject[]
$nPseudoObject.int = 123
$nPseudoObject.string = "Hello"
$nPseudoObject.array = $aArray

$nPseudoObject.GetInt = Get_Int
$nPseudoObject.GetString = Get_String
$nPseudoObject.GetArray = Get_Array
$nPseudoObject.SetInt = Set_Int
$nPseudoObject.SetString = Set_String
$nPseudoObject.SetArray = Set_Array

Func Get_Int()
    Return $nPseudoObject.int
EndFunc   ;==>Get_Int

Func Get_String()
    Return $nPseudoObject.string
EndFunc   ;==>Get_String

Func Get_Array($i)
    Return $nPseudoObject.array[$i]
EndFunc   ;==>Get_Array

Func Set_Int($int)
    $nPseudoObject.int = $int
EndFunc   ;==>Set_Int

Func Set_String($string)
    $nPseudoObject.string = $string
EndFunc   ;==>Set_String

Func Set_Array(ByRef $array, $index, $value)    ; passing "this" byref
    $array[$index] = $value ; works
EndFunc   ;==>Set_Array

#EndRegion Pseudo Object


ConsoleWrite(($nPseudoObject.GetInt) () & @LF)
ConsoleWrite(($nPseudoObject.GetString) () & @LF)
ConsoleWrite(($nPseudoObject.GetArray) (2) & @LF & @LF)

($nPseudoObject.SetInt) (456)
($nPseudoObject.SetString) ("World")
($nPseudoObject.SetArray) ($nPseudoObject.array, 2, 18) ; This call now works

ConsoleWrite(($nPseudoObject.GetInt) () & @LF)
ConsoleWrite(($nPseudoObject.GetString) () & @LF)
ConsoleWrite(($nPseudoObject.GetArray) (2) & @LF & @LF)

Passing "this" byref is always better since it makes the inner functions work independantly of the map instance.

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

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