Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/20/2021 in all areas

  1. Warning - Script breaking change
    1 point
  2. Try this pattern : Local $w = StringRegExp($s, "(?s)(\b[[:alpha:]]{2,}\b)", 3)
    1 point
  3. Danp2

    window 10 problem?

    Check the settings for your RDP connection to make sure this checkbox isn't checked.
    1 point
  4. Start with the Wiki, which has a section on the editor (SciTE4AutoIt3). This will give you information not only on the editor's features but has links to other material: https://www.autoitscript.com/wiki Unfortunately, other than using the Translate feature in Google, you're going to have to work on this if you're going to be on this (an English-speaking) forum. I know there is a Vietnamese forum (https://autoitvn.com) but cannot speak to how useful it is.
    1 point
  5. 5) has been already submitted to Jon long time ago
    1 point
  6. Other: in no particular order 1) Allow assignments during evaluation: While $result=GetResults() ProcessResult($result) WEnd 2) Variables with file scope 3) Objects 4) Reflection 5) Parameter passing by name AFunc($b =: 5) Func AFunc($a = 0, $b) EndFunc 6) One-line ElseIf If $a=b Then AFunc() ElseIf $a=$c Then BFunc() ElseIf $a=$d Then CFunc() Else DFunc() 7) Cast to boolean - Bool() 8 ) Structs 9) Return multiple values from function
    1 point
  7. Java is not a fair comparison, it is a cross-platform OS which happens to run on top of other OSes, and the whole OS just runs one program I might be "let's make a programming language" crazy but I am not "let's make an OS" crazy Not really, python for example compiles the code into its own bytes before interpreting it, I am taking a similar approach. If I ever get around making an actual compiler, it would just be a little bit of generated assembly with a lot of pre-compiled stubs to handle high-level stuff Some of the sub-systems might get too heavy (10s of MBs) if I implement all the other features you asked for, so it's a good feature to have, hopefully not too bothersome to implement Those are great recommendations, I already had some of them in my mind, like hooking into crypto functions (OpenSSL in Linux). These features are more related to a standard library though, as opposed to the core language design itself, but I am glad you mentioned them anyway. I have a lot planned for which would go into the standard set of tools available in EasyCodeIt, here are some I can recall on top of my head: cURL integration to support a lot of network protocols Transparent encryption for network sockets (the crypto SSL stuff you mentioned), perhaps implemented via a generic abstract layer so that people can implement their own wrappers over sockets and other IO A lot of wrappers around POSIX, Linux, Windows and other platform specific stuff etc. As you can see, implementing all of this in a single program might make it too heavy, thus my interest making it somewhat modular. Not really sure about chromium though, that might be taking it a bit too far... but we will see, nothing is impossible*! *conditions apply
    1 point
  8. 1) Cross-platform support. Yes, that'd be cool. But there is Java, etc. 2) Multi-threading. Yes but, sounds better than it is for script kids ( like me ). 3) Compilation to machine or byte code. Yes but, it'd be a language like C, R, etc., rather than an automation tool. 4) Modular programs. Yes if you're gonna build machine code, otherwise, meh. 5) Other (Please mention which by posting). Ok: Internal IPC for easy forking. ( a semaphore system would also be welcomed ) A queued storage system, much like MailSlots ( could be used with the IPC or as IPC ) TCP driven and/or memory, if possible. The above internal goodies would benefit of separate threads, as also GUI would benefit if in an independent thread, as to not freeze the code from running due to clicking or IPC or anything internal ( But that don't mean to expose threads to users. Users can fork. ) A hook to OpenSSL or, if machine code gen., a SSL module, or both ( Crypto is important ). A chromium integration ability. I guess that's enough for a wish list PS: byte code or not, the above is what I'd like to see in an AutoIt.
    1 point
  9. Optimized code : #include <Array.au3> Const $DIG = [1,0,0], $IN = [10], $OUT = [2] ;Const $DIG = [1,0,0], $IN = [2], $OUT = [10] ;Const $DIG = [1,9,0,3,1,5], $IN = [2,10], $OUT = [10] ;Const $DIG = [1,9,0,3,1,5], $IN = [2,10], $OUT = [4,3,2] ;Const $DIG = [52,0,0,0,0], $IN = [100,7,24,60,60], $OUT = [10] ;Const $DIG = [0,2,10], $IN = [2,4,8,16], $OUT = [42] ;Const $DIG = [], $IN = [123,456], $OUT = [13] ;Const $DIG = [0, 0], $IN = [123,456], $OUT = [13] Local $Result[0], $res = 0, $tmp = 1 For $i = 1 To UBound($DIG) $res += $DIG[UBound($DIG) - $i] * $tmp $tmp *= $IN[UBound($IN)-Mod($i-1, UBound($IN)) - 1] Next ConsoleWrite($res & @CRLF) $i = 0 While $res > 0 ReDim $Result[$i+1] $tmp = $OUT[UBound($OUT)-Mod($i, UBound($OUT)) - 1] $Result[$i] = Mod($res, $tmp) $res = Floor($res/$tmp) $i += 1 WEnd _ArrayReverse($Result) _ArrayDisplay($Result)
    1 point
  10. @TheXmanThat's for the offer. Look at the error checking in _WD_ExecuteCDPCommand following the calls to _WinHttpWebSocketClose and _WinHttpWebSocketQueryCloseStatus. I don't encounter these error codes (ERROR_WINHTTP_CONNECTION_ERROR and ERROR_INVALID_OPERATION) with Firefox, but I do consistently with Chrome and Edge. @mLipokI knew it. Otherwise, you would have already torn it apart and complete rewritten it. 😜
    1 point
  11. LarsJ

    Miscellaneous Examples

    Using an Object as Element in a Const Array In this post, an object is used as an element in a constant array. Still, it's possible to change an object property. How is that possible? Object variables access the object itself through a reference (pointer). A simple object variable can be created with the Dictionary object. Dictionary ObjectExamples\Example0.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $oDict1 = ObjCreate( "Scripting.Dictionary" ) ; Object reference counter = 1 Local $oDict2 = $oDict1 ; Object reference counter = 2 $oDict1.Item( "$vVar" ) = 123 $oDict1 = 0 ; Object reference counter = 1 ConsoleWrite( "$oDict2.Item( ""$vVar"" ) = " & $oDict2.Item( "$vVar" ) & @CRLF ) $oDict2 = 0 ; Object reference counter = 0 that deletes the object EndFunc #cs $oDict2.Item( "$vVar" ) = 123 #ce The variables $oDict1 and $oDict2 both refer to the same object. The Item property can be set with $oDict1 and read with $oDict2 and vice versa. Examples\Example1.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) #include "..\Includes\InspectVariable.au3" Example() Func Example() Local $oDict1 = ObjCreate( "Scripting.Dictionary" ), $oDict2 = $oDict1 ConsoleWrite( "$oDict1" & @CRLF ) ConsoleWrite( "Type = " & VarGetType( $oDict1 ) & @CRLF ) AccessVariables01( InspectVariableMtd, $oDict1 ) ConsoleWrite( @CRLF ) ConsoleWrite( "$oDict2" & @CRLF ) ConsoleWrite( "Type = " & VarGetType( $oDict2 ) & @CRLF ) AccessVariables01( InspectVariableMtd, $oDict2 ) ConsoleWrite( @CRLF ) ConsoleWrite( "Ptr( $oDict1 ) = " & Ptr( $oDict1 ) & @CRLF ) EndFunc #cs $oDict1 Type = Object ptr = 0x00000000005CB110 ($pVariant) vt = 0x0009 (VT_DISPATCH, pointer to object) data = 0x00000000005B02B0 $oDict2 Type = Object ptr = 0x00000000005CB150 ($pVariant) vt = 0x0009 (VT_DISPATCH, pointer to object) data = 0x00000000005B02B0 Ptr( $oDict1 ) = 0x00000000005B02B0 #ce The InspectVariable.au3 UDF from Accessing AutoIt Variables is used to examine $oDict1 and $oDict2. Today we know that AutoIt variables are internally stored in variant structures. For object variables, the variant type is VT_DISPATCH, and the data field contains a pointer (reference) to the object. Note that this pointer has the same value for both object variables. And that it's the same pointer as returned by Ptr( $oDict1 ). The Item property of the Dictionary object is also a variant that can store all AutoIt data types. DllStruct TypeExamples\Example2.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $tagStruct = "struct;int var1;byte var2;uint var3;char var4[128];endstruct" Local $tStruct = DllStructCreate( $tagStruct ) DllStructSetData( $tStruct, "var1", -100 ) DllStructSetData( $tStruct, "var2", 255 ) DllStructSetData( $tStruct, "var3", 300 ) DllStructSetData( $tStruct, "var4", "Hello" ) Local $oDict1 = ObjCreate( "Scripting.Dictionary" ) Local $oDict2 = $oDict1 $oDict1.Item( "$tStruct" ) = $tStruct ConsoleWrite( "DllStructGetData( $oDict2.Item( ""$tStruct"" ), ""var3"" ) = " & DllStructGetData( $oDict2.Item( "$tStruct" ), "var3" ) & @CRLF ) EndFunc #cs DllStructGetData( $oDict2.Item( "$tStruct" ), "var3" ) = 300 #ce Array TypeAutoIt arrays are internally stored as safearrays of variants. Ie. the array itself is a safearray and the array elements are variant structures. Examples\Example3.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $oDict1 = ObjCreate( "Scripting.Dictionary" ) Local $oDict2 = $oDict1 Local $aArray[5] = [ 0, 1, 222, 3, 4 ] $oDict1.Item( "$aArray" ) = $aArray ConsoleWrite( "$oDict2.Item( ""$aArray"" )[2] = " & $oDict2.Item( "$aArray" )[2] & @CRLF ) ; $oDict1.Item( "$aArray" )[3] = 333 ; Error: Statement cannot be just an expression Local $aMyArray = $oDict1.Item( "$aArray" ) $aMyArray[3] = 333 $oDict1.Item( "$aArray" ) = $aMyArray ConsoleWrite( "$oDict2.Item( ""$aArray"" )[3] = " & $oDict2.Item( "$aArray" )[3] & @CRLF ) EndFunc #cs $oDict2.Item( "$aArray" )[2] = 222 $oDict2.Item( "$aArray" )[3] = 333 #ce Const ArrayA consequence of an object variable having access to the object itself through a reference makes it possible to store an object variable in a constant array (or constant variable) and still be able to change an object property. Since a change of an object property doesn't change the array element (or variable) that refers to the object, the property change doesn't conflict with a constant array (or variable). Examples\Example4.au3: #AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) Example() Func Example() Local $oDict = ObjCreate( "Scripting.Dictionary" ) $oDict.Item( "Int" ) = 1 $oDict.Item( "Flt" ) = 1.1 $oDict.Item( "Str" ) = "One" ;Local $aArray[1] = [ $oDict ] Local Const $aArray[1] = [ $oDict ] ; Local Const $oDict = 0 ConsoleWrite( "$aArray[0].Item( ""Int"" ) = " & $aArray[0].Item( "Int" ) & @CRLF ) ConsoleWrite( "$aArray[0].Item( ""Flt"" ) = " & $aArray[0].Item( "Flt" ) & @CRLF ) ConsoleWrite( "$aArray[0].Item( ""Str"" ) = " & $aArray[0].Item( "Str" ) & @CRLF & @CRLF ) #cs ; Direct modification of the $aArray values in this way doesn't work ; But it does work if you remove "Const" in the declaration of $aArray $aArray[0].Item( "Int" ) = 2 ; Error: $aArray previously declared as a 'Const' $aArray[0].Item( "Flt" ) = 2.2 ; Error: $aArray previously declared as a 'Const' $aArray[0].Item( "Str" ) = "Two" ; Error: $aArray previously declared as a 'Const' ConsoleWrite( "$aArray[0].Item( ""Int"" ) = " & $aArray[0].Item( "Int" ) & @CRLF ) ConsoleWrite( "$aArray[0].Item( ""Flt"" ) = " & $aArray[0].Item( "Flt" ) & @CRLF ) ConsoleWrite( "$aArray[0].Item( ""Str"" ) = " & $aArray[0].Item( "Str" ) & @CRLF & @CRLF ) #ce ;#cs ; Indirect modification of the $aArray values in this way does work Local $oMyDict = $aArray[0] $oMyDict.Item( "Int" ) = 2 $oMyDict.Item( "Flt" ) = 2.2 $oMyDict.Item( "Str" ) = "Two" $oMyDict = 0 ConsoleWrite( "$aArray[0].Item( ""Int"" ) = " & $aArray[0].Item( "Int" ) & @CRLF ) ConsoleWrite( "$aArray[0].Item( ""Flt"" ) = " & $aArray[0].Item( "Flt" ) & @CRLF ) ConsoleWrite( "$aArray[0].Item( ""Str"" ) = " & $aArray[0].Item( "Str" ) & @CRLF & @CRLF ) ;#ce EndFunc #cs $aArray[0].Item( "Int" ) = 1 $aArray[0].Item( "Flt" ) = 1.1 $aArray[0].Item( "Str" ) = One $aArray[0].Item( "Int" ) = 2 $aArray[0].Item( "Flt" ) = 2.2 $aArray[0].Item( "Str" ) = Two #ce This example is similar to the example in the link at top of post. 7z-fileThe 7z-file contains source code for UDFs and examples. You need AutoIt 3.3.12 or later. Tested on Windows 7 and Windows 10. Comments are welcome. Let me know if there are any issues. Misc.7z
    1 point
  12. ...is good advise nonetheless @pseakins. But the point was more along the use of the operators ( <>, =, etc. ). ( is a good read ) So as far as the OP question is concerned, it was satisfactorily answered. Shame on me for not being more of a ... programmer. I script without much thinking, to the point of not even taking datatypes into consideration. Gotta love AutoIt. Is very forgiving
    1 point
  13. First one is easy --> false (because $a will be converted to 0) Second one : Not has highest precedence, so Not $a should return False, so False = 1 --> False Third one is easy if I am right on second --> True ps. my guess on second was right, but I wasn't really sure about it : gj Jocko pss. just googled translation on jocko : it means gaming. You are wearing your name very well !
    1 point
  14. What the OP means is that the installer doesn't run when stored in a path containing UNICODE characters, so there is an easy workaround but it is something we should do for the next version. Jos
    1 point
×
×
  • Create New...