Leaderboard
Popular Content
Showing content with the highest reputation on 03/31/2020 in all areas
-
Hi guys AutoIt content - Microsoft thinks any AutoIt content is unwanted. What it does is simply delete any EXEs. No option of do you want to continue... The March 2020 updated has substantially changed the Defender Virus Protection logic and layout. I found three pages relevant to the help, and lots of outdated content. Is there a quick and easy way to set folder exclusions? Any help is appreciated and simply using google is not good enough, as this is a new problem, caused by the update. Any ideas please? ____________________________ ANSWER Found it. Accessing the menu through the Control Panel does not work Click the Defender shield in the icon tray. Scroll down to Virus & threat protection settings click Manage Settings Scroll down to Exclusions click Add or remove exclusions then click the + for Add an exclusion, and select File / Folder / File type / Process Select Folder and browse to select. π₯ Skysnake4 points
-
I spent few hours trying to figure out how to get results from the _WinAPI_DragQueryPoint when the script runs on elevated rights with a WM_DROPFILES registered message. I searched everywhere but I wasn't able to find the right message to allow on my GUI. So I finally decided to allow all messages under 0x400, to finally find THE ONE that makes it work. It was really a surprise to find out that it is $WM_NCHITTEST !!! To test you start Windows Explorer and you simply Drag & Drop anywhere into the GUI. If you remove any of the _WinAPI_ChangeWindowMessageFilterEx it will not fully work. Anyway since I was not able to find it on the Web may as well document it here. #include <GUIConstantsEx.au3> #include <WinAPIEx.au3> #include <WindowsConstants.au3> #RequireAdmin Global $hGUI = GUICreate('WM_DROPFILES', 400, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) GUISetState() GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_NCHITTEST, $MSGFLT_ALLOW) _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_DROPFILES, $MSGFLT_ALLOW) _WinAPI_ChangeWindowMessageFilterEx($hGUI, $WM_COPYGLOBALDATA, $MSGFLT_ALLOW) ;_WinAPI_ChangeWindowMessageFilterEx ($hGUI, $WM_COPYDATA, $MSGFLT_ALLOW) ; useless ? While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $lParam Local $aFileList Switch $hWnd Case $hGUI $tPoint = _WinAPI_DragQueryPoint($wParam) $iXpos = DllStructGetData($tPoint, 1) $iYpos = DllStructGetData($tPoint, 2) ConsoleWrite ($iXpos & "/" & $iYpos & @CRLF) $aFileList = _WinAPI_DragQueryFileEx($wParam) If IsArray($aFileList) Then For $i = 1 To $aFileList[0] ConsoleWrite($aFileList[$i] & @CRLF) Next EndIf _WinAPI_DragFinish($wParam) Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_DROPFILES Tested on Win7.2 points
-
This UDF brings the power and flexibility of jq to AutoIt scripts. jq is an open-source, powerful, and flexible command-line based JSON processor. As it says on their website, jq is like 'sed' for JSON. jq can be used for the simplest of tasks like retrieving JSON objects and values (parsing), to very advanced JSON processing using its numerous built-in functions and conditional processing. Its built-in functions can handle math, selection, conditional processing, mapping, object and array manipulation, flattening, reduction, grouping, and much more. You can even create your own jq functions. You can learn more about jq and even play with it in real-time, using jq's online jq playground, all on their website. Here and some helpful links to get you more familiar with jq, what can be done with it, its built-in functions, and its syntax. jq Website: https://jqlang.github.io/jq/ jq Manual: https://jqlang.github.io/jq/manual/ jqWiki (FAQ, Cookbook, Advanced Topics) https://github.com/jqlang/jq/wiki jq is a single 32 or 64 bit executable that has no other dependencies. Just like using the SQLite UDF, the only requirement to use this UDF is that the jq executable reside in a location in which the UDF can execute it. The latest win32 & win64 versions have been included in the UDF download. You can always get newer versions from the jq website. jq at a high level Like 'sed', jq reads JSON in, either through STDIN or one or more files, processes it thru one or more "filters", and outputs the results. You can, optionally, supply "options" that affect how it reads the input, where it gets its "filters", and how it writes its output. It looks a little like this: JSON ---> jq processor (using supplied filters and options) ---> Output So in jq lingo, you basically use "Filters" to tell jq what you want it to do. So in the UDF file, that is why the main functions ( _jqExec() and _jqExecFile() ) refer to filters and options. Please make note that jq works with relatively strict JSON. This means that all JSON read must be conform to the standard. Luckily, jq is pretty good at identifying where a format error exists in non standard JSON. The jq UDF There are 2 main funtions in the UDF file, _jqExec and jqExecFile. With these 2 functions, you can pretty much do anything that jq can do. The only difference between to two functions is whether the JSON is supplied by a string or a file. The 2 primary functions simply call the jq executable with the supplied information, after properly formatting the parameters. There are additional functions in the UDF to easily pretty-print your json, compact-print your json, dump the json data with its associated paths, and see if specific JSON keys exist, but they all just execute the _jqExec or _jqExecFile function with the proper filter. There are also a couple of extra functions to display what version of the UDF and jq executable you are currently using. There are also a couple of functions to enable and disable logging of jq information for debugging purposes. Most of the jq UDF file functions return an @error if unsuccessful. Some also include @extended info. Please see the actual function headers for more information on their usage and return values. The 2 primary functions below just format your jq request and pass it on the jq executable. The functions will also properly escape double quotes (") that are used in the filter. For most simple tasks, you just need to supply the JSON source and a filter. _jqExec($sJson, $sFilter, $sOptions = Default, $sWorkingDir = Default) Or _jqExecFile($sJsonFile, $sFilter, $sOptions = Default, $sWorkingDir = Default) Using jq in your script As stated earlier, the jq executable must reside somewhere where the script can locate and execute it. The _jqInit() function always has to be executed before any jq processing occurs. _jqInit() merely locates the executable or uses the supplied path. It also clears any previous debug log. The jq UDF folder contains a jq example script that has several examples to how to do some of the most common JSON processing tasks. Here are a few examples to get you started: How to pretty-print some JSON #include "jq.au3" ;_jqInit is only needed if the jq executale is not in the PATH or @ScriptDir _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"fruits":[{"Apple":{"color":"Red","season":"Fall"}}, {"Banana":{"color":"Yellow","season":"Summer"}}]}' $sCmdOutput = _jqPrettyPrintJson($sJson) ConsoleWrite(@CRLF & "Pretty-Print JSON" & @CRLF & $sCmdOutput & @CRLF) How to compact-print some JSON #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{ "fruits" : [{"Apple" : {"color":"Red","season":"Fall"}}, {"Banana":{"color":"Yellow","season":"Summer"}}]}' $sCmdOutput = _jqCompactPrintJson($sJson) ConsoleWrite(@CRLF & "Compact-Print JSON" & @CRLF & $sCmdOutput & @CRLF) Dump JSON data (paths and values) #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{ "fruits" : [{"Apple" : {"color":"Red","season":"Fall"}}, {"Banana":{"color":"Yellow","season":"Summer"}}]}' $sCmdOutput = _jqDump($sJson) ConsoleWrite(@CRLF & "Dump JSON paths and values" & @CRLF & $sCmdOutput & @CRLF) How to GET JSON values #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple" : {"color":"Red","season":"Fall"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = '.Banana.color' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Get color of banana" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) or #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple" : {"color":"Red","season":"Fall"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = 'getpath(["Banana", "color"])' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Get color of banana" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) Check for the existence of a key #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple":{"color":"Red","season":"Fall"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = '.Banana | has("color")' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Check for existence of color key within Banana object" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) Count of how many Items in an object #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple":{"color":"Red"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = '.Banana | length' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("How many items in the Banana object" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) How to PUT/Create/Modify JSON #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sInput = "" $sFilter = 'setpath(["Apple","color"];"Red") | setpath(["Banana","color"];"Yellow") | setpath(["Banana","season"];"Summer")' $sOptions = '-n' ;required if no input supplied $sCmdOutput = _jqExec($sInput, $sFilter, $sOptions) ConsoleWrite("Update/Create JSON" & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & @CRLF & $sCmdOutput & @CRLF) List all of the fruits (top-level keys) #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple":{"color":"Red"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = 'keys | .[]' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("List all top-level keys (fruits)" & @CRLF) ConsoleWrite("Input : " & $sJson & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & @CRLF & $sCmdOutput & @CRLF) Calculate the sum of all of the objects' price * qty #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '[{"id":1,"price":20.00,"qty":10},{"id":2,"price":15.00,"qty":20.25},{"id":3,"price":10.50,"qty":30}]' $sFilter = 'map(.price * .qty) | add' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Calculate the sum of all of the objects' price * qty" & @CRLF) ConsoleWrite("Input : " & $sJson & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) The examples above, and the ones in the example files, merely scratch the surface of what jq can do. It may look intimidating at first but it really isn't that bad once you start playing with it. You can find several more examples and play around with them or create your own using jqPlayground. jqPlayground is a separate, stand alone, interactive tool for creating, testing and learning JSON processing using jq. If you have any questions regarding the UDF, or how to perform a certain task using jq, I'll try my best to answer them. Since jq has been around for a while now, there's also several jq-related questions and answers on StackOverflow. >>> Download the UDF in the Files Section <<<1 point
-
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
-
Au3toCmd --- Avoid false virus positives Since many virus scanners sometimes prevent a "compiled autoit EXE" from being executed as "false positive", the "*.A3X" format is a suitable format to avoid this problem. See here for more information. In order to simplify this procedure, I wrote the Au3toCmd script. Here a *.Cmd file is generated from a *.Au3 file. The necessary files Autoit3.exe and *.A3x are added to the "*.Cmd" file as "alternate data streams" "Base64" encoded data. Now the Autoit Script can be called by clicking on the cmd file and the anti-virus scanners do not recognize the "false positive". If the short-term flashing of the CMD window bothers you, you can click the desktop shutcut that runs in a minimized window. Unfortunately, because the "alternate data streams", this CMD file cannot be distributed via FTP or email. Only a USB sti ck or removable disk formatted with NTFS can be used. As the new version now uses Base64 data instead of ADS, this statement is out of date. For reasons of compatibility, the old version was sunk into the spoiler here. The script can be called with a file name of an AU3 script as a parameter. If no name is entered, a query is made. For more information, see the header of the script. Suggestions, improvements and bug reports are welcome. Here the versions using base64 data Version: 2022.05.12 (Support blanks in pathnames) Version: 2022.06.23 (Support release candidates. Changed @CrLf to @Lf. Annual cleaning. Optimized #AutoIt3Wrapper handling) Version: 2022.07.22 (Support scripts with the same name but different content in different directories) Version: 2022.07.27 (Support blanks in usernames) Au3toCmd.au3 Version: 2022.09.01 (Optimized annual cleaning) Au3toCmd.au31 point
-
Incremental search in owner and custom drawn ListViews
pixelsearch reacted to LarsJ for a topic
Incremental search is usually implemented by drawing the background of the substrings that matches the search string with a specific color eg. yellow. Incremental in this context means that the search is performed dynamically after each character while the search string is typed. In a listview this can be implemented by owner drawing through the LVS_OWNERDRAWFIXED flag and WM_DRAWITEM messages. (A custom drawn listview supports coloring of fields. However, the coloring works best for whole fields. This doesn't make it applicable to incremental search.) Inspiration for the example is found in these two questions: Search box for names and Search In ListView (Redraw with matching string). Examples The zip file below contains three examples. Listview items are strings of random characters with different lengths. In all examples a global $iItems = 1000 in top of script specifies the number of rows. There are no performance issues up till 10,000 rows. Note that the search is performed in an array and not directly in the listview. A regular expression can be entered in the search box. Search strings like "m........." with a varying number of dots will result in a varying number of matches. To keep it simple only one occurrence of the search string in each item is tested. As soon as one occurrence is found the search loop moves on to next item. 1) Incremental text search.au3 The first example is a simple demonstration of basic functionality: F3 and Shift+F3 can be used instead of Next and Prev buttons. 2) Show matching rows only.au3 An owner drawn listview can easily be combined with a virtual listview to extend the functionality of the incremental search. A virtual listview is especially interesting if you want to dynamically update the listview to only display the rows that matches the search string. Such an update is very fast in a virtual listview. This example is useful if the listview contains a set of file names and you are searching for a specific file eg. to open the file. In this situation you are probably not interested in the files that doesn't match. Because the listview only contains matching rows "Next match" and "Prev match" buttons are disabled. Clear the search field to display all items. 3) Standard search dialog.au3 The last example is a demonstration of a standard search dialog as the search box in Notepad. FindText function in comdlg32.dll creates the standard search box. The function is implemented as _WinAPI_FindTextDlg in WinAPIDlg.au3. In the Microsoft documentation you can read: Note that the FINDREPLACE structure and the buffer for the search string should be a global or static variable so it does not go out of scope before the dialog box closes. Because the FINDREPLACE structure is created as a local variable in _WinAPI_FindTextDlg it goes out of scope as soon as the function returns. This implementation of FindText is used in the example: ;Func _WinAPI_FindTextDlg($hOwner, $sFindWhat = '', $iFlags = 0, $pFindProc = 0, $lParam = 0) Func _WinAPI_FindTextDlgEx(ByRef $tFR, $hOwner, $sFindWhat = '', $iFlags = 0, $pFindProc = 0, $lParam = 0) $__g_pFRBuffer = __HeapReAlloc($__g_pFRBuffer, 2 * $__g_iFRBufferSize) If @error Then Return SetError(@error + 20, @extended, 0) DllStructSetData(DllStructCreate('wchar[' & $__g_iFRBufferSize & ']', $__g_pFRBuffer), 1, StringLeft($sFindWhat, $__g_iFRBufferSize - 1)) ;Local $tFR = DllStructCreate($tagFINDREPLACE) $tFR = DllStructCreate($tagFINDREPLACE) DllStructSetData($tFR, 'Size', DllStructGetSize($tFR)) DllStructSetData($tFR, 'hOwner', $hOwner) DllStructSetData($tFR, 'hInstance', 0) DllStructSetData($tFR, 'Flags', $iFlags) DllStructSetData($tFR, 'FindWhat', $__g_pFRBuffer) DllStructSetData($tFR, 'ReplaceWith', 0) DllStructSetData($tFR, 'FindWhatLen', $__g_iFRBufferSize * 2) DllStructSetData($tFR, 'ReplaceWithLen', 0) DllStructSetData($tFR, 'lParam', $lParam) DllStructSetData($tFR, 'Hook', $pFindProc) DllStructSetData($tFR, 'TemplateName', 0) Local $Ret = DllCall('comdlg32.dll', 'hwnd', 'FindTextW', 'struct*', $tFR) If @error Or Not $Ret[0] Then Local $Error = @error + 30 __HeapFree($__g_pFRBuffer) If IsArray($Ret) Then Return SetError(10, _WinAPI_CommDlgExtendedErrorEx(), 0) Else Return SetError($Error, @extended, 0) EndIf EndIf Return $Ret[0] EndFunc Then it's ensured that the local variable that is used for $tFR in the script, does not go out of scope, while the search box is open. ListviewIncrSearch.7z 1) Incremental text search.au3 2) Show matching rows only.au3 3) Standard Find text dialog.au3 DrawItem.au3 GuiListViewEx.au3 WinAPIDlgEx.au3 You need AutoIt 3.3.14 or later. Tested on Windows 7 32/64 bit and Windows XP 32 bit. Comments are welcome. Let me know if there are any issues. (Set tab width = 2 in SciTE to line up comments by column.) ListviewIncrSearch.7z1 point -
You could just use a function for example: _UpdateVar($iFound, _ArrayMaxIndex ( $aOccur, 1 )) Func _UpdateVar($_iIndex, $_iValue) Switch $_iIndex Case 0 $iLabel = $_iValue Case 1 $iLocation = $_iValue Case 2 $iOffice = $_iValue Case 3 $iSub_category = $_iValue Case 4 $iAffected_To = $_iValue Case 5 $iManagerial_Unit = $_iValue Case 6 $iMail = $_iValue Case 7 $iMobile_1 = $_iValue Case 8 $iPhone_1 = $_iValue Case 9 $iMobile_2 = $_iValue Case 10 $iPhone_2 = $_iValue EndSwitch EndFunc1 point
-
I suggest to use the approach of a global array as the main place to store the search results. In any of your functions you can extract the needed value to a variable and use this variable for further processing. If you need to alter the variable you need to alter the corresponding cell in the array as well.1 point
-
would it be possible that you at least show us your script?1 point
-
What is it used in the MsgBox ?1 point
-
In my case, it doesn't crash but there is a strange behavior with the GUI. After 31 correct displays, the labels afterward are blank till I click on it. IDK, couldn't find any kind of limitation on MSDN, so I trust it is some kind of a bug with AutoIt. But changing a bit the script now works perfectly for me at 100. Remember to start your For loop at 2 not 1. Replace the beginning of the script with this, see if that works for you : Global $show_panel_1[1][101] Global $hGUI = GUICreate("", 1300, 800, -1, -1) Global $show_input = False Local $left = 10, $topadjust = 0 $show_panel_1[0][1] = GUICtrlCreateLabel("test1", 10, 10, 200, 30) For $i = 2 To 100 $show_panel_1[0][$i] = GUICtrlCreateLabel("test" & $i, $left, ($i + $topadjust -1 ) * 40 + 10, 90, 30) If $i = 20 Or $i = 40 Or $i = 60 Or $i = 80 Then $left = $left + 100 $topadjust = $topadjust - 20 EndIf Next GUISetState() Global $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") Global $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($show_panel_1[0][1]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) For $i = 2 to 100 _WinAPI_SetWindowLong(GUICtrlGetHandle($show_panel_1[0][$i]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) Next1 point
-
You do not store a variable in the array but the VALUE of this variable. In your loop you assign new values to the elements of the array. You do NOT modify the variables.1 point
-
BASS VST HOST
argumentum reacted to ripdad for a topic
I will be doing a minor update with event handling -- probably tomorrow, after I run a dozen tests, to make sure it will hold.1 point -
It serves at calling the normal WindowProc to pursue the message management at the end of your own WindowProc. Well you could add logic to get the $wProcOld the first time and then skip for the other. But it is VERY important that you set $wProcOld only once at the first statement otherwise you will loose the rightful address and you will break the message chain. Not a good idea.1 point
-
Yes, there may be other options, but I can confirm that this works π. Korean text : νκ΅μ΄λ‘ λ²μ ν μμ΄ ν μ€νΈμ λλ€. (hangug-eolo beon-yeog hal yeong-eo tegseuteu-ibnida.) English translation : English text to translate into Korean.1 point
-
Interesting solution1 point
-
@Musashi, I found the solution. Encoding the source text did the trick. $oSC = ObjCreate("ScriptControl") $oSC.language = "Javascript" $g_sMytext = $oSC.eval("encodeURI('" & $g_sMytext & "');")1 point
-
1 point
-
Function sequence
Vikramjeet reacted to TheXman for a topic
If you are just executing a single statement, then you can make it even leaner & cleaner: If $DutyCodeAdd <> "" Then ADDDTY() If $DutyCodeDel <> "" Then DELDTY() If $KeywordsAdd1 <> "" Then ADDKEY() If $KeywordsDel1 <> "" Then DELKEY() π1 point -
Function sequence
Vikramjeet reacted to TheXman for a topic
If <cond1> Then ;do something EndIf If <cond2> Then ;do something EndIf If <cond3> Then ;do something EndIf If <cond4> Then ;do something EndIf Exit or Return1 point -
Invalid FileInstall() function
alienclone reacted to iamtheky for a topic
Based off CheckEE creates a custom exe that fileinstalls only the payload assigned to the variable 'filename'. Some of it unnecessary, Rube Goldberg style. ;~ ;----------------------------------------------------- ;#Local Variables Local $Check_EE ;~ ;----------------------------------------------------- ;~ ;----------------------------------------------------- $Check_EE = "A" ;--- IF $Check_EE == "A" Then assign("filename" , "A.exe") ElseIF $Check_EE == "B" Then assign("filename" , "B.exe") ElseIF $Check_EE == "C" Then assign("filename" , "B.exe") EndIF ;--- $tgtfile = "testfileinstall_writeonfly_" & $Check_EE ; file name based off result of If FileWrite($tgtfile & ".au3" , 'FileInstall("' & @ScriptDir & '\' & eval("filename") & '", "' & @ScriptDir & '\test\' & eval("filename") & '")') ; Write the au3 that does the thing you want runwait("cmd /c " & FileGetShortName(@ProgramFilesDir) & "\AutoIt3\Aut2Exe\Aut2exe.exe /in " & @ScriptDir & "\" & $tgtfile & ".au3") ; compiles that au3 to an exe of the same name in the same dir ;~ run(@ScriptDir & "\" & $tgtfile & ".exe") ; runs that exe1 point -
Please do not PM, I prefer to use the forum. You already mentioned there are tools out there that can do this, but in your PM you said you only wanted to get 2 website passwords, most sites have a "Forgot Password" so they should be able to resend you the passwords, can't they? Also in Google Chrome you should be able to retrieve your passwords or use a password recovery tool see https://www.isunshare.com/internet/recover-or-find-passwords-saved-on-chrome-browser.html so once you have them and you store them in password manager there should be no reason for a script, right? "I think AutoIt Forum's members think that decrypting credentials of Google Chrome is illegal, but there is a lots of free decryption tools for do this job, i want to get my credentials and cookies as what i want." You need to remember that while your intentions might be good, this is a public form and others may use any code on here for bad, which hurts the AutoIt community. Stay safe.1 point
-
Maybe it would be more enlightning to examplify a codepoint which is <= 0xFF in Windows Occidental codepage but >= 0x100 in Unicode. The first example of such is the Euro symbol: MsgBox(0, "", "Today 1 " & Chr(0x80) & " = 2 " & ChrW(0x20AC)) Because AutoIt strings are using [a subset of] Unicode, Chr(0x80) is interpreted as that value in the Windows codepage (Occidental for me) and internally converted to its Unicode counterpart to be stored as string. We then concat the actual Unicode codepoint to show what happens. Meanwhile it immediately doubles the savings of users who actually read to the help file!1 point
-
How to get cookies and download a file with cookies?
tarretarretarre reacted to mikell for a topic
This small code is very raw (no details/error checking etc) but it works for me $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") ; get cookie $oHTTP.Open("GET", "http://www.majorgeeks.com/mg/getmirror/symenu,1.html") $oHTTP.Send() $rh = $oHTTP.GetAllResponseHeaders() $cookie = StringRegExpReplace($rh, '(?s).*SESSID=(\w+).*', "$1") ; msgbox(0,"", $cookie) ; then download $oHTTP.Open("GET", "http://www.majorgeeks.com/index.php?ct=files&action=download&") $oHTTP.setRequestHeader("Cookie", $cookie) $oHTTP.Send() $data = $oHTTP.ResponseBody() FileWrite("symenu.zip", $data)1 point -
Since it hasn't been posted on the forum yet, you won't find mine: https://github.com/MattDiesel/au3-console Example from _Console_Alloc: https://github.com/MattDiesel/au3-console/blob/master/Examples/_Console_Alloc.au3 This UDF is work in progress, but is pretty complete. Probably not the easiest to use as it is more of a direct wrapper over the windows api.1 point
-
Defining String variable using multiple lines in the editor.
nikooo1608 reacted to JRowe for a topic
$string="Should work ..." & @CRLF & _ "like this." MsgBox("","",$string)1 point