Leaderboard
Popular Content
Showing content with the highest reputation on 09/30/2024 in all areas
-
So another vscode extension for the AutoIt language emerges! I've tried the existing ones, and found small problems that i felt i could improve on, but it would require an entire new approach to the inner working of the existing extensions. Also working on a complete AutoIt3 parser a vscode extension just made sense Any feedback is appreciated, and i hope this project will benefit more than just me 🤡 Visual Studio Code Marketplace GitHub repo Some of the current features: Basic AutoIt2 syntax highlighting, for fun 🤡 AutoIt3 syntax highlighting Variable/Function hover gives declaration information if available. Goto declaration #include links Syntax checking, as you type Function signature help Function and variable list in a file via the outline tab. Works on desktop (any OS) and web version ⚠️ The parser used is not yet 100% complete (see issues for know problems), and the last thing to be implemented is the With code block. Hope you like 😃1 point
-
Glad you got the basics to work. Regarding your question, first of all, I'm assuming you already read this part of the FAQ: The answer to your question thus relies on what your target machine(s) is/are. If you're using a hardware signature such as the C drive (or CPU) serial number, your decrypted code will only run if the target environment returns those serials when queried at your script's startup. In other words, the encrypted script is machine-specific and will only run there. But Codecrypter is far more flexible than that. For instance, suppose you only want a group of trusted friends to be able to run your code, then you could use the password option (keyID = 1) and give each of them the secret word or phrase. Or maybe you wish to limit the period of time your code is functional; then you could for example append the current Month and Year macros as your key and distribute as many copies as you like; as soon as the next month starts, all copies will stop working as the decryption no longer produces valid code (of course, if online you could query public internet clocks rather than relying on a machine's internal calendar). On a more advanced level, if you look at the key definitions in function _MCFCC_Init() in MCFinclude.au3, you'll notice that key retrieval is just a function call, and you can just as easily call your own sophisticated functions as relying on the simple examples provided. So suppose you want to set up a licensing system without storing the key in the registry of each machine where you install your programme. Then you could write a little function that instead tries to go online to connect to your own little server (see elsewhere on the forum how to set one up), and queries your database of all your customers that legally bought your software, and if matching the ID sent by your code, the server returns the decryption key(s); if no connection is made, it just produces a message that online connectivity is required for it to work and exits gracefully. Of course this setup does require your server to be online all the time, otherwise your users will get annoyed. Earlier in this thread a user requested a way to get a single, encrypted, portable executable, and they didn't care if the decryption key was discoverable, just to make it difficult enough that the average user would find it too hard to do. In that case, you could consider using the macro @AutoItExe, which returns the full path and filename of the executable of your compiled script (note that the uncompiled encrypted version then won't work(!), as the macro then returns the AutoIt interpreter's full path and name instead, so it would fail when run uncompiled from Scite). I personally wouldn't recommend this, but it's a quick and dirty fix to get some protection. Also note that the decryptor includes the path (unless you remove that part), so if the user decides to move your exeecutable to a different path, it won't work either anymore. These are just examples; your own skill and imagination (and AutoIt's own capabilities) are the only limits on what you can achieve and how to set it up. Simply put: Trusted users? Use a password; trusted/controlled environment? use system specs, hardware IDs, etc. Any other situation? Get creative.1 point
-
n3wbie, Even though we handled this through private messages, for others interested in seeing what jq filters of some complexity look like and can do, I am posting the final filter that provided your desired result set. The jq filter: .gstin as $gstin | # Store gstin .fp as $fp | # Store fp .b2b[] | # For each b2b .ctin as $ctin | # Store ctin .inv[] | # For each inv [ # Output an array of values $gstin, $fp, $ctin, .inum, .idt, .inv_typ, .pos, .val, .itms[].itm_det.txval, .itms[].itm_det.rt, .itms[].itm_det.samt, .itms[].itm_det.camt ] | join("|") # Join each array's elements using "|"1 point
-
Automating GUI Testing With AutoIt - Emmanuel Katto - (Moved)
SOLVE-SMART reacted to Nine for a topic
1- au3info.exe tool for classic Windows applications. If it cannot find controls then you will need to use UIASpy.au3 in UIAutomation 2- depends whether those popups are expected or not. Look for the forum, there is a multitude of examples of it 3- depends on the application. But usually you should see a new control, or a new state, or a new window (any change that is visible and can be monitored) Search the forum with Google to find any snippet that could help you. One good advice I can give you. When you have an issue and want help from the community, you should post code using an application that everyone here has access to (like Notepad). It is quite hard for us to help when we do not own the application you are trying to automate...1 point -
You need to allocate new console to make it work like you intend to. But you can hack with something like this : #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <WinAPIConstants.au3> #include <WindowsConstants.au3> Global $iResp, $hKBHook If Not @Compiled Then Exit MsgBox($MB_OK, "Error", "This script needs to be compiled") Main() Func Main() _WinAPI_AttachConsole() Local $hConsoleOut = _WinAPI_GetStdHandle(1) Local $sMessage = "Enter [y] for deactivating ML-option or [n] for cancel:" & @CRLF _WinAPI_WriteConsole($hConsoleOut, $sMessage) Local $hKBProc = DllCallbackRegister(KeyProc, "long", "int;wparam;lparam") $hKBHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hKBProc), _WinAPI_GetModuleHandle(0)) While Sleep(100) Switch $iResp Case 1, 2 ;MsgBox($MB_OK, "", $iResp = 1 ? "No" : "Yes") _WinAPI_WriteConsole($hConsoleOut, $iResp = 1 ? "No" : "Yes") Send("{ENTER}") ContinueCase Case 3 ExitLoop EndSwitch WEnd _WinAPI_UnhookWindowsHookEx($hKBHook) DllCallbackFree($hKBProc) EndFunc ;==>Main Func KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hKBHook, $nCode, $wParam, $lParam) Local $tKeyHook = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $wParam = $WM_KEYDOWN Then Switch $tKeyHook.vkCode Case 0x59, 0x4E ; y / n $iResp = $tKeyHook.vkCode = 0x4E ? 1 : 2 Return 1 Case 0x0D $iResp = 3 Case Else Return 1 EndSwitch EndIf Return _WinAPI_CallNextHookEx($hKBHook, $nCode, $wParam, $lParam) EndFunc ;==>KeyProc1 point
-
mr-es335, Use my StringSize UDF (link in my sig) to get the width and height of the text you wish to display. M231 point
-
Version v1.7.4
836 downloads
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 Home Page: 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" ;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 = _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. 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.1 point