Leaderboard
Popular Content
Showing content with the highest reputation on 04/28/2020 in all areas
-
Script becomes way slower after a msgbox - (Moved)
seadoggie01 and 2 others reacted to Jon for a topic
Seems just to be taking longer per call rather than more messages. I changed the code to not even try and process the messages and just check a single message per script line (the minimum it will ever be) and it was just as slow. I even disabled dispatching the messages with no difference. I think the only solution would be to completely change the message loop so it runs on it’s own thread which will be painful. I’m not sure why I didn’t do it that way from the start as I do that in c# all the time. Probably noob.3 points -
Script becomes way slower after a msgbox - (Moved)
seadoggie01 and one other reacted to Nine for a topic
@Jon I wanna thank you for being here and update us. This thread is like watching a "Mission Impossible", It is hardly possible to solve this issue, but in the end, it will be a brilliant success.2 points -
This UDF allows to handle SHBrowseForFolderW with more options, such as multi selection (checkboxes), window position, controls text and more. Example: #include 'BrowseForFolder.au3' $iFlags = BitOR($BIF_MULTISELECT, $BIF_TOPMOST, $BIF_SELECTONLYROOT, $BIF_RETURNONLYFSDIRS, $BIF_BROWSEINCLUDEFILES, $BIF_EDITBOX) Dim $aCtrlsTxt[6] = ['Select files from the list below.', '', 'Dir:', 'New dir', 'Select', 'Cancel'] ;Since $BIF_SELECTONLYROOT is set, @SystemDir wont be selected (or returned) as @WindowsDir is a root for this path $sPreCheck = @WindowsDir & '|' & @ProgramFilesDir & '|' & @SystemDir $sRet = _BrowseForFolder('Title', 'C:\', @ProgramFilesDir, $sPreCheck, $iFlags, $aCtrlsTxt, 0) If Not @error Then $aSel = StringSplit($sRet, '|') $sRet = '' For $i = 1 To $aSel[0] $sRet &= ($sRet ? @CRLF : '') & $aSel[$i] Next MsgBox(64, @ScriptName, 'Selected:' & @CRLF & @CRLF & $sRet) EndIf BrowseForFolder_0.1.zip2 points
-
Introduction JSON (Javascript Object Notation) is a popular data-interchange format and supported by a lot of script languages. On AutoIt, there is already a >JSON UDF written by Gabriel Boehme. It is good but too slow, and not supports unicode and control characters very well. So I write a new one (and of course, fast one as usual). I use a machine code version of JSON parser called "jsmn". jsmn not only supports standard JSON, but also accepts some non-strict JSON string. See below for example. Important Update!! I rename the library from jsmn.au3 to json.au3. All function names are changed, too. Decoding Function Json_Decode($Json) $Json can be a standard or non-standard JSON string. For example, it accepts: { server: example.com port: 80 message: "this looks like a config file" } The most JSON data type will be decoded into corresponding AutoIt variable, including 1D array, string, number, true, false, and null. JSON object will be decoded into "Windows Scripting Dictionary Object" retuned from ObjCreate("Scripting.Dictionary"). AutoIt build-in functions like IsArray, IsBool, etc. can be used to check the returned data type. But for Object and Null, Json_IsObject() and Json_IsNull() should be used. If the input JSON string is invalid, @Error will be set to $JSMN_ERROR_INVAL. And if the input JSON string is not finish (maybe read from stream?), @Error will be set to $JSMN_ERROR_PART. Encoding Function Json_Encode($Data, $Option = 0, $Indent = "\t", $ArraySep = ",\r\n", $ObjectSep = ",\r\n", $ColonSep = ": ") $Data can be a string, number, bool, keyword(default or null), 1D arrry, or "Scripting.Dictionary" COM object. Ptr will be converted to number, Binary will be converted to string in UTF8 encoding. Other unsupported types like 2D array, dllstruct or object will be encoded into null. $Option is bitmask consisting following constant: $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) $JSON_UNESCAPED_UNICODE ; Encode multibyte Unicode characters literally $JSON_UNESCAPED_SLASHES ; Don't escape / $JSON_HEX_TAG ; All < and > are converted to \u003C and \u003E $JSON_HEX_AMP ; All &amp;amp;amp;s are converted to \u0026 $JSON_HEX_APOS ; All ' are converted to \u0027 $JSON_HEX_QUOT ; All " are converted to \u0022 $JSON_PRETTY_PRINT ; Use whitespace in returned data to format it $JSON_STRICT_PRINT ; Make sure returned JSON string is RFC4627 compliant $JSON_UNQUOTED_STRING ; Output unquoted string if possible (conflicting with $JSMN_STRICT_PRINT) Most encoding option have the same means like PHP's json_enocde() function. When $JSON_PRETTY_PRINT is set, output format can be change by other 4 parameters ($Indent, $ArraySep, $ObjectSep, and $ColonSep). Because these 4 output format parameters will be checked inside Jsmn_Encode() function, returned string will be always accepted by Jsmn_Decode(). $JSON_UNQUOTED_STRING can be used to output unquoted string that also accetped by Jsmn_Decode(). $JSON_STRICT_PRINT is used to check output format setting and avoid non-standard JSON output. So this option is conflicting with $JSON_UNQUOTED_STRING. Get and Put Functions Json_Put(ByRef $Var, $Notation, $Data, $CheckExists = False) Json_Get(ByRef $Var, $Notation) These functions helps user to access object or array more easily. Both dot notation and square bracket notation can be supported. Json_Put() by default will create non-exists objects and arrays. For example: Local $Obj Json_Put($Obj, ".foo", "foo") Json_Put($Obj, ".bar[0]", "bar") Json_Put($Obj, ".test[1].foo.bar[2].foo.bar", "Test") Local $Test = Json_Get($Obj, '["test"][1]["foo"]["bar"][2]["foo"]["bar"]') ; "Test" Object Help Functions Json_ObjCreate() Json_ObjPut(ByRef $Object, $Key, $Value) Json_ObjGet(ByRef $Object, $Key) Json_ObjDelete(ByRef $Object, $Key) Json_ObjExists(ByRef $Object, $Key) Json_ObjGetCount(ByRef $Object) Json_ObjGetKeys(ByRef $Object) Json_ObjClear(ByRef $Object) These functions are just warps of "Scripting.Dictionary" COM object. You can use these functions if you are not already familiar with it. == Update 2013/05/19 == * Add Jsmn_Encode() option "$JSMN_UNESCAPED_ASCII". Now the default output of Json_Encode() is exactly the same as PHP's json_encode() function (for example, chr(1) will be encoded into u0001). $JSON_UNESCAPED_ASCII ; Don't escape ascii charcters between chr(1) ~ chr(0x1f) == Update 2015/01/08 == * Rename the library from jsmn.au3 to json.au3. All function names are changed, too. * Add Json_Put() and Json_Get() * Add Null support * Using BinaryCall.au3 to loading the machine code. == Update 2018/01/13== (Jos) * Add JsonDump() to list all Json Keys and their values to easily figure out what they are. == Update 2018/10/01== (Jos) * Fixed JsonDump() some fields and values were not showing as discussed here - tnx @TheXman . == Update 2018/10/01b== (Jos) * Added Json_ObjGetItems, Tidied source and fixed au3check warnings - tnx @TheXman . == Update 2018/10/28== (Jos) * Added declaration for $value to avoid au3check warning - tnx @DerPensionist == Update 2018/12/16== (Jos) * Added another declaration for $value to avoid au3check warning and updated the version at the top - tnx @maniootek == Update 2018/12/29== (Jos) * Changed Json_ObjGet() and Json_ObjExists() to allow for multilevel object in string. == Update 2019/01/17== (Jos) * Added support for DOT notation in JSON functions. == Update 2019/07/15== (Jos) * Added support for reading keys with a dot inside when using a dot as separator (updated) == Update 2021/11/18== (TheXman) * Update details in below post: == Update 2021/11/20== (TheXman) * Minor RegEx update, no change to the functionality or result._Json(2021.11.20).zip1 point
-
I needed a very fast x64 unsigned shift right, and doing it through an AutoIt array was way too slow. So I decided to make a .dll to perform such a task. While I was there, why not include all the bitwise operators that I know of. And then why not make a UDF. This is a bit like my wife does, she buys some draperies and then I end up repainting the whole room because the colors do not match anymore. Anyway, hope it can be useful for you too. Let me know if you have enhancements or comments, I will be glad to incorporate them (if possible). Version 2024-12-07 ASM * Code optimization (elimination of redundancy) Version 2024-12-06 ASM Func BitAND64 Func BitOR64 Func BitXOR64 Func BitSHIFT64 Func BitROTATE64 Func BitNOT64 Version 2020-04-27 DLL Func _BitAND64 Func _BitOR64 Func _BitXOR64 Func _BitEQV64 Func _BitIMP64 Func _BitSHIFT64 Func _BitROTATE64 Func _BitNOT64 Func _x64CloseDLL Version 2020-04-27 Util Func _Hex2Dec x64_Ops.zip1 point
-
New UX Window in AutoIt v3
edgi reacted to Se7enstars for a topic
1 point -
Here is a idispatch object with all the base code written in assembly and is setup in a way so that it can be easily modified to integrate your own custom methods with minimal overhead code. Credits to @genius257 (and @trancexx for helping him) for his AutoitObject udf. I learned a tremendous amount from his code and a lot of the assembly is based of his work so many many thanks! Credits also to @LarsJ for his Accessing Autoit Variables thread showing us that we can expose the autoit variables via objects and how to work with the autoit variants/safearrays within assembly code. As mentioned above this is setup for you to modify so there's not a lot of functions you'll be calling directly and a good amount of code you should not have to touch but I'm going to explain the parts that your expected modify and how that code links to the functions you should not have to mess with. There's really only two spots. The first part is your function table. At the top of the IDispatchASM() function you will find a variable like code below called $sFunctions and will get used in two functions; _CreateFuncTable() and _AsmFuncTable(). You don't call these functions but that's where it gets used. One function gathers all the addresses of the functions and the other generates the assembly code allowing you to easily call these functions within your assembly code. The format is one dll per line with a comma separated list of functions for that dll. There is also one line included for autoit functions and will handle registering and releasing the callbacks so its all nicely in one spot. Local $sFunctions = 'kernel32.dll:HeapAlloc,GlobalAlloc,GlobalFree,GlobalLock,GlobalHandle,RtlMoveMemory' & @LF & _ 'oleaut32.dll:VariantInit,VariantCopy,VariantClear,' & @LF & _ 'au3:' & _RegisterAu3Callbacks('_CreateArray,ptr,dword|_GetKeys,ptr,ptr') To call any of function in the list, you just need to first load up a register with the current memory position and call that register with the function name added to it. Here's some small snips from the code showing what I mean: _('getmempos ebx'); load ebx with memory pos ..code... _('stdcall [ebx+_CreateArray], [esi+tObj.count]'); call autoit function to create an array for us to fill ..code... _('stdcall [ebx+VariantClear], [pVarResult]') _('stdcall [ebx+VariantCopy], [pVarResult],[edx+tProp.Variant]'); copy array to result _('stdcall [ebx+_CreateArray],0'); release object The second area that you will modify is the _invoke function and you would do this to add your own methods. All the methods that are currently included are completely optional and can be replaced/removed if you choose. Whats there right now is more or less practice. All you have to do to add your own method is create a new .elseif statement with the ID your assigning and name of method. Just follow the pattern like below. The _DefineDispID() function works hand in hand with the _AsmDispIDChecks() to automatically generate the lookup code needed to lookup the ID's. The only important part to remember when creating your own methods is that they MUST begin with characters "__" and you must use a negative ID starting at -2. I've written the lookup code to only check if this is one of our methods being called when the first 2 characters begin with "__" - this saves a lot of extra checking going on when its not a method being called. ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-5,'__keys')); .. _(' getmempos ebx') ...code... _(' stdcall [ebx+_CreateArray],0'); release object ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-6,'__fill')); _(' mov esi, [pDispParams]') ...code... _(' xor eax,eax'); set return S_OK ;===================================== _(' .elseif dword[dispIdMember] = ' & _DefineDispID(-7,'__reverse')) ; _(' mov esi, [pDispParams]') ...code... _(' xor eax,eax'); set return S_OK ;===================================== Let me know if you have issues, questions or comments. Thanks for looking Update 05/24/2020: I got x64 support working for this now. I didn't get all the methods converted but all the base code is there it looks to be stable (fingers crossed). It should be able to run this portion of the example either 32bit or 64bit. Example: Local $aArray = [111, 222, 333] $oIDispatch = IDispatchASM() $oIDispatch.string = "string test" $oIDispatch.__string = "__string test2" $oIDispatch.float = 12.345145 $oIDispatch.array = $aArray $oIDispatch.binary = Binary(12345678) $oIDispatch.bool = True $oIDispatch.dllStruct = DllStructCreate("BYTE t") $oIDispatch.dllStruct.t = 99 ConsoleWrite('-Direct get test:' & @CRLF & _ '$oIDispatch.string = ' & $oIDispatch.string & @CRLF & _ '$oIDispatch.__string = ' & $oIDispatch.__string & @CRLF & _ '$oIDispatch.float = ' & $oIDispatch.float & @CRLF & _ '$oIDispatch.array[1] = ' & $oIDispatch.array[1] & @CRLF) ConsoleWrite('-method __keysau3 test:' & @CRLF) Local $aKeyAU3s = $oIDispatch.__keysau3() ConsoleWrite('$aKeyAU3s = ' & _ArrayToString($aKeyAU3s) & @CRLF) ConsoleWrite('-method __get test:' & @CRLF) For $k In $oIDispatch.__keysau3() $val = $oIDispatch.__get($k) ConsoleWrite('$oIDispatch.' & $k & ' = ' & (IsArray($val) ? _ArrayToString($val) : (IsDllStruct($val) ? DllStructGetData($val, 1) : $val)) & @CRLF) Next ConsoleWrite('-method __set test:' & @CRLF) Local $i = 0 For $k In $oIDispatch.__keysau3() $oIDispatch.__set($k) = $i ConsoleWrite('$oIDispatch.' & $k & ' = ' & $oIDispatch.__get($k) & @CRLF) $i += 1 Next Output: -Direct get test: $oIDispatch.string = string test $oIDispatch.__string = __string test2 $oIDispatch.float = 12.345145 $oIDispatch.array[1] = 222 -method __keysau3 test: $aKeyAU3s = string|__string|float|array|binary|bool|dllStruct -method __get test: $oIDispatch.string = string test $oIDispatch.__string = __string test2 $oIDispatch.float = 12.345145 $oIDispatch.array = 111|222|333 $oIDispatch.binary = 0x4E61BC00 $oIDispatch.bool = True $oIDispatch.dllStruct = 99 -method __set test: $oIDispatch.string = 0 $oIDispatch.__string = 1 $oIDispatch.float = 2 $oIDispatch.array = 3 $oIDispatch.binary = 4 $oIDispatch.bool = 5 $oIDispatch.dllStruct = 6 I also added 2 more methods to the 32bit part. __PrintAllParms shows how to check the number of parms that were passed and then prints each one to the console. The second is __search and is generic (1D) array search method demonstrating the use of VarCmp function. That would be a key function in creating a arraysort as well. Let me know if you have any issues. Thanks! Edit: Fixed issue with beta versions of autoit not working IDispatchASM 5-24-2020.zip Previous versions:1 point
-
1 point
-
look at the name of the file, there is a missing r1 point
-
You could hide / toggle the debug output on the bottom side. (Via the "view" menu or a hotkey) And the toolbar can´t be disabled completly..but you could arrange it vertically. This should give you more vertical space. (You find these settings in the ISN settings -> View -> Toolbar)1 point
-
run CMD file as a administrator
ivobauerjr reacted to Nine for a topic
It means that the file doesn't exists or is inaccessible because credentials issue. Check with FileExists, if it returns a valid value.1 point -
run CMD file as a administrator
ivobauerjr reacted to Nine for a topic
You have no error handling, nor do you check for PID, if it is valid. Read help file about run function and check its return value and @error value also. ProcessWaitClose should also be added after the run (after all error handling I mean).1 point -
@jcpetu: Unfortunately no idea. It works perfect on my side. What about bit version of autoit.exe? Dll is X86. So it shoult be run using X86 version of Autoit or compiled as X86. What about Scite settings? Don't you prefer X64 Autoit here? Good Luck! On my side unfortunately no other idea to make it work on your enviroment..1 point
-
Help needed WebDriver + Chrome - (Moved)
sergey_slash reacted to Danp2 for a topic
That's correct, because you can't use Webdriver to click an element that isn't visible. It seems like you are targeting the wrong element on your latest attempt. I would try this -- $xpath = "//div[@class='lmt__language_select lmt__language_select--source']//button[@class='lmt__language_select__active']" ; From Chropath $langButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $xpath) _WD_ElementAction($sSession, $langButton, 'click') Now the menu should be visible so that you can click the "English" element.1 point -
Exe server (IDispatch Call)
argumentum reacted to wolf9228 for a topic
At that time I did not have a 64 bit system on the computer so I did not try to work on or did not try to run scripts on 64 bit and I relied on the information in the C ++ 6.0 reference files the main reference for C ++ ... errors happen thank you. Also, my information about 64 Bit system and how to get it and install it was few and maybe I have not worked on it before then ... I will try to correct errors later ... Now I am working on another program ... Thank you.1 point -
Script becomes way slower after a msgbox - (Moved)
seadoggie01 reacted to Musashi for a topic
@Jon : I gladly agree with this statement, and would also like to express my thanks (not only by clicking the LIKE button). There are too many people anyway who complain about what is missing instead of being happy about what is there.1 point -
It's something to do with the /ErrorStdOut line that scite uses but isn't used normally. It's making the script run much faster. So rather than this being an issue with the script slowing down it's actually the script running at "normal" speed and for some reason in the past /ErrorStdOut was making it very fast. But since 1809 that difference is removed, but only if the GUI is triggered. How bizarre. Edit: Ignore that. It's just that running AutoIt3.exe standalone and seeing the "Load Script" dialog triggered the behaviour is what confused me in the debugger.1 point
-
My AutoIt Dev machine is 1809 and I get the issue. x10 slowdown for me. I need simple scripts for tests as ConsoleWrite/complex scripts, etc is no good when running through the debugger - too many libraries and stuff included, so this shows it. ;MsgBox(4096, "Comment me out", "") Local $hTimer = TimerInit() For $i = 1 to 5000000 Next Local $fDiff = TimerDiff($hTimer) MsgBox(4096, "Time Difference", $fDiff) I've got a horrible feeling this is due to AutoIt not having a high dpi manifest as just showing a messagebox doesn't trigger any special code paths, but that will be easy enough to remove to test. But I'm unable to change that from the release version as the GUI functions would be completely broken. Complete tangent but I recently upgraded my work laptop to a Dell XPS 15 with i7 and 32GB ram. Windows 10 and Office is DOG slow. It's a joke how slow excel is. High DPI on windows is a catastrophe. I wish they'd implemented it like the mac does where the application doesn't need to do much, whereas on windows you have to recode the entire app. But maybe it won't be that....1 point
-
IS this by design?
FrancescoDiMuro reacted to Musashi for a topic
Design decisions like this do not cause me any headaches, because it is possible to create practicable workarounds (which has already happened in the past). Everything that the community itself can solve and/or extend by creating new UDFs, usually does not require changes to the AutoIt core. What really worries me (and probably others as well) are effects as described in this thread : script-becomes-way-slower-after-a-msgbox The fact, that the same script (under the described circumstances) suddenly runs 8 times slower due to a Windows 10 update, I consider as a real problem, because it leaves the users virtually helpless. I would like to quote a contribution from @jchd : Just knowing that you would at least be willing to take a look at these problems (in such extreme cases) would certainly be a great relief for many people . Thanks for your attention, and of course for the wonderful AutoIt software as well, Musashi (an old coder measured by years, but still relatively young as a member in the forum) P.S. : If anything I have written sounds disrespectful, misleading or even demanding, then it is entirely unintended (English is not my native language).1 point -
Such workaround is pretty pointless: as soon as a window is shown, the slowdown happens. Global $hGui = GUICreate("Snail", 800, 600) AdlibRegister(timeit, 1000) Func timeit() Local $x Local $t = TimerInit() For $i = 1 To 500000 $x += 1 Next ConsoleWrite(TimerDiff($t) & @LF) EndFunc Sleep(3200) GUISetState(@SW_SHOW) ; *6 slow down on W10 ;~ MsgBox($MB_TASKMODAL, "", "Now look at times in console after me!") ; *6 slow down on W10 ;~ SplashTextOn("", "And during/after splash?") ; doesn't slow things down Sleep(3000) Spooning every GUI operation to a distinct process is impossible to deal with. That simply means AutoIt can become 6 times (for me) up to 10 times (for some other users) faster than it actually is after "showing" any kind of window under W10. That is, all of AutoIt GUI programs (old or current) launched under W10. That's a huge enough reason to drag Jon out of his lockdown cave quickly IMHO (assuming he's still alive). @trancexx help?1 point
-
Ok I've not programmed for a while but this makes no sense. If I run AutoIt3.exe directly then the script runs the same speed with/without a MsgBox. If I run it through scite then there is a massive speed difference. Doubly weird. The fast version in scite is way faster than the standalone versions. How...why...wut?0 points