Jump to content

Nisteo

Active Members
  • Posts

    35
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Nisteo

  1. Opt("SendKeyDelay", 25) Opt("SendKeyDownDelay", 25) ControlSend simulates keystrokes, so technically it sends shift and dash when you want to send underscore. If delay between keystrokes is too short, some keys may not be sent at all.
  2. Nisteo

    Python Code

    https://pypi.org/project/formation-studio/
  3. New laptop has different screen resolution?
  4. Nim, Golang, Python. But JavaScript still best option for this task 🤔
  5. I see 2 undefined functions and 1 wrong macro
  6. Can be used as a night light. Looks better than standard yellow night light in Windows 10.
  7. @mistersquirrle Thank you. My problem was in trailing whitespace 😁 Execute(StringStripWS($sStdIn, 2))
  8. My idea is to run functions interactively from a console window. But "Execute" can never execute, lol. #AutoIt3Wrapper_Change2CUI=y Global $sStdIn, $sExecReturn While 1 $sStdIn = ConsoleRead() If $sStdIn <> "" Then $sExecReturn = Execute($sStdIn) If @error Then MsgBox(16, "Error", "Cannot execute: " & $sStdIn) Else ConsoleWrite($sExecReturn) EndIf EndIf Sleep(10) WEnd If I add quotes like this: Execute('"' & $sStdIn & '"') then "Execute" just returns $sStdIn without executing. Also, if I compile it in GUI mode and pipe STDIN of this script to STDOUT of another non-console application, then everything works as expected. What I'm doing wrong?
  9. They should read the cheat sheet about web development. 🤣🤣🤣
  10. @SOLVE-SMART I found a mini bug, lol 😂 If you copy-paste one of the example strings, then syntax checker will throw an error. Because there are some invisible characters between the quotes.
  11. @SOLVE-SMART But in help file I found this: Not ("string1" == "string2") 🤔
  12. I continued my silly experiments. I compiled a python extension (PYD) using the Nim language (Nim has a Python-like syntax, which is good). Then I called python from autoit and imported this compiled extension. mymodule.nim: import nimpy proc hello: string {.exportpy.} = return "Hello World from Python compiled extension" autoit: $py = ObjCreate("Python.Interpreter") $py.exec("import sys") $py.exec("sys.path.insert(0, 'D:\\AutoIt Scripts\\Examples\\Nimpy_Demonstration')") $py.exec("import mymodule") $py.exec("hello = mymodule.hello()") $hello = $py.eval("hello") MsgBox(64, "", $hello)
  13. #include <File.au3> _FileReadToArray() This func from standart library supports 2D arrays, btw 🤔
  14. Wiki page: https://en.wikipedia.org/wiki/Invidious Website: https://invidious.io/ API docs: https://docs.invidious.io/api/ By sending requests to Invidious API, you can get various information about YouTube videos, such as title, description, subtitles, available formats, direct links, and much more. #include "JSON.au3" ;URL for sorted JSON list of API instances Const $INVAPI_INSTANCE_LIST_URL = "https://api.invidious.io/instances.json?sort_by=type,api,users" ;Get list of API instances $sResponse = BinaryToString(InetRead($INVAPI_INSTANCE_LIST_URL)) ;Parse response and get first URL from list $sFirstInstanceURL = (_JSON_Parse($sResponse)[0])[1].uri ;API request Const $TEST_YOUTUBE_VIDEO_ID = "aqz-KE-bpKQ" $sResponse = BinaryToString(InetRead($sFirstInstanceURL & "/api/v1/videos/" & $TEST_YOUTUBE_VIDEO_ID & "?fields=videoId,title,description")) ;Parse response and output it $JsonData = _JSON_Parse($sResponse) MsgBox(64, "Info", _ "Video ID: <" & ($JsonData).videoId & ">" & @CRLF & @CRLF & _ "Title: <" & ($JsonData).title & ">" & @CRLF & @CRLF & _ "Description: <" & ($JsonData).description & ">") For this example I used AspirinJunkie's JSON UDF.
  15. $py = ObjCreate("Python.Interpreter") $py.exec("import wikipedia") $py.exec('autoit = wikipedia.page("AutoIt").summary') $sAuWikiSum = $py.eval("autoit") MsgBox(64, "Important info", $sAuWikiSum)
  16. https://en.wikipedia.org/wiki/Logical_conjunction $hTimer = TimerInit() While BitAND(WinExists("[CLASS:Notepad]"), TimerDiff($hTimer) < 30000) ;This loop will exit after 30 sec or if you close notepad window earlier Sleep(10) WEnd
  17. Shouldn't the second parameter for GetCurrentPropertyValue be boolean?
  18. When you compile an AutoIt script in CUI mode, the output of all console applications launched from this script occurs in the same window. So you need to run things from AutoIt, not from batch. #AutoIt3Wrapper_Change2CUI=y Run("start /wait test.exe")
  19. This simple script installs all Visual C Redistributables (2005, 2008, 2010, 2012, 2013, 2015+ both 32 and 64 bit) on Windows 10/11 x64 via winget utility. Flag "--force" helps avoid a bug when version checker of winget doesn't see difference between 32 and 64 bit versions of packages. Warning: some special editions of Windows (like Windows 10 Enterprise LTSC) are distributed without winget. #include <String.au3> $STR = "2005.x86,2005.x64,2008.x86,2008.x64,2010.x86,2010.x64,2012.x86,2012.x64,2013.x86,2013.x64,2015+.x86,2015+.x64" $aVersion = _StringExplode($STR, ",") For $i = 0 To UBound($aVersion) - 1 Sleep(250) RunWait("winget install Microsoft.VCRedist." & $aVersion[$i] & " --force") Next
  20. I have a crazy idea. Python has alternative implementations, right? What if we will use something like PyPy instead of standard Python? PyPy supports JIT compilation and runs multiple times faster, but I've never used it before 🤔
  21. I still don't see the point why not just using machine code for all actions instead of creating compilers and interpreters and billion programming languages and transpilers from one language to another and interpreted versions of compiled languages and compiled versions of interpreted languages and more and more... 🤣 For example, people using IronPython instead of C#, Cython instead of C, Brython instead of JavaScript, Jython instead of Java, etc, etc, etc... Because python is language mainly for non-qualified programmers like scientists or home linux users or something. Mixing easier and harder languages allows people to do complex things right now, instead of wasting 100 years for learning C and another 100 for debugging "Hello World" program. By the same logic, learning few functions from Python and calling them from Autoit is easier task, than learning whole Python. Rapid development, you know 😎
  22. This? 🤣 Joking aside, the most important thing for me so far is converting JSON to a dictionary. You can get data from Python (by using "eval" method), but you can't send the result of executing a function or variable from AutoIt to Python for some reason. Let's get some values from the beginning of this json https://api.invidious.io/instances.json?pretty=1 $py = ObjCreate("Python.Interpreter") $py.exec("from requests import get") $py.exec("from json import loads") $py.exec("INVIDIOUS_API = 'https://api.invidious.io/instances.json'") $py.exec("json_data = loads(get(INVIDIOUS_API).content)") ;Print "yewtu.be" ConsoleWrite($py.eval("json_data[0][0]") & @CRLF) ;Attempt to print Netherlands flag icon :D ConsoleWrite($py.eval('json_data[0][1]["flag"]') & @CRLF) ;Print "NL" ConsoleWrite($py.eval('json_data[0][1]["region"]') & @CRLF) ;Print "2.0" ConsoleWrite($py.eval('json_data[0][1]["stats"]["version"]') & @CRLF) ;Print "invidious" ConsoleWrite($py.eval('json_data[0][1]["stats"]["software"]["name"]') & @CRLF) ;Print "2023.02.14-d24b60c" ConsoleWrite($py.eval('json_data[0][1]["stats"]["software"]["version"]') & @CRLF) ;Print "master" ConsoleWrite($py.eval('json_data[0][1]["stats"]["software"]["branch"]') & @CRLF)
  23. Python has dictionaries, and you can convert JSON with a billion lines into a dictionary with a flick of your finger. Just "json.loads()" and that's it. In the case of AutoIt, you have to spend time writing your own parser, and then SUDDENLY discover that AutoIt's execution speed does not allow you to write really good parsers for huge JSON at all. Even for small JSON, perhaps. 🤣 And this is a disaster, because JSON is everywhere these days.
×
×
  • Create New...