├── test ├── .gitignore ├── header-2.au3 ├── unittest-netinterop.au3 ├── unittest-netinterop-syntax.au3 ├── program1.au3 ├── hello-world.au3 ├── program3.au3 ├── unittest-static.au3 ├── unittest-scoping.au3 ├── UnitTests │ ├── Program.cs │ ├── DataTypes │ │ ├── NumberTester.cs │ │ └── StringTester.cs │ └── UnitTests.csproj ├── header-1.au3 ├── unittest-multithreading.au3 ├── unittest-byref.au3 ├── cpp-interop-test │ ├── cpp-interop-test.cpp │ └── cpp-interop-test.vcxproj.filters ├── unittest-cached.au3 ├── test.au3 ├── unittest-vartypes.au3 ├── unittest-loop.au3 ├── unittest-conversions.au3 └── unittest-stringformat.au3 ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ ├── feature_request.md │ └── bug_report.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── FUNDING.yml ├── src ├── AutoItInterpreter │ ├── .gitattributes │ ├── version.txt │ ├── Include │ │ ├── MathConstants.au3 │ │ ├── SendMessage.au3 │ │ ├── Array.au3 │ │ ├── String.au3 │ │ ├── WinNet.au3 │ │ ├── GuiRichEdit.au3 │ │ ├── Math.au3 │ │ ├── ExcelConstants.au3 │ │ ├── _ReadMe_.txt │ │ ├── SQLite.dll.au3 │ │ ├── ScrollBarConstants.au3 │ │ ├── APIComConstants.au3 │ │ ├── GUIConstants.au3 │ │ ├── DirConstants.au3 │ │ ├── UpDownConstants.au3 │ │ ├── InetConstants.au3 │ │ ├── IPAddressConstants.au3 │ │ ├── ProcessConstants.au3 │ │ ├── WinAPI.au3 │ │ ├── AVIConstants.au3 │ │ ├── WinAPIEx.au3 │ │ ├── ImageListConstants.au3 │ │ ├── APIConstants.au3 │ │ ├── APIMiscConstants.au3 │ │ ├── ScrollBarsConstants.au3 │ │ ├── StaticConstants.au3 │ │ ├── ProgressConstants.au3 │ │ ├── FrameConstants.au3 │ │ ├── BorderConstants.au3 │ │ ├── MemoryConstants.au3 │ │ ├── ColorConstants.au3 │ │ ├── TrayConstants.au3 │ │ ├── StringConstants.au3 │ │ ├── APIDiagConstants.au3 │ │ ├── StatusBarConstants.au3 │ │ ├── APIShPathConstants.au3 │ │ ├── FontConstants.au3 │ │ ├── Process.au3 │ │ ├── MsgBoxConstants.au3 │ │ ├── SliderConstants.au3 │ │ ├── GUIConstantsEx.au3 │ │ ├── ButtonConstants.au3 │ │ ├── APIRegConstants.au3 │ │ └── Constants.au3 │ ├── Properties │ │ └── launchSettings.json │ ├── autoit3 │ ├── Runtime │ │ ├── GUIConnector.cs │ │ ├── WinAPIConnector.cs │ │ ├── Metadata.cs │ │ ├── ParserProvider.cs │ │ ├── FunctionCache.cs │ │ ├── Variable.cs │ │ ├── TimerManager.cs │ │ ├── Macro.cs │ │ ├── FunctionReturnValue.cs │ │ └── StringFormatter.cs │ ├── GlobalSuppressions.cs │ ├── EntryPoint.cs │ ├── Extensibility │ │ ├── Plugins.Au3Framework.Directives.cs │ │ ├── Plugins.UDF.Functions │ │ │ ├── SendMessageFunctions.cs │ │ │ └── MathFunctions.cs │ │ ├── Plugins.NETInterop.cs │ │ ├── Plugins.Au3Framework.AdditionalFunctions.cs │ │ ├── Plugins.Internals.cs │ │ └── Plugins.Threading.cs │ ├── app.manifest │ ├── AssemblyInfo.cs │ └── AutoItInterpreter.csproj ├── util │ ├── AutoIt3.COM.Server │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── COMInterfaces.cs │ │ └── AutoIt3.COM.Server.csproj │ ├── AutoIt3.Updater │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── AutoIt3.Updater.csproj │ │ └── Updater.cs │ ├── VersionIncrementer │ │ └── VersionIncrementer.csproj │ ├── COMInterop │ │ └── COMInterop.csproj │ ├── AutoIt3.WinAPI.Server │ │ ├── WinAPIServer.cs │ │ └── AutoIt3.WinAPI.Server.csproj │ └── AutoIt3.Common │ │ ├── AutoIt3.Common.csproj │ │ └── Extensions.cs ├── AutoItParser │ ├── Util.fs │ ├── DLLStructParser.AST.fs │ ├── AutoItParser.fsproj │ └── ParsingUtil.fs └── plugins │ ├── Plugin.Au3Framework.WindowsSpecific │ ├── Plugin.Au3Framework.WindowsSpecific.csproj │ └── WindowsSpecificMacros.cs │ └── Plugins.Serial │ ├── Plugin.Serial.csproj │ └── SerialFunctionProvider.cs ├── artwork ├── icon.png ├── AutoIt.aep ├── banner.png ├── banner-features.png ├── operating-systems.png └── works-on-my-machine.png ├── lib ├── Piglet.dll ├── Piglet.FSharp.dll ├── Piglet.deps.json └── Piglet.FSharp.deps.json ├── .gitmodules ├── generate_docs.bat ├── CONTRIBUTING.md ├── appveyor.yml ├── CODE_OF_CONDUCT.md ├── readme.md └── .gitattributes /test/.gitignore: -------------------------------------------------------------------------------- 1 | NPCBrainibot.au3 -------------------------------------------------------------------------------- /test/header-2.au3: -------------------------------------------------------------------------------- 1 | 2 | $top = "kek" - 1 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/.gitattributes: -------------------------------------------------------------------------------- 1 | autoit3 text eol=lf 2 | 3 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/version.txt: -------------------------------------------------------------------------------- 1 | 0.12.2466.8669 2 | c94261c5816f150e0db43bd84555b6af69cd3a15 -------------------------------------------------------------------------------- /artwork/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/artwork/icon.png -------------------------------------------------------------------------------- /lib/Piglet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/lib/Piglet.dll -------------------------------------------------------------------------------- /artwork/AutoIt.aep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/artwork/AutoIt.aep -------------------------------------------------------------------------------- /artwork/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/artwork/banner.png -------------------------------------------------------------------------------- /lib/Piglet.FSharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/lib/Piglet.FSharp.dll -------------------------------------------------------------------------------- /artwork/banner-features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/artwork/banner-features.png -------------------------------------------------------------------------------- /test/unittest-netinterop.au3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/test/unittest-netinterop.au3 -------------------------------------------------------------------------------- /artwork/operating-systems.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/artwork/operating-systems.png -------------------------------------------------------------------------------- /artwork/works-on-my-machine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/artwork/works-on-my-machine.png -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/MathConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; This file has been internalized for perfomance reasons 4 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/SendMessage.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; This file has been internalized for perfomance reasons 4 | -------------------------------------------------------------------------------- /test/unittest-netinterop-syntax.au3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/test/unittest-netinterop-syntax.au3 -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/Array.au3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/src/AutoItInterpreter/Include/Array.au3 -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/String.au3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/src/AutoItInterpreter/Include/String.au3 -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/WinNet.au3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/src/AutoItInterpreter/Include/WinNet.au3 -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/GuiRichEdit.au3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/src/AutoItInterpreter/Include/GuiRichEdit.au3 -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/Math.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | #include "MathConstants.au3" 3 | 4 | ; This file has been internalized for perfomance reasons 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "AutoIt-Interpreter.wiki"] 2 | path = AutoIt-Interpreter.wiki 3 | url = https://github.com/unknown6656/AutoIt-Interpreter.wiki.git 4 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ExcelConstants.au3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unknown6656/AutoIt-Interpreter/HEAD/src/AutoItInterpreter/Include/ExcelConstants.au3 -------------------------------------------------------------------------------- /test/program1.au3: -------------------------------------------------------------------------------- 1 | ; #include "http://155.94.137.18/files/AutoIT/DNS%20Client.au3" 2 | ; #include 3 | 4 | DebugCallFrame() -------------------------------------------------------------------------------- /test/hello-world.au3: -------------------------------------------------------------------------------- 1 | ConsoleWrite("Hello World!" & @CRLF) 2 | PrintOS() 3 | 4 | Func PrintOS() 5 | ConsoleWrite(@OSVERSION & " (Version " & @OSBUILD & ")" & @CRLF) 6 | EndFunc 7 | -------------------------------------------------------------------------------- /generate_docs.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | mkdir "%~f0/../bin/docs/config" 3 | %~f0/../util/NaturalDocs/NaturalDocs.exe -i "%~f0/../AutoItInterpreter" -p "%~f0/../bin/docs/config" -o HTML "%~f0/../bin/docs" %* -------------------------------------------------------------------------------- /src/util/AutoIt3.COM.Server/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "COMObjectServer": { 4 | "commandName": "Project", 5 | "commandLineArgs": "succ_my_pipe" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/AutoItInterpreter/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "AutoItInterpreter": { 4 | "commandName": "Project", 5 | "commandLineArgs": "-mi", 6 | "nativeDebugging": false 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /test/program3.au3: -------------------------------------------------------------------------------- 1 | 2 | ConsoleWrite("0") 3 | if True Then 4 | ConsoleWrite("b") 5 | #OnAutoItStartRegister "test" 6 | ConsoleWrite("a") 7 | EndIf 8 | ConsoleWrite("1") 9 | 10 | 11 | Func test() 12 | ConsoleWrite("test") 13 | EndFunc 14 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/_ReadMe_.txt: -------------------------------------------------------------------------------- 1 | This directory contains pre-written functions for use in your AutoIt scripts. 2 | 3 | Include the functions using: 4 | 5 | #include 6 | 7 | See the help file for details of the functions, or read the .au3 directly. -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # [Title my pull request] 2 | 3 | [description of the changes that I have made] 4 | 5 | 6 | -------------------- 7 | - [ ] I hereby confirm that I have read through (and followed) the [contribution guide](https://github.com/Unknown6656/AutoIt-Interpreter/wiki/Contributing). 8 | -------------------------------------------------------------------------------- /src/util/AutoIt3.Updater/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "AutoIt3.Updater": { 4 | "commandName": "Project", 5 | "commandLineArgs": "True L:\\Projects.VisualStudio\\AutoItInterpreter\\new\\bin update-0-6-1581-7352-- 0 L:\\Projects.VisualStudio\\AutoItInterpreter\\new\\bin\\autoit3.dll --version" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/SQLite.dll.au3: -------------------------------------------------------------------------------- 1 | ; Inline sqlite3.dll, Creation Time: 2018/01/23 07:36:31 2 | #include-once 3 | Func __SQLite_Inline_Modified() 4 | Return "20180123073631" ; 2018/01/23 07:36:31 5 | EndFunc ;==>__SQLite_Inline_Modified 6 | Func __SQLite_Inline_Version() 7 | Return "302200000" ; 3.22.0.0 8 | EndFunc ;==>__SQLite_Inline_Version 9 | -------------------------------------------------------------------------------- /test/unittest-static.au3: -------------------------------------------------------------------------------- 1 | #cs 2 | SCRIPT FOR UNIT-TESTING THE INTERPRETER 3 | 4 | THE INTERPERETER OUTPUT SHOULD BE: 5 | 1 6 | 2 7 | 3 8 | 4 9 | 5 10 | 6 11 | #ce 12 | 13 | func static_test() 14 | static $i = 0 15 | $i += 1 16 | ConsoleWrite($i & @CRLF) 17 | endfunc 18 | 19 | for $x = 0 to 5 20 | static_test() 21 | next 22 | -------------------------------------------------------------------------------- /test/unittest-scoping.au3: -------------------------------------------------------------------------------- 1 | Dim $u = "U" 2 | Local $v = "V" 3 | Global $w = "W" 4 | Dim $x = "X" 5 | 6 | Func DoNotModifyGlobals() 7 | Local $u = "A" 8 | Local $v = "B" 9 | Local $w = "C" 10 | local $arr =[1,2,3] 11 | for $x in $arr 12 | next 13 | DebugAllVarsCompact() 14 | EndFunc 15 | 16 | DebugAllVarsCompact() 17 | DoNotModifyGlobals() 18 | DebugAllVarsCompact() 19 | 20 | -------------------------------------------------------------------------------- /test/UnitTests/Program.cs: -------------------------------------------------------------------------------- 1 | using Unknown6656.Testing; 2 | 3 | #if FORCE_USE_UNKNOWN6656_TEST_FRAMEWORK 4 | using System.Runtime.CompilerServices; 5 | 6 | namespace Unknown6656.AutoIt3.Testing; 7 | 8 | 9 | public static class Program 10 | { 11 | [ModuleInitializer] 12 | public static void Main() => UnitTestRunner.RunTests(); 13 | } 14 | #else 15 | UnitTestRunner.RunTests(); 16 | #endif 17 | -------------------------------------------------------------------------------- /test/header-1.au3: -------------------------------------------------------------------------------- 1 | 2 | Dim $arr[1] = [3], _ 3 | $brr[2][2] = [[1, 2], [3, 4]], _ 4 | $crr[3][2][1] = [[[1], [2]], [[3], [4]], [[5], [6]]], _ 5 | $d = 0, _ 6 | $e = @time, _ 7 | $f = "0x900" 8 | 9 | Global Const $TEST__01 = "top kek", _ 10 | $TEST__02 = "/foo/bar", _ 11 | $TEST__03 = "..NOPE.." 12 | 13 | ReDim $brr[1][2] 14 | 15 | #include "header-2.au3" 16 | -------------------------------------------------------------------------------- /test/unittest-multithreading.au3: -------------------------------------------------------------------------------- 1 | dim $threads[10] 2 | 3 | for $j = 0 to 9 4 | $threads[$j] = ThreadStart(my_func) 5 | next 6 | 7 | my_func() 8 | DebugAllVarsCompact() 9 | 10 | for $j = 0 to 9 11 | ThreadWait($threads[$j]) 12 | next 13 | 14 | func my_func() 15 | $id = ThreadGetID() 16 | 17 | for $i = 0 to 100 step 1 18 | ConsoleWriteLine('thread no. ' & $id & ': ' & $i) 19 | next 20 | endfunc 21 | -------------------------------------------------------------------------------- /src/AutoItParser/Util.fs: -------------------------------------------------------------------------------- 1 | namespace Unknown6656.AutoIt3.Parser 2 | 3 | 4 | type Associativity = 5 | | Left 6 | | Right 7 | 8 | [] 9 | module Util = 10 | let inline (?) a b c = if a then b else c 11 | 12 | let inline (|>>) (a, b) f = f a, f b 13 | 14 | let inline (|>>>) (a, b, c) f = f a, f b, f c 15 | 16 | let (|As|_|) (p:'T) : 'U option = 17 | let p = p :> obj 18 | if p :? 'U then Some (p :?> 'U) else None 19 | -------------------------------------------------------------------------------- /test/unittest-byref.au3: -------------------------------------------------------------------------------- 1 | #cs 2 | SCRIPT FOR UNIT-TESTING THE INTERPRETER 3 | 4 | THE INTERPERETER OUTPUT SHOULD BE: 5 | 42 -1 6 | -1 42 7 | #ce 8 | 9 | func swap(byref $x, byref $y) 10 | dim $tmp = $x 11 | ; DebugAllVarsCompact() 12 | $x = $y 13 | $y = $tmp 14 | ; DebugAllVarsCompact() 15 | endfunc 16 | 17 | Dim $a = 42, $b = -1 18 | 19 | ConsoleWrite($a&" "&$b&@CRLF) 20 | swap($a, $b) 21 | ConsoleWrite($a&" "&$b&@CRLF) 22 | swap(42, -88) -------------------------------------------------------------------------------- /test/UnitTests/DataTypes/NumberTester.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | using Unknown6656.AutoIt3.Runtime; 4 | using Unknown6656.Testing; 5 | 6 | namespace Unknown6656.AutoIt3.Testing.DataTypes; 7 | 8 | 9 | [TestClass] 10 | internal class NumberTester 11 | : UnitTestRunner 12 | { 13 | //[TestMethod, TestWith(0, -420.736, double.MaxValue, double.MinValue, double.Epsilon, 77, Math.PI)] 14 | 15 | // TODO : add test cases 16 | } 17 | -------------------------------------------------------------------------------- /test/cpp-interop-test/cpp-interop-test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | extern "C" __declspec(dllexport) int32_t __cdecl add(int32_t a, int32_t b) 5 | { 6 | return a + b; 7 | } 8 | 9 | extern "C" __declspec(dllexport) void __cdecl say_hello(void) 10 | { 11 | printf("Hello World from C++!\n"); 12 | } 13 | 14 | 15 | extern "C" __declspec(dllexport) int main(const int argc, const char** argv) 16 | { 17 | std::cout << "Hello World!\n"; 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" 9 | directory: "/new/" 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /lib/Piglet.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v3.1", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v3.1": { 9 | "Piglet/1.6.0": { 10 | "runtime": { 11 | "Piglet.dll": {} 12 | } 13 | } 14 | } 15 | }, 16 | "libraries": { 17 | "Piglet/1.6.0": { 18 | "type": "project", 19 | "serviceable": false, 20 | "sha512": "" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/AutoItInterpreter/autoit3: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if ! command -v dotnet > /dev/null 2>&1 ; then 4 | COL_RED='\033[0;31m' 5 | COL_RESET='\033[0m' 6 | 7 | echo "${COL_RED}" 8 | echo "--------------------------------------------------" 9 | echo "Command 'dotnet' not found. Go to https://dot.net" 10 | echo " to install the .NET Core runtime." 11 | echo "--------------------------------------------------" 12 | echo "${COL_RESET}" 13 | 14 | exit 1 15 | else 16 | dotnet autoit3.dll "$@" 17 | fi 18 | -------------------------------------------------------------------------------- /src/util/VersionIncrementer/VersionIncrementer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net8.0 5 | incr 6 | true 7 | enable 8 | true 9 | $(SolutionDir)bin-util 10 | VersionIncrementer.Program 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/util/COMInterop/COMInterop.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard2.0 4 | $(SolutionDir)bin 5 | preview 6 | enable 7 | autoit3.com 8 | Unknown6656.AutoIt3.COM 9 | Library 10 | true 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ScrollBarConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | #include "ScrollbarsConstants.au3" 4 | 5 | ; #INDEX# ======================================================================================================================= 6 | ; Title .........: ScrollBar_Constants 7 | ; AutoIt Version : 3.3.14.5 8 | ; Language ......: English 9 | ; Description ...: Kept for compatibility with old naming. 10 | ; Author(s) .....: jpm 11 | ; =============================================================================================================================== 12 | -------------------------------------------------------------------------------- /src/util/AutoIt3.COM.Server/COMInterfaces.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using System; 3 | 4 | namespace Unknown6656.AutoIt3.COM.Server; 5 | 6 | [ComImport, Guid("0000010c-0000-0000-c000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 7 | public interface IPersist 8 | { 9 | [PreserveSig] 10 | void GetClassID(out Guid pClassID); 11 | } 12 | 13 | internal static unsafe class NativeInterop 14 | { 15 | [DllImport("ole32.dll")] 16 | public static extern int ProgIDFromCLSID([In] Guid* clsid, [MarshalAs(UnmanagedType.LPWStr)] out string? lplpszProgID); 17 | } 18 | -------------------------------------------------------------------------------- /src/util/AutoIt3.Updater/AutoIt3.Updater.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | 5 | net8.0 6 | $(SolutionDir)bin 7 | true 8 | preview 9 | enable 10 | Unknown6656.AutoIt3.Updater 11 | autoit3.updater 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/util/AutoIt3.WinAPI.Server/WinAPIServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Unknown6656.AutoIt3.Runtime.ExternalServices; 4 | 5 | namespace Unknown6656.AutoIt3.WinAPI.Server; 6 | 7 | public sealed class WinAPIServer 8 | : ExternalServiceProvider 9 | { 10 | protected override void OnStartup(string[] argv) 11 | { 12 | } 13 | 14 | protected override void MainLoop(ref bool shutdown) 15 | { 16 | } 17 | 18 | protected override void OnShutdown(bool external_request) 19 | { 20 | } 21 | 22 | public static int Main(string[] argv) => Run(argv); 23 | } 24 | -------------------------------------------------------------------------------- /test/cpp-interop-test/cpp-interop-test.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Source Files 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/util/AutoIt3.Common/AutoIt3.Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Library 4 | net8.0 5 | $(SolutionDir)bin 6 | preview 7 | enable 8 | autoit3.common 9 | Unknown6656.AutoIt3.Common 10 | true 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/GUIConnector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Unknown6656.AutoIt3.Runtime.ExternalServices; 4 | using Unknown6656.AutoIt3.Localization; 5 | using Unknown6656.AutoIt3.CLI; 6 | 7 | namespace Unknown6656.AutoIt3.Runtime; 8 | 9 | public sealed class GUIConnector 10 | : ExternalServiceConnector 11 | { 12 | public override string ChannelName { get; } = "GUI"; 13 | 14 | 15 | public GUIConnector(Interpreter interpreter) 16 | : base(MainProgram.GUI_CONNECTOR, true, interpreter, interpreter.CurrentUILanguage) 17 | { 18 | } 19 | 20 | protected override void BeforeShutdown() 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/WinAPIConnector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Unknown6656.AutoIt3.Runtime.ExternalServices; 4 | using Unknown6656.AutoIt3.Localization; 5 | using Unknown6656.AutoIt3.CLI; 6 | 7 | namespace Unknown6656.AutoIt3.Runtime; 8 | 9 | public sealed class WinAPIConnector 10 | : ExternalServiceConnector 11 | { 12 | public override string ChannelName { get; } = "Win32"; 13 | 14 | 15 | public WinAPIConnector(Interpreter interpreter) 16 | : base(MainProgram.WINAPI_CONNECTOR, false, interpreter, interpreter.CurrentUILanguage) 17 | { 18 | } 19 | 20 | protected override void BeforeShutdown() 21 | { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [unknown6656] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /src/util/AutoIt3.WinAPI.Server/AutoIt3.WinAPI.Server.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net8.0 5 | $(SolutionDir)bin 6 | true 7 | preview 8 | enable 9 | Unknown6656.AutoIt3.WinAPI.Server 10 | autoit3.win32apiserver 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ### There are only a few rules: 2 | 3 | 1) The code must compile on all major platforms (Windows, Linux, MacOS, ...) 4 | 2) The code must work **and** AutoIt3 must be compilable with your additions 5 | 3) **DO NOT BREAK THE EXPRESSION PARSER** - This shit is costing me countless sleepless nights
6 | Feel free to contribute to it, **DO NOT BREAK IT** or I'll going to kill you! 7 | 4) Document your features/bug fixes in the appropriate markdown document 8 | 5) **USE ALLMAN FORMATTING AND INDENTATION STYLE**.
9 | Any contribution in some other style will not be accepted. 10 | 11 | ...and... 12 | 13 | 6) Do not get brain cancer from the existing code base 14 | -------------------------------------------------------------------------------- /src/util/AutoIt3.COM.Server/AutoIt3.COM.Server.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | 5 | net8.0 6 | $(SolutionDir)bin 7 | true 8 | preview 9 | enable 10 | Unknown6656.AutoIt3.COM.Server 11 | autoit3.comserver 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /test/unittest-cached.au3: -------------------------------------------------------------------------------- 1 | Func fib_1($a) 2 | If $a < 2 Then 3 | Return $a 4 | Else 5 | Return fib_1($a - 2) + fib_1($a - 1) 6 | EndIf 7 | EndFunc 8 | 9 | 10 | Cached Func fib_2($a) 11 | If $a < 2 Then 12 | Return $a 13 | Else 14 | Return fib_2($a - 2) + fib_2($a - 1) 15 | EndIf 16 | EndFunc 17 | 18 | 19 | Func measure($f, $a) 20 | $watch = NETNew("System.Diagnostics.Stopwatch") 21 | $watch.Start() 22 | 23 | Call($f, $a) 24 | 25 | $watch.Stop() 26 | return $watch.ElapsedMilliseconds 27 | EndFunc 28 | 29 | 30 | const $fib_depth = 6 31 | 32 | ConsoleWriteLine("not cached: " & measure(fib_1, $fib_depth) & "ms") 33 | ConsoleWriteLine(" cached: " & measure(fib_2, $fib_depth) & "ms") 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/AutoItParser/DLLStructParser.AST.fs: -------------------------------------------------------------------------------- 1 | module Unknown6656.AutoIt3.Parser.DLLStructParser.AST 2 | 3 | 4 | type CALL_CONVENTION = 5 | | Cdecl 6 | | Stdcall 7 | | Fastcall 8 | | Thiscall 9 | | WinAPI 10 | 11 | type TYPE = 12 | | U0 13 | | U8 14 | | U16 15 | | U32 16 | | U64 17 | | I16 18 | | I32 19 | | I64 20 | | R32 21 | | R64 22 | | R128 23 | | STR 24 | | WSTR 25 | | PTR 26 | | Struct // TODO 27 | | Composite of TYPE list 28 | // TODO : pointer? 29 | 30 | type ANNOTATED_TYPE = 31 | { 32 | Type : TYPE 33 | CallConvention : CALL_CONVENTION 34 | } 35 | 36 | type SIGNATURE = 37 | { 38 | ReturnType : ANNOTATED_TYPE 39 | ParameterTypes : TYPE[] 40 | } 41 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | [assembly: SuppressMessage("Style", "IDE1006")] // Naming Styles 4 | [assembly: SuppressMessage("Microsoft.Naming", "CA1707")] // Naming Styles 5 | [assembly: SuppressMessage("Interoperability", "CA1401")] // P/Invokes should not be visible 6 | [assembly: SuppressMessage("Performance", "CA1810")] // Initialize reference type static fields inline 7 | [assembly: SuppressMessage("Globalization", "CA1303")] // Do not pass literals as localized parameters 8 | [assembly: SuppressMessage("Design", "CA1031")] // Do not catch general exception types 9 | [assembly: SuppressMessage("Performance", "CA1819")] // Properties should not return arrays 10 | [assembly: SuppressMessage("Performance", "CA1805")] // Do not initialize unnecessarily 11 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/EntryPoint.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Text; 3 | using System; 4 | 5 | using Unknown6656.AutoIt3.CLI; 6 | 7 | 8 | /* 9 | The application's entry point. The actual code logic can be found in the file 10 | ./CommandLineInterface/MainProgram.cs 11 | */ 12 | try 13 | { 14 | return MainProgram.Start(args); 15 | } 16 | #pragma warning disable CA1031 // WARNING: Do not catch general exception types 17 | catch (Exception? ex) 18 | when (!Debugger.IsAttached) 19 | #pragma warning restore 20 | { 21 | StringBuilder sb = new(); 22 | int code = ex.HResult; 23 | 24 | while (ex is { }) 25 | { 26 | sb.Insert(0, $"[{ex.GetType()}] ({ex.HResult:x8}h) {ex.Message}:\n{ex.StackTrace}\n"); 27 | ex = ex.InnerException; 28 | } 29 | 30 | Console.Error.WriteLine(sb); 31 | 32 | return code; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Problem / Issue 11 | A clear and concise description of what the problem is. 12 | E.g.: I'm always frustrated when [...] 13 | Or: I need an API for [...] 14 | 15 | ### Solution 16 | A clear and concise description of what you want to happen. 17 | 18 | 19 | 20 | 21 | ### Syntax additions 22 | A clear syntax description, which you wish for to resolve the problem. 23 | ### API additions 24 | A clear API description (exposed types, functions, etc.). 25 | ### CLI changes 26 | A clear description of the proposed CLI (Command Line Interface) changes. 27 | 28 | 29 | 30 | ### Additional context 31 | Add any other context or screenshots about the feature request here. 32 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/APIComConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: WinAPICom Constants UDF Library for AutoIt3 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants that can be used with UDF library 8 | ; Author(s) .....: Yashied, Jpm 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | 13 | ; _WinAPI_CoInitialize() 14 | Global Const $COINIT_APARTMENTTHREADED = 0x02 15 | Global Const $COINIT_DISABLE_OLE1DDE = 0x04 16 | Global Const $COINIT_MULTITHREADED = 0x00 17 | Global Const $COINIT_SPEED_OVER_MEMORY = 0x08 18 | ; =============================================================================================================================== 19 | -------------------------------------------------------------------------------- /test/test.au3: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $res = DllCall("L:\Projects.VisualStudio\AutoItInterpreter\new\test\cpp-interop-test\bin\cpp-interop-test.exe", "int:cdecl", "add", "int", 20, "int", 400) 7 | ; $res = DllCall("L:\Projects.VisualStudio\AutoItInterpreter\new\test\cpp-interop-test\bin\cpp-interop-test.exe", "void:cdecl", "say_hello") 8 | ConsoleWrite("ERR:" & @error & @CRLF) 9 | ConsoleWrite("RES:" & $res & @CRLF) 10 | 11 | exit 12 | 13 | func test($a, $b) 14 | return $a + $b 15 | endfunc 16 | 17 | $callback = DllCallbackRegister(test, "int", "int;int") 18 | $ptr = DllCallbackGetPtr($callback) 19 | ConsoleWrite($callback & @crlf) 20 | ConsoleWrite($ptr & @crlf) 21 | $res = DllCallAddress("int", $ptr, "int", 400, "int", 20) 22 | ConsoleWrite($res & @crlf) 23 | DllCallbackFree($callback) 24 | 25 | ; ConsoleWrite(DllCall("user32.dll", "int", "MessageBoxW", "int", 0, "wstr", "top kek", "wstr", "title", "uint", 0)) 26 | ConsoleWrite(DllCall("user32.dll", "bool", "SetCursorPos", "int", 0, "int", 0)) 27 | 28 | exit 29 | 30 | ClipPut('top " kek | jej ') 31 | ConsoleWrite(@OSVersion) 32 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/GUIConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: All GUIConstants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants that can be used with GUI Applications 8 | ; Author(s) .....: Valik, jpm 9 | ; Dll ...........: 10 | ; =============================================================================================================================== 11 | 12 | #include "AVIConstants.au3" 13 | #include "ButtonConstants.au3" 14 | #include "ComboConstants.au3" 15 | #include "DateTimeConstants.au3" 16 | #include "EditConstants.au3" 17 | #include "GUIConstantsEx.au3" 18 | #include "ListBoxConstants.au3" 19 | #include "ListViewConstants.au3" 20 | #include "ProgressConstants.au3" 21 | #include "RichEditConstants.au3" 22 | #include "SliderConstants.au3" 23 | #include "StaticConstants.au3" 24 | #include "TabConstants.au3" 25 | #include "TreeViewConstants.au3" 26 | #include "UpDownConstants.au3" 27 | #include "WindowsConstants.au3" 28 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Extensibility/Plugins.Au3Framework.Directives.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | using System.Collections.Generic; 3 | using System; 4 | 5 | using Unknown6656.AutoIt3.Runtime; 6 | using Unknown6656.Common; 7 | 8 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.Au3Framework; 9 | 10 | public sealed class FrameworkDirectives 11 | : AbstractDirectiveProcessor 12 | { 13 | private static readonly Regex REGEX_FORCEREF = new(@"^(forceref|uses)$", RegexOptions.IgnoreCase | RegexOptions.Compiled); 14 | 15 | 16 | public FrameworkDirectives(Interpreter interpreter) 17 | : base(interpreter) 18 | { 19 | } 20 | 21 | public override FunctionReturnValue? TryProcessDirective(CallFrame frame, string directive, string arguments) => directive.Match(null, 22 | new Dictionary>() 23 | { 24 | [REGEX_FORCEREF] = _ => Variant.True, // this directive is only used to prevent stripping unassigned variables 25 | 26 | // TODO : more directives 27 | // https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3.html 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/DirConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Dir_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be included in an AutoIt v3 script when using Dir functions. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $DDL_ARCHIVE = 0x00000020 13 | Global Const $DDL_DIRECTORY = 0x00000010 14 | Global Const $DDL_DRIVES = 0x00004000 15 | Global Const $DDL_EXCLUSIVE = 0x00008000 16 | Global Const $DDL_HIDDEN = 0x00000002 17 | Global Const $DDL_READONLY = 0x00000001 18 | Global Const $DDL_READWRITE = 0x00000000 19 | Global Const $DDL_SYSTEM = 0x00000004 20 | ; =============================================================================================================================== 21 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/UpDownConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: UpDown_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: GUI control UpDown styles and much more constants. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; Styles 13 | Global Const $UDS_WRAP = 0x0001 14 | Global Const $UDS_SETBUDDYINT = 0x0002 15 | Global Const $UDS_ALIGNRIGHT = 0x0004 16 | Global Const $UDS_ALIGNLEFT = 0x0008 17 | Global Const $UDS_ARROWKEYS = 0x0020 18 | Global Const $UDS_HORZ = 0x0040 19 | Global Const $UDS_NOTHOUSANDS = 0x0080 20 | 21 | ; Control default styles 22 | Global Const $GUI_SS_DEFAULT_UPDOWN = $UDS_ALIGNLEFT 23 | ; =============================================================================================================================== 24 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/Metadata.cs: -------------------------------------------------------------------------------- 1 | using Unknown6656.AutoIt3.Runtime.Native; 2 | 3 | namespace Unknown6656.AutoIt3.Runtime; 4 | 5 | public record Metadata(OS SupportedPlatforms, bool IsDeprecated) 6 | { 7 | public static Metadata Default { get; } = new(); 8 | 9 | public static Metadata Deprecated { get; } = new(OS.Any, true); 10 | 11 | public static Metadata WindowsOnly { get; } = new(OS.Windows, false); 12 | 13 | public static Metadata MacOSOnly { get; } = new(OS.MacOS, false); 14 | 15 | public static Metadata LinuxOnly { get; } = new(OS.Linux, false); 16 | 17 | public static Metadata UnixOnly { get; } = new(OS.UnixLike, false); 18 | 19 | 20 | public Metadata() 21 | : this(OS.Any, false) 22 | { 23 | } 24 | 25 | public bool SupportsPlatfrom(OS platform) => SupportedPlatforms.HasFlag(platform); 26 | 27 | public static Metadata operator +(Metadata m1, Metadata m2) => m1 | m2; 28 | 29 | public static Metadata operator |(Metadata m1, Metadata m2) => new(m1.SupportedPlatforms | m2.SupportedPlatforms, m1.IsDeprecated | m2.IsDeprecated); 30 | 31 | public static Metadata operator &(Metadata m1, Metadata m2) => new(m1.SupportedPlatforms & m2.SupportedPlatforms, m1.IsDeprecated & m2.IsDeprecated); 32 | } 33 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/InetConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Inet_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be included in an AutoIt v3 script when using Inet functions. 8 | ; Author(s) .....: guinness 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $INET_LOCALCACHE = 0 13 | Global Const $INET_FORCERELOAD = 1 14 | Global Const $INET_IGNORESSL = 2 15 | Global Const $INET_ASCIITRANSFER = 4 16 | Global Const $INET_BINARYTRANSFER = 8 17 | Global Const $INET_FORCEBYPASS = 16 18 | 19 | Global Const $INET_DOWNLOADWAIT = 0 20 | Global Const $INET_DOWNLOADBACKGROUND = 1 21 | 22 | Global Const $INET_DOWNLOADREAD = 0 23 | Global Const $INET_DOWNLOADSIZE = 1 24 | Global Const $INET_DOWNLOADCOMPLETE = 2 25 | Global Const $INET_DOWNLOADSUCCESS = 3 26 | Global Const $INET_DOWNLOADERROR = 4 27 | Global Const $INET_DOWNLOADEXTENDED = 5 28 | ; =============================================================================================================================== 29 | -------------------------------------------------------------------------------- /src/plugins/Plugin.Au3Framework.WindowsSpecific/Plugin.Au3Framework.WindowsSpecific.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0-windows 4 | true 5 | enable 6 | $(SolutionDir)bin/plugins 7 | true 8 | preview 9 | true 10 | true 11 | false 12 | false 13 | Auto 14 | true 15 | false 16 | false 17 | en 18 | 19 | 20 | 21 | false 22 | false 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # Auto-generated 2024-05-04 10:42:36.291 # 3 | # ANY CHANGES TO THIS DOCUMENT WILL BE LOST UPON RE-GENERATION # 4 | ################################################################ 5 | # 6 | # git commit: c94261c5816f150e0db43bd84555b6af69cd3a15 7 | version: 0.12.2466.8669 8 | image: Visual Studio 2022 9 | configuration: Release 10 | install: 11 | - ps: Invoke-WebRequest "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile ".\lib\install-dotnet.ps1" 12 | - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli" 13 | - ps: '.\lib\install-dotnet.ps1 -Channel Preview -Version "9.0.100-preview.2.24157.14" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath' 14 | - ps: $env:Path += ";$env:DOTNET_INSTALL_DIR" 15 | before_build: 16 | #- cmd: nuget restore "AutoItInterpreter.sln" 17 | - cmd: dotnet --info 18 | - cmd: echo %PATH% 19 | - cmd: dotnet clean 20 | - cmd: dotnet restore 21 | #- cmd: dotnet build --configuration Release 22 | build: 23 | project: "AutoItInterpreter.sln" 24 | verbosity: minimal 25 | notifications: 26 | - provider: GitHubPullRequest 27 | #auth_token: 28 | # secure: "" 29 | template: "{{#passed}}:white_check_mark:{{/passed}}{{#failed}}:x:{{/failed}} [Build {{&projectName}} {{buildVersion}} {{status}}]({{buildUrl}}) (commit {{commitUrl}} by @{{&commitAuthorUsername}})" -------------------------------------------------------------------------------- /src/plugins/Plugins.Serial/Plugin.Serial.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | true 5 | enable 6 | $(SolutionDir)bin/plugins 7 | preview 8 | true 9 | true 10 | false 11 | false 12 | Auto 13 | true 14 | false 15 | false 16 | en 17 | 18 | 19 | 20 | 21 | 22 | 23 | false 24 | false 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/IPAddressConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: IPAddress_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for IPAddress functions. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $__IPADDRESSCONSTANT_WM_USER = 0X400 13 | Global Const $IPM_CLEARADDRESS = ($__IPADDRESSCONSTANT_WM_USER + 100) 14 | Global Const $IPM_SETADDRESS = ($__IPADDRESSCONSTANT_WM_USER + 101) 15 | Global Const $IPM_GETADDRESS = ($__IPADDRESSCONSTANT_WM_USER + 102) 16 | Global Const $IPM_SETRANGE = ($__IPADDRESSCONSTANT_WM_USER + 103) 17 | Global Const $IPM_SETFOCUS = ($__IPADDRESSCONSTANT_WM_USER + 104) 18 | Global Const $IPM_ISBLANK = ($__IPADDRESSCONSTANT_WM_USER + 105) 19 | 20 | ; Notifications 21 | Global Const $IPN_FIRST = (-860) 22 | Global Const $IPN_FIELDCHANGED = ($IPN_FIRST - 0) ; Sent when the user changes a field or moves from one field to another 23 | ; =============================================================================================================================== 24 | -------------------------------------------------------------------------------- /test/UnitTests/DataTypes/StringTester.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | using Unknown6656.AutoIt3.Runtime; 4 | using Unknown6656.Testing; 5 | 6 | namespace Unknown6656.AutoIt3.Testing.DataTypes; 7 | 8 | 9 | [TestClass] 10 | internal class StringTester 11 | : UnitTestRunner 12 | { 13 | [TestMethod] 14 | public void Test_01__Conversion() 15 | { 16 | const string original = "foo bar"; 17 | 18 | Variant variant = original; 19 | 20 | Assert.AreEqual(VariantType.String, variant.Type); 21 | 22 | string s1 = variant.ToString(); 23 | string s2 = (string)variant; 24 | 25 | Assert.AreEqual(original, s1); 26 | Assert.AreEqual(original, s2); 27 | } 28 | 29 | [TestMethod] 30 | public void Test_02__Length() 31 | { 32 | foreach (string original in new[] { "foo bar", "", "\0", "\xffff" }) 33 | { 34 | Variant variant = original; 35 | 36 | Assert.AreEqual(original.Length, variant.Length); 37 | } 38 | } 39 | 40 | [TestMethod] 41 | public void Test_03__Concat() 42 | { 43 | const string original1 = "Hello, "; 44 | const string original2 = "World!"; 45 | Variant variant1 = original1; 46 | Variant variant2 = original2; 47 | 48 | Variant concat = variant1 & variant2; 49 | 50 | Assert.AreEqual(VariantType.String, concat.Type); 51 | Assert.AreEqual(original1 + original2, concat.ToString()); 52 | } 53 | 54 | // TODO : add test cases 55 | } 56 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ProcessConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Process_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be included in an AutoIt v3 script when using Process functions. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $PROCESS_TERMINATE = 0x00000001 13 | Global Const $PROCESS_CREATE_THREAD = 0x00000002 14 | Global Const $PROCESS_SET_SESSIONID = 0x00000004 15 | Global Const $PROCESS_VM_OPERATION = 0x00000008 16 | Global Const $PROCESS_VM_READ = 0x00000010 17 | Global Const $PROCESS_VM_WRITE = 0x00000020 18 | Global Const $PROCESS_DUP_HANDLE = 0x00000040 19 | Global Const $PROCESS_CREATE_PROCESS = 0x00000080 20 | Global Const $PROCESS_SET_QUOTA = 0x00000100 21 | Global Const $PROCESS_SET_INFORMATION = 0x00000200 22 | Global Const $PROCESS_QUERY_INFORMATION = 0x00000400 23 | Global Const $PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 24 | Global Const $PROCESS_SUSPEND_RESUME = 0x00000800 25 | Global Const $PROCESS_ALL_ACCESS = 0x001F0FFF 26 | ; =============================================================================================================================== 27 | -------------------------------------------------------------------------------- /test/UnitTests/UnitTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | $(DefineConstants);FORCE_USE_UNKNOWN6656_TEST_FRAMEWORK 8 | 9 | 10 | true 11 | net8.0 12 | false 13 | en 14 | preview 15 | Unknown6656.AutoIt3.Testing 16 | Program 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 32 | 33 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/WinAPI.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | #include "AutoItConstants.au3" 4 | #include "FileConstants.au3" 5 | #include "MsgBoxConstants.au3" 6 | #include "Security.au3" 7 | #include "SendMessage.au3" 8 | #include "StringConstants.au3" 9 | #include "StructureConstants.au3" 10 | #include "WinAPIConstants.au3" 11 | #include "WinAPIConv.au3" 12 | #include "WinAPIDlg.au3" 13 | #include "WinAPIError.au3" 14 | #include "WinAPIFiles.au3" 15 | #include "WinAPIGdi.au3" 16 | #include "WinAPIHObj.au3" 17 | #include "WinAPIIcons.au3" 18 | #include "WinAPIMem.au3" 19 | #include "WinAPIMisc.au3" 20 | #include "WinAPIProc.au3" 21 | #include "WinAPIRes.au3" 22 | #include "WinAPIShellEx.au3" 23 | #include "WinAPISys.au3" 24 | 25 | ; #INDEX# ======================================================================================================================= 26 | ; Title .........: Windows API 27 | ; AutoIt Version : 3.3.14.5 28 | ; Description ...: Windows API calls that have been translated to AutoIt functions (doc in WinAPIEX). 29 | ; Author(s) .....: Paul Campbell (PaulIA), gafrost, Siao, Zedna, arcker, Prog@ndy, PsaltyDS, Raik, jpm 30 | ; Dll ...........: kernel32.dll, user32.dll, gdi32.dll, comdlg32.dll, shell32.dll, ole32.dll, winspool.drv 31 | ; =============================================================================================================================== 32 | 33 | ; #CURRENT# ===================================================================================================================== 34 | ; =============================================================================================================================== 35 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/AVIConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: AVI_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for GUI control AVI styles. 8 | ; Author(s) .....: Valik 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; Styles 13 | Global Const $ACS_CENTER = 1 14 | Global Const $ACS_TRANSPARENT = 2 15 | Global Const $ACS_AUTOPLAY = 4 16 | Global Const $ACS_TIMER = 8 17 | Global Const $ACS_NONTRANSPARENT = 16 18 | 19 | ; Control default styles 20 | Global Const $GUI_SS_DEFAULT_AVI = $ACS_TRANSPARENT 21 | 22 | ; Messages 23 | Global Const $__AVICONSTANT_WM_USER = 0x400 24 | Global Const $ACM_OPENA = $__AVICONSTANT_WM_USER + 100 25 | Global Const $ACM_PLAY = $__AVICONSTANT_WM_USER + 101 26 | Global Const $ACM_STOP = $__AVICONSTANT_WM_USER + 102 27 | Global Const $ACM_ISPLAYING = $__AVICONSTANT_WM_USER + 104 28 | Global Const $ACM_OPENW = $__AVICONSTANT_WM_USER + 103 29 | 30 | ; Notifications 31 | Global Const $ACN_START = 0x00000001 ; Notifies the control's parent that the AVI has started playing 32 | Global Const $ACN_STOP = 0x00000002 ; Notifies the control's parent that the AVI has stopped playing 33 | ; =============================================================================================================================== 34 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Extensibility/Plugins.UDF.Functions/SendMessageFunctions.cs: -------------------------------------------------------------------------------- 1 | using Unknown6656.AutoIt3.Runtime.Native; 2 | using Unknown6656.AutoIt3.Runtime; 3 | 4 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.UDF.Functions; 5 | 6 | public sealed class SendMessageFunctions 7 | : AbstractFunctionProvider 8 | { 9 | public SendMessageFunctions(Interpreter interpreter) 10 | : base(interpreter) 11 | { 12 | RegisterFunction(nameof(_SendMessage), 2, 8, _SendMessage, OS.Windows, Variant.Zero, Variant.Zero, Variant.Zero, "wparam", "lparam", "lresult"); 13 | RegisterFunction("_SendMessageA", 2, 8, _SendMessage, OS.Windows, Variant.Zero, Variant.Zero, Variant.Zero, "wparam", "lparam", "lresult"); 14 | RegisterFunction("_SendMessageW", 2, 8, _SendMessage, OS.Windows, Variant.Zero, Variant.Zero, Variant.Zero, "wparam", "lparam", "lresult"); 15 | } 16 | 17 | private static FunctionReturnValue _SendMessage(CallFrame frame, Variant[] args) 18 | { 19 | nint result; 20 | 21 | NativeInterop.SetLastError(0); 22 | 23 | if (args[3].IsString) 24 | result = NativeInterop.SendMessage((nint)args[0], (int)args[1], (nint)args[2], args[3].ToString()); 25 | else 26 | result = NativeInterop.SendMessage((nint)args[0], (int)args[1], (nint)args[2], (nint)args[3]); 27 | 28 | if (NativeInterop.GetLastError() is int error and not 0) 29 | return FunctionReturnValue.Error(Variant.EmptyString, error, Variant.Zero); 30 | else 31 | return (int)args[4] switch 32 | { 33 | int i and > 0 and <= 4 => args[i - 1], 34 | _ => result 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/WinAPIEx.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | #include "WinAPICom.au3" 4 | #include "WinAPIConv.au3" 5 | #include "WinAPIDiag.au3" 6 | #include "WinAPIDlg.au3" 7 | #include "WinAPIFiles.au3" 8 | #include "WinAPIGdi.au3" 9 | #include "WinAPIHObj.au3" 10 | #include "WinAPIIcons.au3" 11 | #include "WinAPILocale.au3" 12 | #include "WinAPIMisc.au3" 13 | #include "WinAPIProc.au3" 14 | #include "WinAPIReg.au3" 15 | #include "WinAPIRes.au3" 16 | #include "WinAPIShellEx.au3" 17 | #include "WinAPIShPath.au3" 18 | #include "WinAPISys.au3" 19 | #include "WinAPITheme.au3" 20 | 21 | ; #INDEX# ======================================================================================================================= 22 | ; Title .........: WinAPI Extended UDF Library for AutoIt3 23 | ; AutoIt Version : 3.3.14.5 24 | ; Language ......: English 25 | ; Description ...: Additional variables, constants and functions for WinAPI 26 | ; Author(s) .....: Yashied 27 | ; Modified ......: Jpm (Splitted, invidivual include lead to less unused functions) 28 | ; Dwmapi.dll, Gdi32.dll, Gdiplus.dll, Kernel32.dll, Ntdll.dll, Ole32.dll, Oleaut32.dll 29 | ; Powrprof.dll, Psapi.dll, Sensapi.dll, Sfc.dll, Shell32.dll, Shlwapi.dll, User32.dll 30 | ; Userenv.dll, Uxtheme.dll, Version.dll, Winmm.dll, Winspool.drv 31 | ; =============================================================================================================================== 32 | 33 | ; #CURRENT# ===================================================================================================================== 34 | ; =============================================================================================================================== 35 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Extensibility/Plugins.NETInterop.cs: -------------------------------------------------------------------------------- 1 | using Unknown6656.AutoIt3.Runtime; 2 | 3 | namespace Unknown6656.AutoIt3.Extensibility; 4 | 5 | public sealed class NETInteropFunctionProvider 6 | : AbstractFunctionProvider 7 | { 8 | public NETInteropFunctionProvider(Interpreter interpreter) 9 | : base(interpreter) 10 | { 11 | RegisterFunction(nameof(NETNew), 1, 256, NETNew); // [opt-args] 12 | RegisterFunction(nameof(NETClass), 1, NETClass); // 13 | RegisterFunction(nameof(NETDelete), 1, NETDelete); // 14 | } 15 | 16 | public static FunctionReturnValue NETNew(CallFrame frame, Variant[] args) 17 | { 18 | args = frame.PassedArguments; 19 | 20 | bool result = frame.Interpreter.GlobalObjectStorage.TryCreateNETObject(args[0], args[1..], out Variant reference); 21 | 22 | if (result) 23 | return reference; 24 | else 25 | return FunctionReturnValue.Error(1); 26 | } 27 | 28 | public static FunctionReturnValue NETClass(CallFrame frame, Variant[] args) 29 | { 30 | bool result = frame.Interpreter.GlobalObjectStorage.TryCreateNETStaticRefrence(args[0].ToString(), out Variant reference); 31 | 32 | if (result) 33 | return reference; 34 | else 35 | return FunctionReturnValue.Error(1); 36 | } 37 | 38 | public static FunctionReturnValue NETDelete(CallFrame frame, Variant[] args) 39 | { 40 | bool result = frame.Interpreter.GlobalObjectStorage.Delete(args[0]); 41 | 42 | if (result && args[0].AssignedTo is Variable variable) 43 | variable.Value = Variant.Null; 44 | 45 | return (Variant)result; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct - Unknown6656 Style 2 | 3 | ## Our Standards 4 | 5 | We have none. Be as spicy as you want to be.
6 | Like I'd give a f█ck. 7 | 8 | ## Our Code Standards 9 | 10 | - **Allman style.** 11 | End of discussion. Linux kernel / K&R bois can get the hell out. 12 | 13 | - You are encouraged to omit `{` and `}` around single-lined blocks[1], e.g.: 14 | ```csharp 15 | if (true) 16 | func(); 17 | 18 | do 19 | func(); 20 | while (true); 21 | ``` 22 | But do **not** write any of this crap: 23 | ```csharp 24 | if (true) func(); 25 | 26 | do func(); while (true); 27 | ``` 28 | Do **not** write any of that shite either: 29 | ```csharp 30 | if (true) { func(); } 31 | 32 | do { func(); } while (true); 33 | ``` 34 | 35 | - `PascalCase` for types, methods, properties, public identifiers, etc. 36 | 37 | - `underscore_lower_case` for method parameters and local variables 38 | 39 | - `_underscore_lower_case` for private fields 40 | 41 | - `CAPS_LOCK_CASE` for constants 42 | 43 | - Document `public` and `protected` classes and members using XML comments. You do not have to document inaccessible/private members. 44 | 45 | - Try to avoid using external libraries or packages as much as possible. There are already enough dependencies in this project. 46 | 47 | **To avoid any association with slavery, the `master`-branch has been renamed to `daddy` :wink:.** 48 | 49 | ## Our Responsibilities 50 | 51 | LMAO Bottom Text 52 | 53 | ## Enforcement 54 | 55 | topkek. 56 | 57 | ## Attribution 58 | 59 | [Homepage](https://unknown6656.com) 60 | [GitHub](https://github.com/unknown6656) 61 | [Twatter](https://twitter.com/unknown6656) 62 | [Faceberg](https://facebook.com/unknown6656) 63 | [YouTube](https://youtube.com/unknown6656) 64 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ImageListConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: ImageList_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for ImageList functions. 8 | ; Author(s) .....: Gary Frost 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $ILC_MASK = 0x00000001 13 | Global Const $ILC_COLOR = 0x00000000 14 | Global Const $ILC_COLORDDB = 0x000000FE 15 | Global Const $ILC_COLOR4 = 0x00000004 16 | Global Const $ILC_COLOR8 = 0x00000008 17 | Global Const $ILC_COLOR16 = 0x00000010 18 | Global Const $ILC_COLOR24 = 0x00000018 19 | Global Const $ILC_COLOR32 = 0x00000020 20 | Global Const $ILC_PALETTE = 0x00000800 21 | Global Const $ILC_MIRROR = 0x00002000 22 | Global Const $ILC_PERITEMMIRROR = 0x00008000 23 | 24 | Global Const $ILCF_MOVE = 0x0 25 | Global Const $ILCF_SWAP = 0x1 26 | 27 | Global Const $ILD_NORMAL = 0x00000000 28 | Global Const $ILD_TRANSPARENT = 0x00000001 29 | Global Const $ILD_BLEND25 = 0x00000002 30 | Global Const $ILD_BLEND50 = 0x00000004 31 | Global Const $ILD_MASK = 0x00000010 32 | Global Const $ILD_IMAGE = 0x00000020 33 | Global Const $ILD_ROP = 0x00000040 34 | Global Const $ILD_OVERLAYMASK = 0x00000F00 35 | 36 | Global Const $ILS_NORMAL = 0x00000000 37 | Global Const $ILS_GLOW = 0x00000001 38 | Global Const $ILS_SHADOW = 0x00000002 39 | Global Const $ILS_SATURATE = 0x00000004 40 | Global Const $ILS_ALPHA = 0x00000008 41 | ; =============================================================================================================================== 42 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/ParserProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | using Piglet.Parser.Configuration.Generic; 4 | 5 | using Unknown6656.AutoIt3.Parser.ExpressionParser; 6 | using Unknown6656.AutoIt3.Parser.DLLStructParser; 7 | using System.Threading.Tasks; 8 | 9 | namespace Unknown6656.AutoIt3.Runtime; 10 | 11 | using exp_parser = ParserConstructor.ParserWrapper; 12 | using dll_parser = ParserConstructor.ParserWrapper; 13 | 14 | 15 | public sealed class ParserProvider 16 | { 17 | public Interpreter Interpreter { get; } 18 | public exp_parser ExpressionParser { get; private set; } 19 | public exp_parser ParameterParser { get; private set; } 20 | public exp_parser MultiDeclarationParser { get; private set; } 21 | public dll_parser DLLStructParser { get; private set; } 22 | 23 | #nullable disable 24 | internal ParserProvider(Interpreter interpreter) 25 | { 26 | Interpreter = interpreter; 27 | Interpreter.Telemetry.Measure(TelemetryCategory.ParserInitialization, () => Parallel.Invoke( 28 | () => ParameterParser = new ExpressionParser(ParserMode.FunctionParameters).CreateParser(), 29 | () => ExpressionParser = new ExpressionParser(ParserMode.ArbitraryExpression).CreateParser(), 30 | () => MultiDeclarationParser = new ExpressionParser(ParserMode.MultiDeclaration).CreateParser(), 31 | () => DLLStructParser = new DLLStructParser().CreateParser() 32 | )); 33 | } 34 | #nullable enable 35 | 36 | /// 37 | /// This method does nothing at all. When called, it implicitly invokes the static constructor (if the cctor has not been invoked before). 38 | /// 39 | [MethodImpl(MethodImplOptions.NoInlining)] 40 | public static void Initialize() 41 | { 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/APIConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | #include "APIComConstants.au3" 4 | #include "APIDiagConstants.au3" 5 | #include "APIDlgConstants.au3" 6 | #include "APIFilesConstants.au3" 7 | #include "APIGdiConstants.au3" 8 | #include "APILocaleConstants.au3" 9 | #include "APIMiscConstants.au3" 10 | #include "APIProcConstants.au3" 11 | #include "APIRegConstants.au3" 12 | #include "APIResConstants.au3" 13 | #include "APIShellExConstants.au3" 14 | #include "APIShPathConstants.au3" 15 | #include "APISysConstants.au3" 16 | #include "APIThemeConstants.au3" 17 | #include "BorderConstants.au3" 18 | #include "ColorConstants.au3" 19 | #include "Constants.au3" 20 | #include "DirConstants.au3" 21 | #include "FileConstants.au3" 22 | #include "FontConstants.au3" 23 | #include "FrameConstants.au3" 24 | #include "GUIConstants.au3" 25 | #include "MemoryConstants.au3" 26 | #include "MenuConstants.au3" 27 | #include "ProcessConstants.au3" 28 | #include "SecurityConstants.au3" 29 | #include "WinAPIConstants.au3" 30 | #include "WinAPIsysinfoConstants.au3" 31 | #include "WinAPIvkeysConstants.au3" 32 | #include "WindowsConstants.au3" 33 | 34 | ; #INDEX# ======================================================================================================================= 35 | ; Title .........: API Constants UDF WinAPI Libraries for AutoIt3 36 | ; AutoIt Version : 3.3.14.5 37 | ; Language ......: English 38 | ; Description ...: Constants that can be used with UDF WinAPI libraries 39 | ; Author(s) .....: Yashied, jpm 40 | ; =============================================================================================================================== 41 | 42 | ; #CONSTANTS# =================================================================================================================== 43 | ; =============================================================================================================================== 44 | -------------------------------------------------------------------------------- /src/AutoItParser/AutoItParser.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | autoit3.exprparser 4 | Unknown6656.AutoIt3.Parser 5 | $(SolutionDir)bin 6 | net8.0 7 | preview 8 | 9 | false 10 | true 11 | Auto 12 | 13 | Unknown6656 14 | Unknown6656 15 | Copyright © 2020-$([System.DateTime]::Today.ToString(yyyy)), Unknown6656 16 | true 17 | Unknown6656 AutoIt3 Expression Parser 18 | Unknown6656.AutoIt3.Parser 19 | true 20 | true 21 | snupkg 22 | https://github.com/Unknown6656/AutoIt-Interpreter 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | $(SolutionDir)lib/Piglet.dll 35 | 36 | 37 | $(SolutionDir)lib/Piglet.FSharp.dll 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /test/unittest-vartypes.au3: -------------------------------------------------------------------------------- 1 | Local $aArray[2] = [1, "Example"] 2 | Local $mMap[] 3 | Local $dBinary = Binary("0x00204060") 4 | Local $bBoolean = False 5 | Local $pPtr = -1; Ptr(-1) 6 | Local $hWnd = 0; WinGetHandle(AutoItWinGetTitle()) 7 | Local $iInt = 1 8 | Local $fFloat = 2.0 9 | Local $oObject = ObjCreate("Scripting.Dictionary") 10 | Local $sString = "Some text" 11 | Local $tStruct = 0; DllStructCreate("wchar[256]") 12 | Local $vKeyword = Default 13 | Local $vNull = Null 14 | Local $fuFunc = ConsoleWrite 15 | Local $fuUserFunc = Test 16 | 17 | ConsoleWrite( _ 18 | "Variable Types" & @CRLF & _ 19 | " $aArray: " & VarGetType($aArray) & " variable type." & @CRLF & _ 20 | " $mMap: " & VarGetType($mMap) & " variable type." & @CRLF & _ 21 | " $dBinary: " & VarGetType($dBinary) & " variable type." & @CRLF & _ 22 | " $bBoolean: " & VarGetType($bBoolean) & " variable type." & @CRLF & _ 23 | " $pPtr: " & VarGetType($pPtr) & " variable type." & @CRLF & _ 24 | " $hWnd: " & VarGetType($hWnd) & " variable type." & @CRLF & _ 25 | " $iInt: " & VarGetType($iInt) & " variable type." & @CRLF & _ 26 | " $fFloat: " & VarGetType($fFloat) & " variable type." & @CRLF & _ 27 | " $oObject: " & VarGetType($oObject) & " variable type." & @CRLF & _ 28 | " $sString: " & VarGetType($sString) & " variable type." & @CRLF & _ 29 | " $tStruct: " & VarGetType($tStruct) & " variable type." & @CRLF & _ 30 | " $vKeyword: " & VarGetType($vKeyword) & " variable type." & @CRLF & _ 31 | " $vNull: " & VarGetType($vNull) & " variable type." & @CRLF & _ 32 | " MsgBox: " & VarGetType(MsgBox) & " variable type." & @CRLF & _ 33 | " $fuFunc: " & VarGetType($fuFunc) & " variable type." & @CRLF & _ 34 | "Func 'Test': " & VarGetType(Test) & " variable type." & @CRLF & _ 35 | "$fuUserFunc: " & VarGetType($fuUserFunc) & " variable type.") 36 | Func Test() 37 | EndFunc 38 | DebugAll(); -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/APIMiscConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: WinAPIMisc Constants UDF Library for AutoIt3 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants that can be used with UDF library 8 | ; Author(s) .....: Yashied, Jpm 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | 13 | ; _WinAPI_PlaySound() 14 | Global Const $SND_APPLICATION = 0x00000080 15 | Global Const $SND_ALIAS = 0x00010000 16 | Global Const $SND_ALIAS_ID = 0x00110000 17 | Global Const $SND_ASYNC = 0x00000001 18 | Global Const $SND_FILENAME = 0x00020000 19 | Global Const $SND_LOOP = 0x00000008 20 | Global Const $SND_MEMORY = 0x00000004 21 | Global Const $SND_NODEFAULT = 0x00000002 22 | Global Const $SND_NOSTOP = 0x00000010 23 | Global Const $SND_NOWAIT = 0x00002000 24 | Global Const $SND_PURGE = 0x00000040 25 | Global Const $SND_RESOURCE = 0x00040004 26 | Global Const $SND_SENTRY = 0x00080000 27 | Global Const $SND_SYNC = 0x00000000 28 | Global Const $SND_SYSTEM = 0x00200000 29 | Global Const $SND_SYSTEM_NOSTOP = 0x00200010 30 | 31 | Global Const $SND_ALIAS_SYSTEMASTERISK = 'SystemAsterisk' 32 | Global Const $SND_ALIAS_SYSTEMDEFAULT = 'SystemDefault' 33 | Global Const $SND_ALIAS_SYSTEMEXCLAMATION = 'SystemExclamation' 34 | Global Const $SND_ALIAS_SYSTEMEXIT = 'SystemExit' 35 | Global Const $SND_ALIAS_SYSTEMHAND = 'SystemHand' 36 | Global Const $SND_ALIAS_SYSTEMQUESTION = 'SystemQuestion' 37 | Global Const $SND_ALIAS_SYSTEMSTART = 'SystemStart' 38 | Global Const $SND_ALIAS_SYSTEMWELCOME = 'SystemWelcome' 39 | ; =============================================================================================================================== 40 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ScrollBarsConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: ScrollBar_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for ScrollBar functions. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $SIF_POS = 0x04 13 | Global Const $SIF_PAGE = 0x02 14 | Global Const $SIF_RANGE = 0x01 15 | Global Const $SIF_TRACKPOS = 0x10 16 | Global Const $SIF_ALL = BitOR($SIF_RANGE, $SIF_PAGE, $SIF_POS, $SIF_TRACKPOS) 17 | 18 | Global Const $SB_HORZ = 0 19 | Global Const $SB_VERT = 1 20 | Global Const $SB_CTL = 2 21 | Global Const $SB_BOTH = 3 22 | 23 | Global Const $SB_LINELEFT = 0 24 | Global Const $SB_LINERIGHT = 1 25 | Global Const $SB_PAGELEFT = 2 26 | Global Const $SB_PAGERIGHT = 3 27 | 28 | Global Const $SB_THUMBPOSITION = 0x4 29 | Global Const $SB_THUMBTRACK = 0x5 30 | Global Const $SB_LINEDOWN = 1 31 | Global Const $SB_LINEUP = 0 32 | Global Const $SB_PAGEDOWN = 3 33 | Global Const $SB_PAGEUP = 2 34 | Global Const $SB_SCROLLCARET = 4 35 | Global Const $SB_TOP = 6 36 | Global Const $SB_BOTTOM = 7 37 | 38 | Global Const $ESB_DISABLE_BOTH = 0x3 39 | Global Const $ESB_DISABLE_DOWN = 0x2 40 | Global Const $ESB_DISABLE_LEFT = 0x1 41 | Global Const $ESB_DISABLE_LTUP = $ESB_DISABLE_LEFT 42 | Global Const $ESB_DISABLE_RIGHT = 0x2 43 | Global Const $ESB_DISABLE_RTDN = $ESB_DISABLE_RIGHT 44 | Global Const $ESB_DISABLE_UP = 0x1 45 | Global Const $ESB_ENABLE_BOTH = 0x0 46 | 47 | ; Reserved IDs for System Objects 48 | Global Const $OBJID_HSCROLL = 0xFFFFFFFA 49 | Global Const $OBJID_VSCROLL = 0xFFFFFFFB 50 | Global Const $OBJID_CLIENT = 0xFFFFFFFC 51 | ; =============================================================================================================================== 52 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/StaticConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Static_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: GUI control Label/Static styles and Pic, Icon constants. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; Label/Pic/Icon 13 | Global Const $SS_LEFT = 0x0 14 | Global Const $SS_CENTER = 0x1 15 | Global Const $SS_RIGHT = 0x2 16 | Global Const $SS_ICON = 0x3 17 | Global Const $SS_BLACKRECT = 0x4 18 | Global Const $SS_GRAYRECT = 0x5 19 | Global Const $SS_WHITERECT = 0x6 20 | Global Const $SS_BLACKFRAME = 0x7 21 | Global Const $SS_GRAYFRAME = 0x8 22 | Global Const $SS_WHITEFRAME = 0x9 23 | Global Const $SS_SIMPLE = 0xB 24 | Global Const $SS_LEFTNOWORDWRAP = 0xC 25 | Global Const $SS_BITMAP = 0xE 26 | Global Const $SS_ENHMETAFILE = 0xF 27 | Global Const $SS_ETCHEDHORZ = 0x10 28 | Global Const $SS_ETCHEDVERT = 0x11 29 | Global Const $SS_ETCHEDFRAME = 0x12 30 | Global Const $SS_REALSIZECONTROL = 0x40 31 | Global Const $SS_NOPREFIX = 0x0080 32 | Global Const $SS_NOTIFY = 0x0100 33 | Global Const $SS_CENTERIMAGE = 0x0200 34 | Global Const $SS_RIGHTJUST = 0x0400 35 | Global Const $SS_SUNKEN = 0x1000 36 | 37 | ; Control default styles 38 | Global Const $GUI_SS_DEFAULT_LABEL = 0 39 | Global Const $GUI_SS_DEFAULT_GRAPHIC = 0 40 | Global Const $GUI_SS_DEFAULT_ICON = $SS_NOTIFY 41 | Global Const $GUI_SS_DEFAULT_PIC = $SS_NOTIFY 42 | 43 | ; Messages 44 | Global Const $STM_SETICON = 0x0170 45 | Global Const $STM_GETICON = 0x0171 46 | Global Const $STM_SETIMAGE = 0x0172 47 | Global Const $STM_GETIMAGE = 0x0173 48 | ; =============================================================================================================================== 49 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ProgressConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Progress_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: GUI control Progress styles and much more constants. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANT# ====================================================================================================================== 12 | ; Styles 13 | Global Const $PBS_MARQUEE = 0x00000008 ; The progress bar moves like a marquee 14 | Global Const $PBS_SMOOTH = 1 15 | Global Const $PBS_SMOOTHREVERSE = 0x10 ; Vista 16 | Global Const $PBS_VERTICAL = 4 17 | 18 | ; Control default styles 19 | Global Const $GUI_SS_DEFAULT_PROGRESS = 0 20 | 21 | ; Messages 22 | Global Const $__PROGRESSBARCONSTANT_WM_USER = 0X400 23 | Global Const $PBM_DELTAPOS = $__PROGRESSBARCONSTANT_WM_USER + 3 24 | Global Const $PBM_GETBARCOLOR = 0x040F ; Vista 25 | Global Const $PBM_GETBKCOLOR = 0x040E ; Vista 26 | Global Const $PBM_GETPOS = $__PROGRESSBARCONSTANT_WM_USER + 8 27 | Global Const $PBM_GETRANGE = $__PROGRESSBARCONSTANT_WM_USER + 7 28 | Global Const $PBM_GETSTATE = 0x0411 ; Vista 29 | Global Const $PBM_GETSTEP = 0x040D ; Vista 30 | Global Const $PBM_SETBARCOLOR = $__PROGRESSBARCONSTANT_WM_USER + 9 31 | Global Const $PBM_SETBKCOLOR = 0x2000 + 1 32 | Global Const $PBM_SETMARQUEE = $__PROGRESSBARCONSTANT_WM_USER + 10 33 | Global Const $PBM_SETPOS = $__PROGRESSBARCONSTANT_WM_USER + 2 34 | Global Const $PBM_SETRANGE = $__PROGRESSBARCONSTANT_WM_USER + 1 35 | Global Const $PBM_SETRANGE32 = $__PROGRESSBARCONSTANT_WM_USER + 6 36 | Global Const $PBM_SETSTATE = 0x0410 ; Vista 37 | Global Const $PBM_SETSTEP = $__PROGRESSBARCONSTANT_WM_USER + 4 38 | Global Const $PBM_STEPIT = $__PROGRESSBARCONSTANT_WM_USER + 5 39 | ; =============================================================================================================================== 40 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/FrameConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Frame_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for _WinAPI_DrawFrameControl(). 8 | ; Author(s) .....: Gary Frost 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; type of frame 13 | Global Const $DFC_BUTTON = 4 14 | Global Const $DFC_CAPTION = 1 15 | Global Const $DFC_MENU = 2 16 | Global Const $DFC_POPUPMENU = 5 17 | Global Const $DFC_SCROLL = 3 18 | 19 | ; initial state of the frame 20 | Global Const $DFCS_BUTTON3STATE = 0x8 21 | Global Const $DFCS_BUTTONCHECK = 0x0 22 | Global Const $DFCS_BUTTONPUSH = 0x10 23 | Global Const $DFCS_BUTTONRADIO = 0x4 24 | Global Const $DFCS_BUTTONRADIOIMAGE = 0x1 25 | Global Const $DFCS_BUTTONRADIOMASK = 0x2 26 | Global Const $DFCS_CAPTIONCLOSE = 0x0 27 | Global Const $DFCS_CAPTIONHELP = 0x4 28 | Global Const $DFCS_CAPTIONMAX = 0x2 29 | Global Const $DFCS_CAPTIONMIN = 0x1 30 | Global Const $DFCS_CAPTIONRESTORE = 0x3 31 | Global Const $DFCS_MENUARROW = 0x0 32 | Global Const $DFCS_MENUARROWRIGHT = 0x4 33 | Global Const $DFCS_MENUBULLET = 0x2 34 | Global Const $DFCS_MENUCHECK = 0x1 35 | Global Const $DFCS_SCROLLCOMBOBOX = 0x5 36 | Global Const $DFCS_SCROLLDOWN = 0x1 37 | Global Const $DFCS_SCROLLLEFT = 0x2 38 | Global Const $DFCS_SCROLLRIGHT = 0x3 39 | Global Const $DFCS_SCROLLSIZEGRIP = 0x8 40 | Global Const $DFCS_SCROLLSIZEGRIPRIGHT = 0x10 41 | Global Const $DFCS_SCROLLUP = 0x0 42 | Global Const $DFCS_ADJUSTRECT = 0x2000 43 | 44 | ; Set state constants 45 | Global Const $DFCS_CHECKED = 0x400 46 | Global Const $DFCS_FLAT = 0x4000 47 | Global Const $DFCS_HOT = 0x1000 48 | Global Const $DFCS_INACTIVE = 0x100 49 | Global Const $DFCS_PUSHED = 0x200 50 | Global Const $DFCS_TRANSPARENT = 0x800 51 | 52 | ; =============================================================================================================================== 53 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/BorderConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Border_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for _WinAPI_DrawEdge(). 8 | ; Author(s) .....: Gary Frost 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $BDR_RAISEDINNER = 0x4 13 | Global Const $BDR_RAISEDOUTER = 0x1 14 | Global Const $BDR_SUNKENINNER = 0x8 15 | Global Const $BDR_SUNKENOUTER = 0x2 16 | Global Const $EDGE_BUMP = BitOR($BDR_RAISEDOUTER, $BDR_SUNKENINNER) 17 | Global Const $EDGE_ETCHED = BitOR($BDR_SUNKENOUTER, $BDR_RAISEDINNER) 18 | Global Const $EDGE_RAISED = BitOR($BDR_RAISEDOUTER, $BDR_RAISEDINNER) 19 | Global Const $EDGE_SUNKEN = BitOR($BDR_SUNKENOUTER, $BDR_SUNKENINNER) 20 | 21 | ; Type of Border 22 | Global Const $BF_ADJUST = 0x2000 23 | Global Const $BF_BOTTOM = 0x8 24 | Global Const $BF_DIAGONAL = 0x10 25 | Global Const $BF_FLAT = 0x4000 26 | Global Const $BF_LEFT = 0x1 27 | Global Const $BF_MIDDLE = 0x800 28 | Global Const $BF_MONO = 0x8000 29 | Global Const $BF_RIGHT = 0x4 30 | Global Const $BF_SOFT = 0x1000 31 | Global Const $BF_TOP = 0x2 32 | Global Const $BF_BOTTOMLEFT = BitOR($BF_BOTTOM, $BF_LEFT) 33 | Global Const $BF_BOTTOMRIGHT = BitOR($BF_BOTTOM, $BF_RIGHT) 34 | Global Const $BF_TOPLEFT = BitOR($BF_TOP, $BF_LEFT) 35 | Global Const $BF_TOPRIGHT = BitOR($BF_TOP, $BF_RIGHT) 36 | Global Const $BF_RECT = BitOR($BF_LEFT, $BF_TOP, $BF_RIGHT, $BF_BOTTOM) 37 | Global Const $BF_DIAGONAL_ENDBOTTOMLEFT = BitOR($BF_DIAGONAL, $BF_BOTTOM, $BF_LEFT) 38 | Global Const $BF_DIAGONAL_ENDBOTTOMRIGHT = BitOR($BF_DIAGONAL, $BF_BOTTOM, $BF_RIGHT) 39 | Global Const $BF_DIAGONAL_ENDTOPLEFT = BitOR($BF_DIAGONAL, $BF_TOP, $BF_LEFT) 40 | Global Const $BF_DIAGONAL_ENDTOPRIGHT = BitOR($BF_DIAGONAL, $BF_TOP, $BF_RIGHT) 41 | ; =============================================================================================================================== 42 | -------------------------------------------------------------------------------- /src/plugins/Plugins.Serial/SerialFunctionProvider.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Ports; 2 | 3 | using Unknown6656.AutoIt3.Extensibility; 4 | using Unknown6656.AutoIt3.Runtime; 5 | 6 | [assembly: AutoIt3Plugin] 7 | 8 | 9 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.Serial; 10 | 11 | public sealed class SerialFunctionProvider 12 | : AbstractFunctionProvider 13 | { 14 | public SerialFunctionProvider(Interpreter interpreter) 15 | : base(interpreter) 16 | { 17 | RegisterFunction(nameof(SerialOpen), 2, 5, SerialOpen, [(int)Parity.None, 8, (int)StopBits.One]); 18 | RegisterFunction(nameof(SerialClose), 1, SerialClose); 19 | } 20 | 21 | // SerialOpen( , [, = 0 [, = 8 [, = 1]]] ) 22 | // success: handle 23 | // failure: zero, @error = -1 24 | private static FunctionReturnValue SerialOpen(CallFrame frame, Variant[] args) 25 | { 26 | try 27 | { 28 | return frame.Interpreter.GlobalObjectStorage.Store(new SerialPort(args[0].ToString(), (int)args[1], (Parity)(int)args[2], (int)args[3], (StopBits)(int)args[4])); 29 | } 30 | catch 31 | { 32 | return FunctionReturnValue.Error(-1); 33 | } 34 | } 35 | 36 | // SerialOpen( ) 37 | private static FunctionReturnValue SerialClose(CallFrame frame, Variant[] args) 38 | { 39 | if (frame.Interpreter.GlobalObjectStorage.TryGet(args[0], out SerialPort? port)) 40 | { 41 | port.Close(); 42 | port.Dispose(); 43 | 44 | frame.Interpreter.GlobalObjectStorage.Delete(args[0]); 45 | 46 | return Variant.True; 47 | } 48 | else 49 | return Variant.False; 50 | } 51 | 52 | // // Serial...( , ... ) 53 | // private static FunctionReturnValue Serial...(CallFrame frame, Variant[] args) 54 | // { 55 | // } 56 | 57 | // // Serial...( , ... ) 58 | // private static FunctionReturnValue Serial...(CallFrame frame, Variant[] args) 59 | // { 60 | // } 61 | 62 | // // Serial...( , ... ) 63 | // private static FunctionReturnValue Serial...(CallFrame frame, Variant[] args) 64 | // { 65 | // } 66 | } 67 | -------------------------------------------------------------------------------- /src/AutoItParser/ParsingUtil.fs: -------------------------------------------------------------------------------- 1 | // Autogenerated 2020-06-17 13:47:01.672 2 | 3 | namespace Unknown6656.AutoIt3.ExpressionParser 4 | 5 | open Piglet.Parser.Configuration.Generic 6 | open System 7 | 8 | [] 9 | module ParsingUtil = 10 | let internal reducef (s : NonTerminalWrapper<'a>) x = 11 | s.AddProduction().SetReduceFunction (Func<'a>(x)) 12 | |> ignore 13 | 14 | // let internal reduce0 (s : NonTerminalWrapper<'a>) a = 15 | // s.AddProduction(a).SetReduceToFirst() 16 | // |> ignore 17 | 18 | let internal reduce1 (s : NonTerminalWrapper<'a>) a x = 19 | s.AddProduction(a).SetReduceFunction (Func<_, 'a>(x)) 20 | |> ignore 21 | 22 | let internal reduce2 (s : NonTerminalWrapper<'a>) a b x = 23 | s.AddProduction(a, b).SetReduceFunction (Func<_, _, 'a>(x)) 24 | |> ignore 25 | 26 | let internal reduce3 (s : NonTerminalWrapper<'a>) a b c x = 27 | s.AddProduction(a, b, c).SetReduceFunction (Func<_, _, _, 'a>(x)) 28 | |> ignore 29 | 30 | let internal reduce4 (s : NonTerminalWrapper<'a>) a b c d x = 31 | s.AddProduction(a, b, c, d).SetReduceFunction (Func<_, _, _, _, 'a>(x)) 32 | |> ignore 33 | 34 | let internal reduce5 (s : NonTerminalWrapper<'a>) a b c d e x = 35 | s.AddProduction(a, b, c, d, e).SetReduceFunction (Func<_, _, _, _, _, 'a>(x)) 36 | |> ignore 37 | 38 | let internal reduce6 (s : NonTerminalWrapper<'a>) a b c d e f x = 39 | s.AddProduction(a, b, c, d, e, f).SetReduceFunction (Func<_, _, _, _, _, _, 'a>(x)) 40 | |> ignore 41 | 42 | let internal reduce7 (s : NonTerminalWrapper<'a>) a b c d e f g x = 43 | s.AddProduction(a, b, c, d, e, f, g).SetReduceFunction (Func<_, _, _, _, _, _, _, 'a>(x)) 44 | |> ignore 45 | 46 | let internal reduce8 (s : NonTerminalWrapper<'a>) a b c d e f g h x = 47 | s.AddProduction(a, b, c, d, e, f, g, h).SetReduceFunction (Func<_, _, _, _, _, _, _, _, 'a>(x)) 48 | |> ignore 49 | 50 | let internal reduce9 (s : NonTerminalWrapper<'a>) a b c d e f g h i x = 51 | s.AddProduction(a, b, c, d, e, f, g, h, i).SetReduceFunction (Func<_, _, _, _, _, _, _, _, _, 'a>(x)) 52 | |> ignore 53 | 54 | let internal reduce10 (s : NonTerminalWrapper<'a>) a b c d e f g h i j x = 55 | s.AddProduction(a, b, c, d, e, f, g, h, i, j).SetReduceFunction (Func<_, _, _, _, _, _, _, _, _, _, 'a>(x)) 56 | |> ignore 57 | 58 | let internal reduce0 s a = reduce1 s a id 59 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | 2 | ////////////////////////////////////////////////////////////////////////// 3 | // Auto-generated 2024-05-04 10:42:36.291 // 4 | // ANY CHANGES TO THIS DOCUMENT WILL BE LOST UPON RE-GENERATION // 5 | ////////////////////////////////////////////////////////////////////////// 6 | 7 | using System.Reflection; 8 | using System; 9 | 10 | [assembly: AssemblyVersion("0.12.2466.8669")] 11 | [assembly: AssemblyFileVersion("0.12.2466.8669")] 12 | [assembly: AssemblyInformationalVersion("v.0.12.2466.8669, commit: c94261c5816f150e0db43bd84555b6af69cd3a15")] 13 | [assembly: AssemblyCompany("Unknown6656")] 14 | [assembly: AssemblyCopyright("Copyright © 2018 - 2024, Unknown6656")] 15 | [assembly: AssemblyProduct("AutoIt-Interpreter by Unknown6656")] 16 | [assembly: AssemblyTitle("autoit3")] 17 | 18 | /// 19 | /// A global module containing some meta-data. 20 | /// 21 | public static class __module__ 22 | { 23 | /// 24 | /// The interpreter's author. This value is equal to the author of the GitHub repository associated with . 25 | /// 26 | public const string Author = "Unknown6656"; 27 | /// 28 | /// Development year(s). 29 | /// 30 | public const string Year = "2018 - 2024"; 31 | /// 32 | /// The interpreter's copyright information. 33 | /// 34 | public const string Copyright = "Copyright © 2018 - 2024, Unknown6656"; 35 | /// 36 | /// The interpreter's current version. 37 | /// 38 | public static Version? InterpreterVersion { get; } = Version.Parse("0.12.2466.8669"); 39 | /// 40 | /// The Git hash associated with the current build. 41 | /// 42 | public const string GitHash = "c94261c5816f150e0db43bd84555b6af69cd3a15"; 43 | /// 44 | /// The name of the GitHub repository associated with . 45 | /// 46 | public const string RepositoryName = "AutoIt-Interpreter"; 47 | /// 48 | /// The URL of this project's GitHub repository. 49 | /// 50 | public const string RepositoryURL = "https://github.com/Unknown6656/AutoIt-Interpreter"; 51 | /// 52 | /// The date and time of the current build (2024-05-04 10:42:36.291). 53 | /// 54 | public static DateTime DateBuilt { get; } = DateTime.FromFileTimeUtc(0x01da9dff03912eeaL); 55 | } 56 | -------------------------------------------------------------------------------- /src/plugins/Plugin.Au3Framework.WindowsSpecific/WindowsSpecificMacros.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | using Unknown6656.AutoIt3.Extensibility; 4 | using Unknown6656.AutoIt3.Runtime; 5 | 6 | [assembly: AutoIt3Plugin] 7 | 8 | 9 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.Au3Framework; 10 | 11 | public sealed class WindowsSpecificMacros 12 | : AbstractKnownMacroProvider 13 | { 14 | public WindowsSpecificMacros(Interpreter interpreter) 15 | : base(interpreter) 16 | { 17 | RegisterMacro("DESKTOPHEIGHT", _ => DEVMODE.Current.dmPelsHeight); 18 | RegisterMacro("DESKTOPWIDTH", _ => DEVMODE.Current.dmPelsWidth); 19 | RegisterMacro("DESKTOPREFRESH", _ => DEVMODE.Current.dmDisplayFrequency); 20 | RegisterMacro("DesktopDepth", _ => DEVMODE.Current.dmBitsPerPel); 21 | } 22 | } 23 | 24 | [StructLayout(LayoutKind.Sequential)] 25 | internal struct DEVMODE 26 | { 27 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] 28 | public string dmDeviceName; 29 | public short dmSpecVersion; 30 | public short dmDriverVersion; 31 | public short dmSize; 32 | public short dmDriverExtra; 33 | public int dmFields; 34 | public int dmPositionX; 35 | public int dmPositionY; 36 | public int dmDisplayOrientation; 37 | public int dmDisplayFixedOutput; 38 | public short dmColor; 39 | public short dmDuplex; 40 | public short dmYResolution; 41 | public short dmTTOption; 42 | public short dmCollate; 43 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] 44 | public string dmFormName; 45 | public short dmLogPixels; 46 | public int dmBitsPerPel; 47 | public int dmPelsWidth; 48 | public int dmPelsHeight; 49 | public int dmDisplayFlags; 50 | public int dmDisplayFrequency; 51 | public int dmICMMethod; 52 | public int dmICMIntent; 53 | public int dmMediaType; 54 | public int dmDitherType; 55 | public int dmReserved1; 56 | public int dmReserved2; 57 | public int dmPanningWidth; 58 | public int dmPanningHeight; 59 | 60 | 61 | public static DEVMODE Current 62 | { 63 | get 64 | { 65 | [DllImport("user32.dll")] 66 | static extern bool EnumDisplaySettings(string? deviceName, int modeNum, ref DEVMODE devMode); 67 | 68 | DEVMODE mode = default; 69 | mode.dmSize = (short)Marshal.SizeOf(mode); 70 | 71 | EnumDisplaySettings(null, -1, ref mode); 72 | 73 | return mode; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | [![Build status](https://ci.appveyor.com/api/projects/status/7ql5ht899jtcwjw6?svg=true)](https://ci.appveyor.com/project/Unknown6656/autoit-interpreter) 2 | ![issues](https://img.shields.io/github/issues/Unknown6656/AutoIt-Interpreter) 3 | ![repo size](https://img.shields.io/github/repo-size/unknown6656/AutoIt-Interpreter) 4 | ![downloads](https://img.shields.io/github/downloads/unknown6656/AutoIt-Interpreter/total) 5 | ![license](https://img.shields.io/github/license/Unknown6656/AutoIt-Interpreter) 6 | ![forks](https://img.shields.io/github/forks/Unknown6656/AutoIt-Interpreter) 7 | ![stars](https://img.shields.io/github/stars/Unknown6656/AutoIt-Interpreter) 8 | 9 | Banner image
10 | Banner image 11 | 12 |
13 | 14 | > [!WARNING] 15 | > This project is still in development and not yet ready for production use. 16 | > The current version is a pre-release version and may contain bugs or incomplete features. 17 | > Please report any issues you encounter [here](https://github.com/Unknown6656/AutoIt-Interpreter/issues). 18 | 19 | # Platform-Independent AutoIt3 Interpreter 20 | 21 | AutoIt is a traditionally Windows-only scripting language based on the Visual Basic syntax. 22 | The aim of this repository is to provide an AutoIt3 Interpreter for other platforms, such as Linux/Unix and MacOS. This Interpreter is based purely on .NET8-conform C#/F# code and primarily supports the AutoIt3-specification. 23 | The Interpreter does support a plugin-based extension system in order to provide a custom syntax or framework functionality to the interpreter. 24 | 25 | > [!NOTE] 26 | > This repository contains a newer (.NET8-based) **extensible AutoIt3 Interpreter** based on a previous version of this project. 27 | > In order to see the "old" **AutoIt++ Interpiler** written in 2018 (discontinued), refer to the following URL: https://github.com/Unknown6656/AutoIt-Interpreter-old. 28 | 29 | 30 | ## Links 31 | 32 | - [Wiki](https://github.com/Unknown6656/AutoIt-Interpreter/wiki) 33 | - [Issues](https://github.com/Unknown6656/AutoIt-Interpreter/issues) 34 | - [Developement Progress](https://github.com/Unknown6656/AutoIt-Interpreter/projects/1) 35 | - [Official AutoIt3 documentation](https://www.autoitscript.com/autoit3/docs/) 36 | 37 | 38 | ## Maintainer(s) 39 | 40 | - [@Unknown6656](https://github.com/Unknown6656) 41 | - ([@Zedly](https://github.com/Zedly) / [@wickersoft](https://github.com/wickersoft) in assistive and advisory function) 42 | 43 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/MemoryConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Memory_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for Memory functions. 8 | ; Author(s) .....: Paul Campbell (PaulIA) 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | Global Const $GMEM_FIXED = 0x0000 13 | Global Const $GMEM_MOVEABLE = 0x0002 14 | Global Const $GMEM_NOCOMPACT = 0x0010 15 | Global Const $GMEM_NODISCARD = 0x0020 16 | Global Const $GMEM_ZEROINIT = 0x0040 17 | Global Const $GMEM_MODIFY = 0x0080 18 | Global Const $GMEM_DISCARDABLE = 0x0100 19 | Global Const $GMEM_NOT_BANKED = 0x1000 20 | Global Const $GMEM_SHARE = 0x2000 21 | Global Const $GMEM_DDESHARE = 0x2000 22 | Global Const $GMEM_NOTIFY = 0x4000 23 | Global Const $GMEM_LOWER = 0x1000 24 | Global Const $GMEM_VALID_FLAGS = 0x7F72 25 | Global Const $GMEM_INVALID_HANDLE = 0x8000 26 | 27 | Global Const $GPTR = BitOR($GMEM_FIXED, $GMEM_ZEROINIT) ; in fact equal $GMEM_ZEROINIT 28 | Global Const $GHND = BitOR($GMEM_MOVEABLE, $GMEM_ZEROINIT) 29 | 30 | ; VirtualAlloc Allocation Type Constants 31 | 32 | Global Const $MEM_COMMIT = 0x00001000 33 | Global Const $MEM_RESERVE = 0x00002000 34 | Global Const $MEM_TOP_DOWN = 0x00100000 35 | Global Const $MEM_SHARED = 0x08000000 36 | 37 | ; VirtualAlloc Protection Constants 38 | 39 | Global Const $PAGE_NOACCESS = 0x00000001 40 | Global Const $PAGE_READONLY = 0x00000002 41 | Global Const $PAGE_READWRITE = 0x00000004 42 | Global Const $PAGE_EXECUTE = 0x00000010 43 | Global Const $PAGE_EXECUTE_READ = 0x00000020 44 | Global Const $PAGE_EXECUTE_READWRITE = 0x00000040 45 | Global Const $PAGE_EXECUTE_WRITECOPY = 0x00000080 46 | Global Const $PAGE_GUARD = 0x00000100 47 | Global Const $PAGE_NOCACHE = 0x00000200 48 | Global Const $PAGE_WRITECOMBINE = 0x00000400 49 | Global Const $PAGE_WRITECOPY = 0x00000008 50 | 51 | ; VirtualFree FreeType Constants 52 | 53 | Global Const $MEM_DECOMMIT = 0x00004000 54 | Global Const $MEM_RELEASE = 0x00008000 55 | 56 | ; MemGetStats Constants 57 | Global Enum $MEM_LOAD, $MEM_TOTALPHYSRAM, $MEM_AVAILPHYSRAM, $MEM_TOTALPAGEFILE, $MEM_AVAILPAGEFILE, $MEM_TOTALVIRTUAL, $MEM_AVAILVIRTUAL 58 | ; =============================================================================================================================== 59 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Extensibility/Plugins.Au3Framework.AdditionalFunctions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Unknown6656.AutoIt3.Runtime.Native; 4 | using Unknown6656.AutoIt3.Runtime; 5 | 6 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.Au3Framework; 7 | 8 | public sealed class AdditionalFunctions 9 | : AbstractFunctionProvider 10 | { 11 | public AdditionalFunctions(Interpreter interpreter) 12 | : base(interpreter) 13 | { 14 | RegisterFunction(nameof(ATan2), 2, ATan2); 15 | RegisterFunction(nameof(ACosh), 1, ACosh); 16 | RegisterFunction(nameof(ASinh), 1, ASinh); 17 | RegisterFunction(nameof(ATanh), 1, ATanh); 18 | RegisterFunction(nameof(ConsoleWriteLine), 0, 1, ConsoleWriteLine, ""); 19 | RegisterFunction(nameof(ConsoleReadLine), 0, ConsoleReadLine); 20 | RegisterFunction(nameof(ConsoleClear), 0, ConsoleClear); 21 | RegisterFunction(nameof(KernelPanic), 0, KernelPanic); 22 | } 23 | 24 | internal static FunctionReturnValue ATan2(CallFrame frame, Variant[] args) => (Variant)Math.Atan2((double)args[0].ToNumber(), (double)args[1].ToNumber()); 25 | 26 | internal static FunctionReturnValue ACosh(CallFrame frame, Variant[] args) => (Variant)Math.Acosh((double)args[0].ToNumber()); 27 | 28 | internal static FunctionReturnValue ASinh(CallFrame frame, Variant[] args) => (Variant)Math.Asinh((double)args[0].ToNumber()); 29 | 30 | internal static FunctionReturnValue ATanh(CallFrame frame, Variant[] args) => (Variant)Math.Atanh((double)args[0].ToNumber()); 31 | 32 | internal static FunctionReturnValue ConsoleClear(CallFrame frame, Variant[] args) 33 | { 34 | Console.Clear(); 35 | 36 | return Variant.Zero; 37 | } 38 | 39 | internal static FunctionReturnValue ConsoleWriteLine(CallFrame frame, Variant[] args) => 40 | FrameworkFunctions.ConsoleWrite(frame, [(args.Length > 0 ? args[0] : "") & "\r\n"]); 41 | 42 | internal static FunctionReturnValue ConsoleReadLine(CallFrame frame, Variant[] args) => (Variant)Console.ReadLine(); 43 | 44 | internal static unsafe FunctionReturnValue KernelPanic(CallFrame frame, Variant[] args) 45 | { 46 | NativeInterop.DoPlatformDependent(delegate 47 | { 48 | NativeInterop.RtlAdjustPrivilege(19, true, false, out _); 49 | NativeInterop.NtRaiseHardError(0xc0000420u, 0, 0, null, 6, out _); 50 | }, delegate 51 | { 52 | NativeInterop.Exec("echo 1 > /proc/sys/kernel/sysrq"); 53 | NativeInterop.Exec("echo c > /proc/sysrq-trigger"); 54 | }); 55 | 56 | return Variant.True; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/FunctionCache.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System; 5 | 6 | using Unknown6656.AutoIt3.CLI; 7 | using Unknown6656.Generics; 8 | 9 | namespace Unknown6656.AutoIt3.Runtime; 10 | 11 | 12 | public sealed class FunctionCache 13 | { 14 | private readonly Dictionary> _cache = []; 15 | 16 | public Interpreter Interpreter { get; } 17 | 18 | 19 | internal FunctionCache(Interpreter interpreter) => Interpreter = interpreter; 20 | 21 | public void SetOrUpdate(AU3Function function, Variant[] arguments, FunctionReturnValue return_value) => Interpreter.Telemetry.Measure(TelemetryCategory.Au3CacheWrite, delegate 22 | { 23 | if (!_cache.TryGetValue(function, out List<(Variant[] args, FunctionReturnValue ret)>? entries)) 24 | _cache[function] = entries = []; 25 | 26 | for (int i = 0; i < entries.Count; ++i) 27 | if (entries[i] is { args: { } args } entry && args.SequenceEqual(arguments)) 28 | { 29 | entry.ret = return_value; 30 | entries[i] = entry; 31 | 32 | MainProgram.PrintDebugMessage($"cache update: {function.Name}({arguments.StringJoin(", ")}) -> {return_value}"); 33 | 34 | return; 35 | } 36 | 37 | MainProgram.PrintDebugMessage($"new cache entry: {function.Name}({arguments.StringJoin(", ")}) -> {return_value}"); 38 | 39 | entries.Add((arguments, return_value)); 40 | }); 41 | 42 | public bool TryFetch(AU3Function function, Variant[] arguments, [NotNullWhen(true)] out FunctionReturnValue? return_value) => 43 | (return_value = Interpreter.Telemetry.Measure(TelemetryCategory.Au3CacheRead, delegate 44 | { 45 | if (_cache.TryGetValue(function, out List<(Variant[] args, FunctionReturnValue ret)>? entries)) 46 | for (int i = 0; i < entries.Count; ++i) 47 | if (entries[i].args.SequenceEqual(arguments)) 48 | { 49 | MainProgram.PrintDebugMessage($"cache hit: {function.Name}({arguments.StringJoin(", ")}) -> {entries[i].ret}"); 50 | 51 | return entries[i].ret; 52 | } 53 | 54 | MainProgram.PrintDebugMessage($"cache miss: {function.Name}({arguments.StringJoin(", ")})"); 55 | 56 | return null; 57 | })) is { }; 58 | 59 | public override string ToString() => $"{_cache} function(s), {_cache.Values.Sum(e => e.Count)} total entries"; 60 | } 61 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Extensibility/Plugins.UDF.Functions/MathFunctions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Unknown6656.AutoIt3.Runtime; 4 | 5 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.UDF.Functions; 6 | 7 | public sealed class MathFunctions 8 | : AbstractFunctionProvider 9 | { 10 | public MathFunctions(Interpreter interpreter) 11 | : base(interpreter) 12 | { 13 | RegisterFunction(nameof(_Degree), 1, _Degree); 14 | RegisterFunction(nameof(_Radian), 1, _Radian); 15 | RegisterFunction(nameof(_Min), 2, _Min); 16 | RegisterFunction(nameof(_Max), 2, _Max); 17 | RegisterFunction(nameof(_MathCheckDiv), 1, 2, _MathCheckDiv, Variant.FromNumber(2.0)); 18 | 19 | interpreter.VariableResolver.CreateConstant("MATH_DEGREES", 57.2957795130823); 20 | interpreter.VariableResolver.CreateConstant("MATH_ISNOTDIVISIBLE", 1); 21 | interpreter.VariableResolver.CreateConstant("MATH_ISDIVISIBLE", 2); 22 | } 23 | 24 | private static FunctionReturnValue _Max(CallFrame frame, Variant[] args) 25 | { 26 | if (!args[0].IsNumber) 27 | return FunctionReturnValue.Error(1); 28 | else if (!args[1].IsNumber) 29 | return FunctionReturnValue.Error(2); 30 | else 31 | return Variant.FromNumber(Math.Max(args[0].ToNumber(), args[1].ToNumber())); 32 | } 33 | 34 | private static FunctionReturnValue _Min(CallFrame frame, Variant[] args) 35 | { 36 | if (!args[0].IsNumber) 37 | return FunctionReturnValue.Error(1); 38 | else if (!args[1].IsNumber) 39 | return FunctionReturnValue.Error(2); 40 | else 41 | return Variant.FromNumber(Math.Min(args[0].ToNumber(), args[1].ToNumber())); 42 | } 43 | 44 | private static FunctionReturnValue _Radian(CallFrame frame, Variant[] args) 45 | { 46 | if (args[0].IsNumber) 47 | return Variant.FromNumber(args[0].ToNumber() / 57.2957795130823); 48 | else 49 | return FunctionReturnValue.Error(1); 50 | } 51 | 52 | private static FunctionReturnValue _Degree(CallFrame frame, Variant[] args) 53 | { 54 | if (args[0].IsNumber) 55 | return Variant.FromNumber(args[0].ToNumber() * 57.2957795130823); 56 | else 57 | return FunctionReturnValue.Error(1); 58 | } 59 | 60 | private static FunctionReturnValue _MathCheckDiv(CallFrame frame, Variant[] args) 61 | { 62 | if (!args[0].IsNumber && !args[1].IsNumber) 63 | return FunctionReturnValue.Error(-1, 1, 0); 64 | else if ((int)args[1] == 0 || (int)args[0] % (int)args[1] == 0) 65 | return Variant.FromNumber(1); 66 | else 67 | return Variant.FromNumber(2); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Extensibility/Plugins.Internals.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | 3 | using Unknown6656.AutoIt3.Runtime; 4 | 5 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.Internals; 6 | 7 | public sealed class InternalsFunctionProvider 8 | : AbstractFunctionProvider 9 | { 10 | internal static readonly ConcurrentDictionary _iterators = new(); 11 | 12 | 13 | public InternalsFunctionProvider(Interpreter interpreter) 14 | : base(interpreter) 15 | { 16 | RegisterFunction(nameof(__iterator_create), 2, __iterator_create); 17 | RegisterFunction(nameof(__iterator_destroy), 1, __iterator_destroy); 18 | RegisterFunction(nameof(__iterator_canmove), 1, __iterator_canmove); 19 | RegisterFunction(nameof(__iterator_movenext), 1, __iterator_movenext); 20 | RegisterFunction(nameof(__iterator_currentkey), 1, __iterator_currentkey); 21 | RegisterFunction(nameof(__iterator_currentvalue), 1, __iterator_currentvalue); 22 | } 23 | 24 | public static FunctionReturnValue __iterator_create(CallFrame frame, Variant[] args) 25 | { 26 | Variant source = args[1]; 27 | 28 | if (args[1].IsIndexable) 29 | _iterators.TryAdd(args[0].ToString(), (source.ToOrderedMap(frame.Interpreter), 0)); 30 | 31 | return Variant.Null; 32 | } 33 | 34 | public static FunctionReturnValue __iterator_destroy(CallFrame frame, Variant[] args) 35 | { 36 | _iterators.TryRemove(args[0].ToString(), out _); 37 | 38 | return Variant.Null; 39 | } 40 | 41 | public static FunctionReturnValue __iterator_canmove(CallFrame frame, Variant[] args) => 42 | Variant.FromBoolean(_iterators.TryGetValue(args[0].ToString(), out var iterator) && iterator.index < iterator.collection.Length); 43 | 44 | public static FunctionReturnValue __iterator_movenext(CallFrame frame, Variant[] args) 45 | { 46 | if (_iterators.TryGetValue(args[0].ToString(), out var iterator)) 47 | _iterators.TryUpdate(args[0].ToString(), (iterator.collection, iterator.index + 1), iterator); 48 | 49 | return Variant.Null; 50 | } 51 | 52 | public static FunctionReturnValue __iterator_currentkey(CallFrame frame, Variant[] args) 53 | { 54 | if (_iterators.TryGetValue(args[0].ToString(), out var iterator)) 55 | return iterator.collection[iterator.index].key; 56 | 57 | return Variant.Null; 58 | } 59 | 60 | public static FunctionReturnValue __iterator_currentvalue(CallFrame frame, Variant[] args) 61 | { 62 | if (_iterators.TryGetValue(args[0].ToString(), out var iterator)) 63 | return iterator.collection[iterator.index].value; 64 | 65 | return Variant.Null; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ColorConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be included in an AutoIt v3 script. 8 | ; Author(s) .....: JLandes, Nutster, CyberSlug, Holger, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | 13 | ; Colour Constants RGB Hex 14 | Global Const $COLOR_AQUA = 0x00FFFF 15 | Global Const $COLOR_BLACK = 0x000000 16 | Global Const $COLOR_BLUE = 0x0000FF 17 | Global Const $COLOR_CREAM = 0xFFFBF0 18 | Global Const $COLOR_FUCHSIA = 0xFF00FF 19 | Global Const $COLOR_GRAY = 0x808080 20 | Global Const $COLOR_GREEN = 0x008000 21 | Global Const $COLOR_LIME = 0x00FF00 22 | Global Const $COLOR_MAROON = 0x8B1C62 23 | Global Const $COLOR_MEDBLUE = 0x0002C4 24 | Global Const $COLOR_MEDGRAY = 0xA0A0A4 25 | Global Const $COLOR_MONEYGREEN = 0xC0DCC0 26 | Global Const $COLOR_NAVY = 0x000080 27 | Global Const $COLOR_OLIVE = 0x808000 28 | Global Const $COLOR_PURPLE = 0x800080 29 | Global Const $COLOR_RED = 0xFF0000 30 | Global Const $COLOR_SILVER = 0xC0C0C0 31 | Global Const $COLOR_SKYBLUE = 0xA6CAF0 32 | Global Const $COLOR_TEAL = 0x008080 33 | Global Const $COLOR_WHITE = 0xFFFFFF 34 | Global Const $COLOR_YELLOW = 0xFFFF00 35 | 36 | Global Const $CLR_NONE = 0xFFFFFFFF 37 | Global Const $CLR_DEFAULT = 0xFF000000 38 | 39 | ; Color Constants BGR Hex 40 | Global Const $CLR_AQUA = 0xFFFF00 41 | Global Const $CLR_BLACK = 0x000000 42 | Global Const $CLR_BLUE = 0xFF0000 43 | Global Const $CLR_CREAM = 0xF0FBFF 44 | Global Const $CLR_FUCHSIA = 0xFF00FF 45 | Global Const $CLR_GRAY = 0x808080 46 | Global Const $CLR_GREEN = 0x008000 47 | Global Const $CLR_LIME = 0x00FF00 48 | Global Const $CLR_MAROON = 0x621C8B 49 | Global Const $CLR_MEDBLUE = 0xC40200 50 | Global Const $CLR_MEDGRAY = 0xA4A0A0 51 | Global Const $CLR_MONEYGREEN = 0xC0DCC0 52 | Global Const $CLR_NAVY = 0x800000 53 | Global Const $CLR_OLIVE = 0x008080 54 | Global Const $CLR_PURPLE = 0x800080 55 | Global Const $CLR_RED = 0x0000FF 56 | Global Const $CLR_SILVER = 0xC0C0C0 57 | Global Const $CLR_SKYBLUE = 0xF0CAA6 58 | Global Const $CLR_TEAL = 0x808000 59 | Global Const $CLR_WHITE = 0xFFFFFF 60 | Global Const $CLR_YELLOW = 0x00FFFF 61 | 62 | ; Color Dialog constants 63 | Global Const $CC_ANYCOLOR = 0x0100 64 | Global Const $CC_FULLOPEN = 0x0002 65 | Global Const $CC_RGBINIT = 0x0001 66 | ; =============================================================================================================================== 67 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/TrayConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be included in an AutoIt v3 script. 8 | ; Author(s) .....: JLandes, Nutster, CyberSlug, Holger, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | 13 | ; Tray predefined ID's 14 | Global Const $TRAY_ITEM_EXIT = 3 15 | Global Const $TRAY_ITEM_PAUSE = 4 16 | Global Const $TRAY_ITEM_FIRST = 7 17 | 18 | ; Tray menu/item state values 19 | Global Const $TRAY_CHECKED = 1 20 | Global Const $TRAY_UNCHECKED = 4 21 | Global Const $TRAY_ENABLE = 64 22 | Global Const $TRAY_DISABLE = 128 23 | Global Const $TRAY_FOCUS = 256 24 | Global Const $TRAY_DEFAULT = 512 25 | 26 | ; Tray event values 27 | Global Const $TRAY_EVENT_NONE = 0 28 | Global Const $TRAY_EVENT_SHOWICON = -3 29 | Global Const $TRAY_EVENT_HIDEICON = -4 30 | Global Const $TRAY_EVENT_FLASHICON = -5 31 | Global Const $TRAY_EVENT_NOFLASHICON = -6 32 | Global Const $TRAY_EVENT_PRIMARYDOWN = -7 33 | Global Const $TRAY_EVENT_PRIMARYUP = -8 34 | Global Const $TRAY_EVENT_SECONDARYDOWN = -9 35 | Global Const $TRAY_EVENT_SECONDARYUP = -10 36 | Global Const $TRAY_EVENT_MOUSEOVER = -11 37 | Global Const $TRAY_EVENT_MOUSEOUT = -12 38 | Global Const $TRAY_EVENT_PRIMARYDOUBLE = -13 39 | Global Const $TRAY_EVENT_SECONDARYDOUBLE = -14 40 | 41 | ; Indicates the type of Balloon Tip to display 42 | Global Const $TIP_ICONNONE = 0 ; No icon (default) 43 | Global Const $TIP_ICONASTERISK = 1 ; Info icon 44 | Global Const $TIP_ICONEXCLAMATION = 2 ; Warning icon 45 | Global Const $TIP_ICONHAND = 3 ; Error icon 46 | Global Const $TIP_NOSOUND = 16 ; No sound 47 | 48 | ; TrayCreateItem values 49 | Global Const $TRAY_ITEM_NORMAL = 0 50 | Global Const $TRAY_ITEM_RADIO = 1 51 | 52 | ; TraySetClick values 53 | Global Const $TRAY_CLICK_SHOW = 0 54 | Global Const $TRAY_CLICK_PRIMARYDOWN = 1 55 | Global Const $TRAY_CLICK_PRIMARYUP = 2 56 | Global Const $TRAY_DBLCLICK_PRIMARY= 4 57 | Global Const $TRAY_CLICK_SECONDARYDOWN = 8 58 | Global Const $TRAY_CLICK_SECONDARYUP = 16 59 | Global Const $TRAY_DBLCLICK_SECONDARY= 32 60 | Global Const $TRAY_CLICK_HOVERING= 64 61 | 62 | ; TraySetState values 63 | Global Const $TRAY_ICONSTATE_SHOW = 1 64 | Global Const $TRAY_ICONSTATE_HIDE = 2 65 | Global Const $TRAY_ICONSTATE_FLASH = 4 66 | Global Const $TRAY_ICONSTATE_STOPFLASH = 8 67 | Global Const $TRAY_ICONSTATE_RESET = 16 68 | ; =============================================================================================================================== 69 | -------------------------------------------------------------------------------- /lib/Piglet.FSharp.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v3.1", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v3.1": { 9 | "Piglet.FSharp/1.0.0": { 10 | "dependencies": { 11 | "FSharp.Core": "4.7.2", 12 | "Piglet": "1.6.0" 13 | }, 14 | "runtime": { 15 | "Piglet.FSharp.dll": {} 16 | } 17 | }, 18 | "FSharp.Core/4.7.2": { 19 | "runtime": { 20 | "lib/netstandard2.0/FSharp.Core.dll": { 21 | "assemblyVersion": "4.7.0.0", 22 | "fileVersion": "4.700.20.27008" 23 | } 24 | }, 25 | "resources": { 26 | "lib/netstandard2.0/cs/FSharp.Core.resources.dll": { 27 | "locale": "cs" 28 | }, 29 | "lib/netstandard2.0/de/FSharp.Core.resources.dll": { 30 | "locale": "de" 31 | }, 32 | "lib/netstandard2.0/es/FSharp.Core.resources.dll": { 33 | "locale": "es" 34 | }, 35 | "lib/netstandard2.0/fr/FSharp.Core.resources.dll": { 36 | "locale": "fr" 37 | }, 38 | "lib/netstandard2.0/it/FSharp.Core.resources.dll": { 39 | "locale": "it" 40 | }, 41 | "lib/netstandard2.0/ja/FSharp.Core.resources.dll": { 42 | "locale": "ja" 43 | }, 44 | "lib/netstandard2.0/ko/FSharp.Core.resources.dll": { 45 | "locale": "ko" 46 | }, 47 | "lib/netstandard2.0/pl/FSharp.Core.resources.dll": { 48 | "locale": "pl" 49 | }, 50 | "lib/netstandard2.0/pt-BR/FSharp.Core.resources.dll": { 51 | "locale": "pt-BR" 52 | }, 53 | "lib/netstandard2.0/ru/FSharp.Core.resources.dll": { 54 | "locale": "ru" 55 | }, 56 | "lib/netstandard2.0/tr/FSharp.Core.resources.dll": { 57 | "locale": "tr" 58 | }, 59 | "lib/netstandard2.0/zh-Hans/FSharp.Core.resources.dll": { 60 | "locale": "zh-Hans" 61 | }, 62 | "lib/netstandard2.0/zh-Hant/FSharp.Core.resources.dll": { 63 | "locale": "zh-Hant" 64 | } 65 | } 66 | }, 67 | "Piglet/1.6.0": { 68 | "runtime": { 69 | "Piglet.dll": {} 70 | } 71 | } 72 | } 73 | }, 74 | "libraries": { 75 | "Piglet.FSharp/1.0.0": { 76 | "type": "project", 77 | "serviceable": false, 78 | "sha512": "" 79 | }, 80 | "FSharp.Core/4.7.2": { 81 | "type": "package", 82 | "serviceable": true, 83 | "sha512": "sha512-w3XFVTnyZUbC8e2QT6a85ern6y7eQPPk+MYemz1FP0iBfgZcembL+wmo5cIZ1kxB8jfoXC8Q9KVkOMsGpkBKbA==", 84 | "path": "fsharp.core/4.7.2", 85 | "hashPath": "fsharp.core.4.7.2.nupkg.sha512" 86 | }, 87 | "Piglet/1.6.0": { 88 | "type": "project", 89 | "serviceable": false, 90 | "sha512": "" 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/StringConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: String_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be included in an AutoIt v3 script when using String functions. 8 | ; Author(s) .....: guinness, jpm 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; StringCompare, StringInStr, StringReplace constants 13 | ; Indicates if string operations should be case sensitive 14 | Global Const $STR_NOCASESENSE = 0 ; Not case sensitive (default) 15 | Global Const $STR_CASESENSE = 1 ; Case sensitive 16 | Global Const $STR_NOCASESENSEBASIC = 2 ; Not case sensitive, using a basic comparison 17 | 18 | ; StringStripWS Constants 19 | ; Indicates the type of stripping that should be performed 20 | Global Const $STR_STRIPLEADING = 1 ; Strip leading whitespace 21 | Global Const $STR_STRIPTRAILING = 2 ; Strip trailing whitespace 22 | Global Const $STR_STRIPSPACES = 4 ; Strip double (or more) spaces between words 23 | Global Const $STR_STRIPALL = 8 ; Strip all spaces (over-rides all other flags) 24 | 25 | ; StringSplit Constants 26 | Global Const $STR_CHRSPLIT = 0 ; Each character in the delimiter string will mark the split 27 | Global Const $STR_ENTIRESPLIT = 1 ; Entire delimiter marks the split 28 | Global Const $STR_NOCOUNT = 2 ; Disable the return count 29 | 30 | ; StringRegExp Constants 31 | Global Const $STR_REGEXPMATCH = 0 ; Return 1 if match. 32 | Global Const $STR_REGEXPARRAYMATCH = 1 ; Return array of matches. 33 | Global Const $STR_REGEXPARRAYFULLMATCH = 2 ; Return array of matches including the full match (Perl / PHP style). 34 | Global Const $STR_REGEXPARRAYGLOBALMATCH = 3 ; Return array of global matches. 35 | Global Const $STR_REGEXPARRAYGLOBALFULLMATCH = 4 ; Return an array of arrays containing global matches including the full match (Perl / PHP style).Global Const $STR_REGEXPMATCH = 0 ; Each character in the delimiter string will mark the split 36 | 37 | ; _StringBetween Constants 38 | Global Const $STR_ENDISSTART = 0 ; End acts as next start when end = start 39 | Global Const $STR_ENDNOTSTART = 1 ; End does not act as new start when end = start 40 | 41 | ; BinaryToString, StringToBinary constants 42 | Global Const $SB_ANSI = 1 43 | Global Const $SB_UTF16LE = 2 44 | Global Const $SB_UTF16BE = 3 45 | Global Const $SB_UTF8 = 4 46 | 47 | ; StringFromASCIIArray constants 48 | Global Const $SE_UTF16 = 0 49 | Global Const $SE_ANSI = 1 50 | Global Const $SE_UTF8 = 2 51 | 52 | ; StringReverse Constants 53 | Global Const $STR_UTF16 = 0 54 | Global Const $STR_UCS2 = 1 55 | ; =============================================================================================================================== 56 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/APIDiagConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: WinAPIDiag Constants UDF Library for AutoIt3 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants that can be used with UDF library 8 | ; Author(s) .....: Yashied, Jpm 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | 13 | ; _WinAPI_EnumDllProc() 14 | Global Const $SYMOPT_ALLOW_ABSOLUTE_SYMBOLS = 0x00000800 15 | Global Const $SYMOPT_ALLOW_ZERO_ADDRESS = 0x01000000 16 | Global Const $SYMOPT_AUTO_PUBLICS = 0x00010000 17 | Global Const $SYMOPT_CASE_INSENSITIVE = 0x00000001 18 | Global Const $SYMOPT_DEBUG = 0x80000000 19 | Global Const $SYMOPT_DEFERRED_LOADS = 0x00000004 20 | Global Const $SYMOPT_DISABLE_SYMSRV_AUTODETECT = 0x02000000 21 | Global Const $SYMOPT_EXACT_SYMBOLS = 0x00000400 22 | Global Const $SYMOPT_FAIL_CRITICAL_ERRORS = 0x00000200 23 | Global Const $SYMOPT_FAVOR_COMPRESSED = 0x00800000 24 | Global Const $SYMOPT_FLAT_DIRECTORY = 0x00400000 25 | Global Const $SYMOPT_IGNORE_CVREC = 0x00000080 26 | Global Const $SYMOPT_IGNORE_IMAGEDIR = 0x00200000 27 | Global Const $SYMOPT_IGNORE_NT_SYMPATH = 0x00001000 28 | Global Const $SYMOPT_INCLUDE_32BIT_MODULES = 0x00002000 29 | Global Const $SYMOPT_LOAD_ANYTHING = 0x00000040 30 | Global Const $SYMOPT_LOAD_LINES = 0x00000010 31 | Global Const $SYMOPT_NO_CPP = 0x00000008 32 | Global Const $SYMOPT_NO_IMAGE_SEARCH = 0x00020000 33 | Global Const $SYMOPT_NO_PROMPTS = 0x00080000 34 | Global Const $SYMOPT_NO_PUBLICS = 0x00008000 35 | Global Const $SYMOPT_NO_UNQUALIFIED_LOADS = 0x00000100 36 | Global Const $SYMOPT_OVERWRITE = 0x00100000 37 | Global Const $SYMOPT_PUBLICS_ONLY = 0x00004000 38 | Global Const $SYMOPT_SECURE = 0x00040000 39 | Global Const $SYMOPT_UNDNAME = 0x00000002 40 | 41 | ; _WinAPI_GetErrorMode(), _WinAPI_SetErrorMode() 42 | Global Const $SEM_FAILCRITICALERRORS = 0x0001 43 | Global Const $SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 44 | Global Const $SEM_NOGPFAULTERRORBOX = 0x0002 45 | Global Const $SEM_NOOPENFILEERRORBOX = 0x8000 46 | 47 | ; _WinAPI_IsNetworkAlive() 48 | Global Const $NETWORK_ALIVE_LAN = 0x01 49 | Global Const $NETWORK_ALIVE_WAN = 0x02 50 | Global Const $NETWORK_ALIVE_AOL = 0x04 51 | 52 | ; _WinAPI_RegisterApplicationRestart() 53 | Global Const $RESTART_NO_CRASH = 0x01 54 | Global Const $RESTART_NO_HANG = 0x02 55 | Global Const $RESTART_NO_PATCH = 0x04 56 | Global Const $RESTART_NO_REBOOT = 0x08 57 | 58 | ; _WinAPI_UniqueHardwareID() 59 | Global Const $UHID_MB = 0x00 60 | Global Const $UHID_BIOS = 0x01 61 | Global Const $UHID_CPU = 0x02 62 | Global Const $UHID_HDD = 0x04 63 | Global Const $UHID_All = BitOR($UHID_MB, $UHID_BIOS, $UHID_CPU, $UHID_HDD) 64 | ; =============================================================================================================================== 65 | -------------------------------------------------------------------------------- /src/util/AutoIt3.Updater/Updater.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Linq; 3 | using System.IO; 4 | using System; 5 | 6 | namespace Unknown6656.AutoIt3.Updater; 7 | 8 | public static class Updater 9 | { 10 | /* ARGUMENTS: 11 | * 12 | */ 13 | public static int Main(string[] args) 14 | { 15 | try 16 | { 17 | bool proxy = bool.Parse(args[0]); 18 | 19 | if (proxy) 20 | { 21 | ProcessStartInfo psi = new() 22 | { 23 | FileName = "dotnet", 24 | UseShellExecute = false, // TODO : check if this works under linux and macos 25 | }; 26 | 27 | psi.ArgumentList.Add(typeof(Updater).Assembly.Location); 28 | psi.ArgumentList.Add(false.ToString()); 29 | 30 | foreach (string arg in args.Skip(1)) 31 | psi.ArgumentList.Add(arg); 32 | 33 | using Process proc = Process.Start(psi)!; 34 | 35 | proc.WaitForExit(); 36 | 37 | return proc.ExitCode; 38 | } 39 | else 40 | { 41 | string dir = args[1]; 42 | string prefix = args[2]; 43 | int pid = int.Parse(args[3]); 44 | string exe = args[4]; 45 | args = args[5..]; 46 | 47 | Directory.SetCurrentDirectory(dir); 48 | 49 | try 50 | { 51 | using Process existing = Process.GetProcessById(pid); 52 | 53 | Console.WriteLine($"Killing {pid} (0x{pid:x8}) ..."); 54 | 55 | existing.Kill(); 56 | } 57 | catch 58 | { 59 | } 60 | 61 | foreach (string file in Directory.EnumerateFiles(dir, prefix + '*', SearchOption.AllDirectories)) 62 | { 63 | Console.WriteLine($"Deleting '{file}' ..."); 64 | 65 | File.Delete(file); 66 | } 67 | 68 | Console.WriteLine($"Starting '{exe}' ..."); 69 | 70 | ProcessStartInfo psi = new() 71 | { 72 | FileName = "dotnet", 73 | UseShellExecute = false, 74 | }; 75 | 76 | psi.ArgumentList.Add(exe); 77 | 78 | foreach (string arg in args) 79 | psi.ArgumentList.Add(arg); 80 | 81 | using Process process = Process.Start(psi)!; 82 | 83 | process.WaitForExit(); 84 | 85 | if (!Debugger.IsAttached) 86 | { 87 | Console.WriteLine("\n\nPress any key to close the program ..."); 88 | Console.ReadKey(true); 89 | } 90 | 91 | return process.ExitCode; 92 | } 93 | } 94 | catch (Exception ex) 95 | { 96 | Console.Error.WriteLine(ex); 97 | 98 | return ex.HResult; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Report an issue, error, bug, or incorrect behavior. 3 | title: "[BUG] " 4 | labels: ["bug"] 5 | projects: ["Unknown6656/2"] 6 | assignees: 7 | - Unknown6656 8 | body: 9 | - type: markdown 10 | attributes: 11 | value: | 12 | # AutoIt3 Interpreter Bug Report 13 | Thanks for taking the time to fill out this bug report! 14 | - type: textarea 15 | id: bug-summary 16 | attributes: 17 | label: Bug Description 18 | description: A clear and concise description of what the bug is. Include a stack trace, console output, debug dump, and/or screenshots. 19 | placeholder: What happened? 20 | - type: textarea 21 | id: reproduce-steps 22 | attributes: 23 | label: Steps to reproduce the Bug 24 | description: A list describing on how to reproduce the behavior. 25 | placeholder: | 26 | 1. Type '...' 27 | 2. Execute '....' 28 | 3. Scroll down to '....' 29 | 4. See error 30 | - type: textarea 31 | id: expected-behavior 32 | attributes: 33 | label: Expected Behavior 34 | description: Instead of the behavior written above, what would you have expected the AutoIt interpreter to do? 35 | - type: markdown 36 | attributes: 37 | value: "## Environment and Version Information" 38 | - type: dropdown 39 | id: os-type 40 | attributes: 41 | label: Operating System Type 42 | multiple: true 43 | options: 44 | - Windows 45 | - MacOS 46 | - Linux 47 | - Other POSIX compliant OS 48 | - Other non-POSIX compliant OS 49 | - type: dropdown 50 | id: os-arch 51 | attributes: 52 | label: Operating System Architecture 53 | multiple: true 54 | options: 55 | - x86 56 | - x64 57 | - arm 58 | - arm64 59 | - Other 60 | - type: input 61 | id: os-name 62 | attributes: 63 | label: Operating System Descriptor 64 | description: Paste the result of executing `ver` (Windows) or `uname -a` (Unix) here. 65 | placeholder: "Microsoft Windows [Version 10.0.22631.3296]" 66 | validations: 67 | required: true 68 | - type: textarea 69 | id: interpreter-version 70 | attributes: 71 | label: AutoIt Interpreter Version 72 | description: | 73 | Paste the result of executing `./autoit3 --version` here, e.g.: 74 | ``` 75 | +-----------------+ 76 | | **+o. | 77 | | .=*.+ | AUTOIT3 INTERPRETER 78 | | . ++ o | Written by Unknown6656, 2018 - 2024 79 | | ...o | 80 | | +S E | https://github.com/Unknown6656/AutoIt-Interpreter/ 81 | | . +.o. +. | 82 | | B o.*.o+ | Version 0.12.2274.8640, a555aba17d74e5df3628eb44edcbe54d9397f583 83 | | + * =.Oo.. | B5CF99E91A99B93C2EA925B24ED78D670267ABF5453103429E7064F30C94DEB6 84 | | +o=o*.o. | 85 | +-----------------+ 86 | ``` 87 | placeholder: 88 | render: text 89 | - type: textarea 90 | id: additional-info 91 | attributes: 92 | label: Additional Information 93 | description: Additional information you'd like to provide. 94 | placeholder: Did we miss anything? 95 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/StatusBarConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: StatusBar_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for StatusBar functions. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; Styles 13 | Global Const $SBARS_SIZEGRIP = 0x100 14 | Global Const $SBT_TOOLTIPS = 0x800 15 | Global Const $SBARS_TOOLTIPS = 0x800 16 | 17 | ; uFlags 18 | Global Const $SBT_SUNKEN = 0x0 ;Default 19 | Global Const $SBT_NOBORDERS = 0x100 ;The text is drawn without borders. 20 | Global Const $SBT_POPOUT = 0x200 ; The text is drawn with a border to appear higher than the plane of the window. 21 | Global Const $SBT_RTLREADING = 0x400 ;SB_SETTEXT, SB_SETTEXT, SB_GETTEXTLENGTH flags only: Displays text using right-to-left reading order on Hebrew or Arabic systems. 22 | Global Const $SBT_NOTABPARSING = 0x800 ;Tab characters are ignored. 23 | Global Const $SBT_OWNERDRAW = 0x1000 ;The text is drawn by the parent window. 24 | 25 | ; Messages 26 | Global Const $__STATUSBARCONSTANT_WM_USER = 0X400 27 | Global Const $SB_GETBORDERS = ($__STATUSBARCONSTANT_WM_USER + 7) 28 | Global Const $SB_GETICON = ($__STATUSBARCONSTANT_WM_USER + 20) 29 | Global Const $SB_GETPARTS = ($__STATUSBARCONSTANT_WM_USER + 6) 30 | Global Const $SB_GETRECT = ($__STATUSBARCONSTANT_WM_USER + 10) 31 | Global Const $SB_GETTEXTA = ($__STATUSBARCONSTANT_WM_USER + 2) 32 | Global Const $SB_GETTEXTW = ($__STATUSBARCONSTANT_WM_USER + 13) 33 | Global Const $SB_GETTEXT = $SB_GETTEXTA 34 | Global Const $SB_GETTEXTLENGTHA = ($__STATUSBARCONSTANT_WM_USER + 3) 35 | Global Const $SB_GETTEXTLENGTHW = ($__STATUSBARCONSTANT_WM_USER + 12) 36 | Global Const $SB_GETTEXTLENGTH = $SB_GETTEXTLENGTHA 37 | Global Const $SB_GETTIPTEXTA = ($__STATUSBARCONSTANT_WM_USER + 18) 38 | Global Const $SB_GETTIPTEXTW = ($__STATUSBARCONSTANT_WM_USER + 19) 39 | Global Const $SB_GETUNICODEFORMAT = 0x2000 + 6 40 | 41 | Global Const $SB_ISSIMPLE = ($__STATUSBARCONSTANT_WM_USER + 14) 42 | 43 | Global Const $SB_SETBKCOLOR = 0x2000 + 1 44 | Global Const $SB_SETICON = ($__STATUSBARCONSTANT_WM_USER + 15) 45 | Global Const $SB_SETMINHEIGHT = ($__STATUSBARCONSTANT_WM_USER + 8) 46 | Global Const $SB_SETPARTS = ($__STATUSBARCONSTANT_WM_USER + 4) 47 | Global Const $SB_SETTEXTA = ($__STATUSBARCONSTANT_WM_USER + 1) 48 | Global Const $SB_SETTEXTW = ($__STATUSBARCONSTANT_WM_USER + 11) 49 | Global Const $SB_SETTEXT = $SB_SETTEXTA 50 | Global Const $SB_SETTIPTEXTA = ($__STATUSBARCONSTANT_WM_USER + 16) 51 | Global Const $SB_SETTIPTEXTW = ($__STATUSBARCONSTANT_WM_USER + 17) 52 | Global Const $SB_SETUNICODEFORMAT = 0x2000 + 5 53 | Global Const $SB_SIMPLE = ($__STATUSBARCONSTANT_WM_USER + 9) 54 | 55 | Global Const $SB_SIMPLEID = 0xff 56 | 57 | ; Notifications 58 | Global Const $SBN_FIRST = -880 59 | Global Const $SBN_SIMPLEMODECHANGE = $SBN_FIRST - 0 ; Sent when the simple mode changes due to a $SB_SIMPLE message 60 | ; =============================================================================================================================== 61 | -------------------------------------------------------------------------------- /test/unittest-loop.au3: -------------------------------------------------------------------------------- 1 | #cs 2 | SCRIPT FOR UNIT-TESTING THE INTERPRETER 3 | 4 | THE INTERPERETER OUTPUT SHOULD BE: 5 | for 1->5: 12345 6 | for 5->1: 54321 7 | for in: 12345 8 | do 5->1: 54321 9 | while 5->1: 54321 10 | for 1->5: 123. 11 | for 5->1: 543. 12 | for in: 123. 13 | do 5->1: 543. 14 | while 5->1: 543. 15 | for 1->5: 12^45 16 | for 5->1: 54^21 17 | for in: 12^45 18 | do 5->1: 4^210 19 | while 5->1: 4^210 20 | #ce 21 | 22 | ConsoleWrite("for 1->5: ") 23 | for $i = 1 to 5 step 1 24 | ConsoleWrite($i) 25 | next 26 | ConsoleWrite(@CRLF) 27 | ConsoleWrite("for 5->1: ") 28 | for $i = 5 to 1 step -1 29 | ConsoleWrite($i) 30 | next 31 | ConsoleWrite(@CRLF) 32 | ConsoleWrite("for in: ") 33 | dim $arr = [1,2,3,4,5] 34 | for $i in $arr 35 | ConsoleWrite($i) 36 | next 37 | ConsoleWrite(@CRLF) 38 | ConsoleWrite("do 5->1: ") 39 | $i = 5 40 | do 41 | ConsoleWrite($i) 42 | $i-=1 43 | until not $i 44 | ConsoleWrite(@CRLF) 45 | ConsoleWrite("while 5->1: ") 46 | $i = 5 47 | while $i 48 | ConsoleWrite($i) 49 | $i-=1 50 | wend 51 | ConsoleWrite(@CRLF) 52 | ConsoleWrite("for 1->5: ") 53 | for $i = 1 to 5 step 1 54 | ConsoleWrite($i) 55 | If $i = 3 Then 56 | ConsoleWrite('.') 57 | ExitLoop 58 | EndIf 59 | next 60 | ConsoleWrite(@CRLF) 61 | ConsoleWrite("for 5->1: ") 62 | for $i = 5 to 1 step -1 63 | ConsoleWrite($i) 64 | If $i = 3 Then 65 | ConsoleWrite('.') 66 | ExitLoop 67 | EndIf 68 | next 69 | ConsoleWrite(@CRLF) 70 | ConsoleWrite("for in: ") 71 | dim $arr = [1,2,3,4,5] 72 | for $i in $arr 73 | ConsoleWrite($i) 74 | If $i = 3 Then 75 | ConsoleWrite('.') 76 | ExitLoop 77 | EndIf 78 | next 79 | ConsoleWrite(@CRLF) 80 | ConsoleWrite("do 5->1: ") 81 | $i = 5 82 | do 83 | ConsoleWrite($i) 84 | If $i = 3 Then 85 | ConsoleWrite('.') 86 | ExitLoop 87 | EndIf 88 | $i-=1 89 | until not $i 90 | ConsoleWrite(@CRLF) 91 | ConsoleWrite("while 5->1: ") 92 | $i = 5 93 | while $i 94 | ConsoleWrite($i) 95 | If $i = 3 Then 96 | ConsoleWrite('.') 97 | ExitLoop 98 | EndIf 99 | $i-=1 100 | wend 101 | ConsoleWrite(@CRLF) 102 | ConsoleWrite("for 1->5: ") 103 | for $i = 1 to 5 step 1 104 | If $i = 3 Then 105 | ConsoleWrite('^') 106 | ContinueLoop 107 | Else 108 | ConsoleWrite($i) 109 | EndIf 110 | next 111 | ConsoleWrite(@CRLF) 112 | ConsoleWrite("for 5->1: ") 113 | for $i = 5 to 1 step -1 114 | If $i = 3 Then 115 | ConsoleWrite('^') 116 | ContinueLoop 117 | Else 118 | ConsoleWrite($i) 119 | EndIf 120 | next 121 | ConsoleWrite(@CRLF) 122 | ConsoleWrite("for in: ") 123 | dim $arr = [1,2,3,4,5] 124 | for $i in $arr 125 | If $i = 3 Then 126 | ConsoleWrite('^') 127 | ContinueLoop 128 | Else 129 | ConsoleWrite($i) 130 | EndIf 131 | next 132 | ConsoleWrite(@CRLF) 133 | ConsoleWrite("do 5->1: ") 134 | $i = 5 135 | do 136 | $i-=1 137 | If $i = 3 Then 138 | ConsoleWrite('^') 139 | ContinueLoop 140 | else 141 | ConsoleWrite($i) 142 | EndIf 143 | until not $i 144 | ConsoleWrite(@CRLF) 145 | ConsoleWrite("while 5->1: ") 146 | $i = 5 147 | while $i 148 | $i-=1 149 | If $i = 3 Then 150 | ConsoleWrite('^') 151 | ContinueLoop 152 | else 153 | ConsoleWrite($i) 154 | EndIf 155 | wend 156 | ConsoleWrite(@CRLF) 157 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/APIShPathConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: WinAPISPath Constants UDF Library for AutoIt3 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants that can be used with UDF library 8 | ; Author(s) .....: Yashied, Jpm 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | 13 | ; _WinAPI_ParseURL() 14 | Global Const $URL_SCHEME_INVALID = -1 15 | Global Const $URL_SCHEME_UNKNOWN = 0 16 | Global Const $URL_SCHEME_FTP = 1 17 | Global Const $URL_SCHEME_HTTP = 2 18 | Global Const $URL_SCHEME_GOPHER = 3 19 | Global Const $URL_SCHEME_MAILTO = 4 20 | Global Const $URL_SCHEME_NEWS = 5 21 | Global Const $URL_SCHEME_NNTP = 6 22 | Global Const $URL_SCHEME_TELNET = 7 23 | Global Const $URL_SCHEME_WAIS = 8 24 | Global Const $URL_SCHEME_FILE = 9 25 | Global Const $URL_SCHEME_MK = 10 26 | Global Const $URL_SCHEME_HTTPS = 11 27 | Global Const $URL_SCHEME_SHELL = 12 28 | Global Const $URL_SCHEME_SNEWS = 13 29 | Global Const $URL_SCHEME_LOCAL = 14 30 | Global Const $URL_SCHEME_JAVASCRIPT = 15 31 | Global Const $URL_SCHEME_VBSCRIPT = 16 32 | Global Const $URL_SCHEME_ABOUT = 17 33 | Global Const $URL_SCHEME_RES = 18 34 | Global Const $URL_SCHEME_MSSHELLROOTED = 19 35 | Global Const $URL_SCHEME_MSSHELLIDLIST = 20 36 | Global Const $URL_SCHEME_MSHELP = 21 37 | Global Const $URL_SCHEME_MSSHELLDEVICE = 22 38 | Global Const $URL_SCHEME_WILDCARD = 23 39 | Global Const $URL_SCHEME_SEARCH_MS = 24 40 | Global Const $URL_SCHEME_SEARCH = 25 41 | Global Const $URL_SCHEME_KNOWNFOLDER = 26 42 | 43 | ; _WinAPI_PathGetCharType() 44 | Global Const $GCT_INVALID = 0x00 45 | Global Const $GCT_LFNCHAR = 0x01 46 | Global Const $GCT_SEPARATOR = 0x08 47 | Global Const $GCT_SHORTCHAR = 0x02 48 | Global Const $GCT_WILD = 0x04 49 | 50 | ; _WinAPI_UrlApplyScheme() 51 | Global Const $URL_APPLY_DEFAULT = 0x01 52 | Global Const $URL_APPLY_GUESSSCHEME = 0x02 53 | Global Const $URL_APPLY_GUESSFILE = 0x04 54 | Global Const $URL_APPLY_FORCEAPPLY = 0x08 55 | 56 | ; _WinAPI_UrlCanonicalize(), _WinAPI_UrlCombine() 57 | Global Const $URL_DONT_SIMPLIFY = 0x08000000 58 | Global Const $URL_ESCAPE_AS_UTF8 = 0x00040000 59 | Global Const $URL_ESCAPE_PERCENT = 0x00001000 60 | Global Const $URL_ESCAPE_SPACES_ONLY = 0x04000000 61 | Global Const $URL_ESCAPE_UNSAFE = 0x20000000 62 | Global Const $URL_NO_META = 0x08000000 63 | Global Const $URL_PLUGGABLE_PROTOCOL = 0x40000000 64 | Global Const $URL_UNESCAPE = 0x10000000 65 | 66 | ; _WinAPI_UrlGetPart() 67 | Global Const $URL_PART_HOSTNAME = 2 68 | Global Const $URL_PART_PASSWORD = 4 69 | Global Const $URL_PART_PORT = 5 70 | Global Const $URL_PART_QUERY = 6 71 | Global Const $URL_PART_SCHEME = 1 72 | Global Const $URL_PART_USERNAME = 3 73 | 74 | ; _WinAPI_UrlIs() 75 | Global Const $URLIS_APPLIABLE = 4 76 | Global Const $URLIS_DIRECTORY = 5 77 | Global Const $URLIS_FILEURL = 3 78 | Global Const $URLIS_HASQUERY = 6 79 | Global Const $URLIS_NOHISTORY = 2 80 | Global Const $URLIS_OPAQUE = 1 81 | Global Const $URLIS_URL = 0 82 | ; =============================================================================================================================== 83 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/Variable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Unknown6656.AutoIt3.Runtime; 4 | 5 | 6 | /// 7 | /// Represents a variable capable of holding a value of the type . 8 | /// Variables are identified using their case-insensitive name and a '$'-prefix. 9 | /// 10 | public sealed class Variable 11 | : IEquatable 12 | { 13 | private readonly object _mutex = new(); 14 | private Variant _value; 15 | 16 | 17 | /// 18 | /// The variable's lower-case name without the '$'-prefix. 19 | /// 20 | public string Name { get; } 21 | 22 | /// 23 | /// Indicates whether the variable has been declared or marked as . 24 | /// 25 | public bool IsConst { get; } 26 | 27 | /// 28 | /// Indicates whether the variable is a -reference pointing to an other variable. 29 | /// 30 | public bool IsReference => _value.IsReference; 31 | 32 | /// 33 | /// Returns the variable (if any) to which the current instance is pointing to (Only relevant for -variables). 34 | /// 35 | public Variable? ReferencedVariable => _value.ReferencedVariable; 36 | 37 | /// 38 | /// The scope in which the current variable has been declared. 39 | /// 40 | public VariableScope DeclaredScope { get; } 41 | 42 | /// 43 | /// The source location at which the current variable has been declared. 44 | /// 45 | public SourceLocation DeclaredLocation { get; } 46 | 47 | /// 48 | /// Sets or gets the value stored inside the current variable. 49 | /// 50 | public Variant Value 51 | { 52 | get => ReferencedVariable?._value ?? _value; 53 | set 54 | { 55 | Variable? target = ReferencedVariable ?? this; 56 | 57 | lock (_mutex) 58 | target._value = value.AssignTo(target); 59 | } 60 | } 61 | 62 | /// 63 | /// The interpreter instance with which the current variable is associated. 64 | /// 65 | public Interpreter Interpreter => DeclaredScope.Interpreter; 66 | 67 | /// 68 | /// Indicates whether the variable has been declared or resides inside the global scope. 69 | /// 70 | public bool IsGlobal => DeclaredScope.IsGlobalScope; 71 | 72 | 73 | internal Variable(VariableScope scope, SourceLocation location, string name, bool isConst) 74 | { 75 | Name = name.TrimStart('$').ToLowerInvariant(); 76 | DeclaredLocation = location; 77 | DeclaredScope = scope; 78 | IsConst = isConst; 79 | Value = Variant.Null; 80 | } 81 | 82 | /// 83 | public override string ToString() => $"${Name}: {Value.ToDebugString(Interpreter)}"; 84 | 85 | /// 86 | public override int GetHashCode() => Name.GetHashCode(StringComparison.OrdinalIgnoreCase); 87 | 88 | /// 89 | public override bool Equals(object? obj) => (obj is Variable v && Equals(v)) 90 | || (obj is string s && Name.Equals(s, StringComparison.OrdinalIgnoreCase)); 91 | 92 | /// 93 | public bool Equals(Variable? other) => Name.Equals(other?.Name, StringComparison.OrdinalIgnoreCase); 94 | } 95 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/TimerManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using System.Collections.Immutable; 3 | using System.Threading.Tasks; 4 | using System.Threading; 5 | using System.Linq; 6 | using System; 7 | 8 | using Unknown6656.Common; 9 | 10 | namespace Unknown6656.AutoIt3.Runtime; 11 | 12 | public sealed class TimerManager 13 | : IDisposable 14 | { 15 | private readonly ConcurrentDictionary Task)> _timers = new(); 16 | private volatile bool _active = false; 17 | private ScriptFunction? _last = null; 18 | 19 | 20 | public Interpreter Interpreter { get; } 21 | 22 | public bool IsActive => _active; 23 | 24 | public ScriptFunction? MostRecentRegistration => _last; 25 | 26 | public int ActiveTimerCount => _timers.Count; 27 | 28 | public ImmutableDictionary ActiveTimers => _timers.ToImmutableDictionary(t => t.Key, t => t.Value.Interval); 29 | 30 | 31 | public TimerManager(Interpreter interpreter) => Interpreter = interpreter; 32 | 33 | public void Dispose() 34 | { 35 | StopAllTimers(); 36 | UnregisterAllTimers(); 37 | } 38 | 39 | public override string ToString() => $"({(_active ? "Active" : "Paused")}) {_timers.Count} timers."; 40 | 41 | public void StartAllTimers() => _active = true; 42 | 43 | public void StopAllTimers() => _active = false; 44 | 45 | public void UnregisterAllTimers() => _timers.Keys.ToArray().Select(UnregisterTimer); 46 | 47 | public void RegisterOrUpdateTimer(ScriptFunction function, int interval) 48 | { 49 | interval = Math.Max(interval, 1); 50 | 51 | if (_timers.TryGetValue(function, out (int, AU3Thread thread, Task task) value)) 52 | _timers[function] = (interval, value.thread, value.task); 53 | else 54 | { 55 | AU3Thread thread = Interpreter.CreateNewThread(); 56 | NativeFunction loop = NativeFunction.FromDelegate(Interpreter, frame => 57 | { 58 | FunctionReturnValue result = Variant.Zero; 59 | 60 | while (_timers.TryGetValue(function, out (int Interval, AU3Thread, Task) value)) 61 | { 62 | if (_active) 63 | result = frame.Interpreter.Telemetry.Measure(TelemetryCategory.TimedFunctions, () => frame.Call(function, [])); 64 | 65 | if (result.IsFatal(out _)) 66 | break; 67 | 68 | Thread.Sleep(value.Interval); 69 | } 70 | 71 | return result; 72 | }); 73 | 74 | var tuple = _timers[function] = (interval, thread, null)!; 75 | 76 | tuple.Task = thread.RunAsync(loop, [], InterpreterRunContext.Interactive); 77 | _timers[function] = tuple; 78 | } 79 | 80 | _last = function; 81 | } 82 | 83 | public bool UnregisterTimer(ScriptFunction function) 84 | { 85 | if (_timers.TryRemove(function, out (int, AU3Thread thread, Task task) value)) 86 | { 87 | value.thread.Stop(); 88 | value.task?.Wait(); 89 | 90 | return true; 91 | } 92 | else 93 | return false; 94 | } 95 | 96 | public bool HasTimer(ScriptFunction function, out int interval) 97 | { 98 | bool result = _timers.TryGetValue(function, out (int ival, AU3Thread, Task) tuple); 99 | 100 | interval = tuple.ival; 101 | 102 | return result; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/FontConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Font_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for Font functions. 8 | ; Author(s) .....: Gary Frost 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; fonts 13 | Global Const $FW_DONTCARE = 0 14 | Global Const $FW_THIN = 100 15 | Global Const $FW_EXTRALIGHT = 200 16 | Global Const $FW_ULTRALIGHT = 200 17 | Global Const $FW_LIGHT = 300 18 | Global Const $FW_NORMAL = 400 19 | Global Const $FW_REGULAR = 400 20 | Global Const $FW_MEDIUM = 500 21 | Global Const $FW_SEMIBOLD = 600 22 | Global Const $FW_DEMIBOLD = 600 23 | Global Const $FW_BOLD = 700 24 | Global Const $FW_EXTRABOLD = 800 25 | Global Const $FW_ULTRABOLD = 800 26 | Global Const $FW_HEAVY = 900 27 | Global Const $FW_BLACK = 900 28 | 29 | ; Font Dialog constants 30 | Global Const $CF_EFFECTS = 0x100 31 | Global Const $CF_PRINTERFONTS = 0x2 32 | Global Const $CF_SCREENFONTS = 0x1 33 | Global Const $CF_NOSCRIPTSEL = 0x800000 34 | Global Const $CF_INITTOLOGFONTSTRUCT = 0x40 35 | Global Const $LOGPIXELSX = 88 36 | Global Const $LOGPIXELSY = 90 37 | 38 | ; Font Char sets 39 | Global Const $ANSI_CHARSET = 0 40 | Global Const $ARABIC_CHARSET = 178 41 | Global Const $BALTIC_CHARSET = 186 42 | Global Const $CHINESEBIG5_CHARSET = 136 43 | Global Const $DEFAULT_CHARSET = 1 44 | Global Const $EASTEUROPE_CHARSET = 238 45 | Global Const $GB2312_CHARSET = 134 46 | Global Const $GREEK_CHARSET = 161 47 | Global Const $HANGEUL_CHARSET = 129 48 | Global Const $HEBREW_CHARSET = 177 49 | Global Const $JOHAB_CHARSET = 130 50 | Global Const $MAC_CHARSET = 77 51 | Global Const $OEM_CHARSET = 255 52 | Global Const $RUSSIAN_CHARSET = 204 53 | Global Const $SHIFTJIS_CHARSET = 128 54 | Global Const $SYMBOL_CHARSET = 2 55 | Global Const $THAI_CHARSET = 222 56 | Global Const $TURKISH_CHARSET = 162 57 | Global Const $VIETNAMESE_CHARSET = 163 58 | 59 | ; Font Output Precision 60 | Global Const $OUT_CHARACTER_PRECIS = 2 61 | Global Const $OUT_DEFAULT_PRECIS = 0 62 | Global Const $OUT_DEVICE_PRECIS = 5 63 | Global Const $OUT_OUTLINE_PRECIS = 8 64 | Global Const $OUT_PS_ONLY_PRECIS = 10 65 | Global Const $OUT_RASTER_PRECIS = 6 66 | Global Const $OUT_STRING_PRECIS = 1 67 | Global Const $OUT_STROKE_PRECIS = 3 68 | Global Const $OUT_TT_ONLY_PRECIS = 7 69 | Global Const $OUT_TT_PRECIS = 4 70 | 71 | ; Font clipping precision 72 | Global Const $CLIP_CHARACTER_PRECIS = 1 73 | Global Const $CLIP_DEFAULT_PRECIS = 0 74 | Global Const $CLIP_DFA_DISABLE = 0x0030 75 | Global Const $CLIP_EMBEDDED = 128 76 | Global Const $CLIP_LH_ANGLES = 16 77 | Global Const $CLIP_MASK = 0xF 78 | Global Const $CLIP_DFA_OVERRIDE = 0x0040 79 | Global Const $CLIP_STROKE_PRECIS = 2 80 | Global Const $CLIP_TT_ALWAYS = 32 81 | 82 | ; Font Quality 83 | Global Const $ANTIALIASED_QUALITY = 4 84 | Global Const $DEFAULT_QUALITY = 0 85 | Global Const $DRAFT_QUALITY = 1 86 | Global Const $NONANTIALIASED_QUALITY = 3 87 | Global Const $PROOF_QUALITY = 2 88 | Global Const $CLEARTYPE_QUALITY = 5 89 | 90 | ; pitch and family of the font 91 | Global Const $DEFAULT_PITCH = 0 92 | Global Const $FIXED_PITCH = 1 93 | Global Const $VARIABLE_PITCH = 2 94 | 95 | Global Const $FF_DECORATIVE = 80 96 | Global Const $FF_DONTCARE = 0 97 | Global Const $FF_MODERN = 48 98 | Global Const $FF_ROMAN = 16 99 | Global Const $FF_SCRIPT = 64 100 | Global Const $FF_SWISS = 32 101 | 102 | Global Const $FS_REGULAR = 0x00 103 | Global Const $FS_BOLD = 0x01 104 | Global Const $FS_ITALIC = 0x02 105 | ; =============================================================================================================================== 106 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/Process.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | #include "ProcessConstants.au3" 4 | 5 | ; #INDEX# ======================================================================================================================= 6 | ; Title .........: Process 7 | ; AutoIt Version : 3.3.14.5 8 | ; Language ......: English 9 | ; Description ...: Functions that assist with Process management. 10 | ; Author(s) .....: Erifash, Wouter, Matthew Tucker, Jeremy Landes, Valik 11 | ; Dll ...........: kernel32.dll 12 | ; =============================================================================================================================== 13 | 14 | ; #CURRENT# ===================================================================================================================== 15 | ; _ProcessGetName 16 | ; _ProcessGetPriority 17 | ; _RunDOS 18 | ; =============================================================================================================================== 19 | 20 | ; #FUNCTION# ==================================================================================================================== 21 | ; Author ........: Erifash , Wouter van Kesteren. guinness - Removed ProcessExists for speed. 22 | ; =============================================================================================================================== 23 | Func _ProcessGetName($iPID) 24 | Local $aProcessList = ProcessList() 25 | For $i = 1 To UBound($aProcessList) - 1 26 | If $aProcessList[$i][1] = $iPID Then 27 | Return $aProcessList[$i][0] 28 | EndIf 29 | Next 30 | Return SetError(1, 0, "") 31 | EndFunc ;==>_ProcessGetName 32 | 33 | ; #FUNCTION# ==================================================================================================================== 34 | ; Author ........: Matthew Tucker 35 | ; =============================================================================================================================== 36 | Func _ProcessGetPriority($vProcess) 37 | Local $iError = 0, $iExtended = 0, $iReturn = -1 38 | Local $iPID = ProcessExists($vProcess) 39 | If Not $iPID Then Return SetError(1, 0, -1) 40 | Local $hDLL = DllOpen('kernel32.dll') 41 | 42 | Do ; Pseudo loop 43 | Local $aProcessHandle = DllCall($hDLL, 'handle', 'OpenProcess', 'dword', $PROCESS_QUERY_INFORMATION, 'bool', False, 'dword', $iPID) 44 | If @error Then 45 | $iError = @error + 10 46 | $iExtended = @extended 47 | ExitLoop 48 | EndIf 49 | If Not $aProcessHandle[0] Then ExitLoop 50 | 51 | Local $aPriority = DllCall($hDLL, 'dword', 'GetPriorityClass', 'handle', $aProcessHandle[0]) 52 | If @error Then 53 | $iError = @error 54 | $iExtended = @extended 55 | ; Fall-through so the handle is closed. 56 | EndIf 57 | 58 | DllCall($hDLL, 'bool', 'CloseHandle', 'handle', $aProcessHandle[0]) 59 | ; No need to test @error. 60 | 61 | If $iError Then ExitLoop 62 | 63 | Switch $aPriority[0] 64 | Case 0x00000040 ; IDLE_PRIORITY_CLASS 65 | $iReturn = 0 66 | Case 0x00004000 ; BELOW_NORMAL_PRIORITY_CLASS 67 | $iReturn = 1 68 | Case 0x00000020 ; NORMAL_PRIORITY_CLASS 69 | $iReturn = 2 70 | Case 0x00008000 ; ABOVE_NORMAL_PRIORITY_CLASS 71 | $iReturn = 3 72 | Case 0x00000080 ; HIGH_PRIORITY_CLASS 73 | $iReturn = 4 74 | Case 0x00000100 ; REALTIME_PRIORITY_CLASS 75 | $iReturn = 5 76 | Case Else 77 | $iError = 1 78 | $iExtended = $aPriority[0] 79 | $iReturn = -1 80 | EndSwitch 81 | Until True ; Executes once 82 | DllClose($hDLL) 83 | Return SetError($iError, $iExtended, $iReturn) 84 | EndFunc ;==>_ProcessGetPriority 85 | 86 | ; #FUNCTION# ==================================================================================================================== 87 | ; Author ........: Jeremy Landes 88 | ; =============================================================================================================================== 89 | Func _RunDos($sCommand) 90 | Local $iResult = RunWait(@ComSpec & " /C " & $sCommand, "", @SW_HIDE) 91 | Return SetError(@error, @extended, $iResult) 92 | EndFunc ;==>_RunDos 93 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/Macro.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Collections.Immutable; 3 | using System.Collections.Generic; 4 | using System; 5 | 6 | using Unknown6656.AutoIt3.Extensibility; 7 | 8 | namespace Unknown6656.AutoIt3.Runtime; 9 | 10 | 11 | /// 12 | /// Represents an AutoIt3 macro. 13 | /// Macros are identified using their case-insensitive name and a '@'-prefix. 14 | /// 15 | public class Macro 16 | : IEquatable 17 | { 18 | /// 19 | /// The macros's upper-case name without the '@'-prefix. 20 | /// 21 | public string Name { get; } 22 | 23 | /// 24 | /// The interpreter instance with which the current macro is associated. 25 | /// 26 | public Interpreter Interpreter { get; } 27 | 28 | public virtual bool IsKnownMacro => this is KnownMacro; 29 | 30 | 31 | internal Macro(Interpreter interpreter, string name) 32 | { 33 | Interpreter = interpreter; 34 | Name = name.TrimStart('@').ToUpper(); 35 | } 36 | 37 | public virtual Variant GetValue(CallFrame frame) 38 | { 39 | Interpreter.MacroResolver.GetTryValue(frame, this, out Variant value, out _); 40 | 41 | return value; 42 | } 43 | 44 | public override string ToString() => '@' + Name; 45 | 46 | public override int GetHashCode() => Name.GetHashCode(); 47 | 48 | public override bool Equals(object? obj) => obj is Macro macro && Equals(macro); 49 | 50 | public bool Equals(Macro? other) => string.Equals(Name, other?.Name); 51 | } 52 | 53 | public sealed class KnownMacro 54 | : Macro 55 | { 56 | private readonly Func _value_provider; 57 | 58 | public Metadata Metadata { get; init; } = Metadata.Default; 59 | 60 | 61 | internal KnownMacro(Interpreter interpreter, string name, Func value_provider) 62 | : base(interpreter, name) => _value_provider = value_provider; 63 | 64 | public override Variant GetValue(CallFrame frame) => _value_provider(frame); 65 | } 66 | 67 | public sealed class MacroResolver 68 | { 69 | private readonly HashSet _macros = []; 70 | 71 | 72 | public Interpreter Interpreter { get; } 73 | 74 | public int KnownMacroCount => _macros.Count; 75 | 76 | public ImmutableHashSet KnownMacros => [.. _macros]; 77 | 78 | 79 | internal MacroResolver(Interpreter interpreter) => Interpreter = interpreter; 80 | 81 | internal void AddKnownMacro(KnownMacro macro) => _macros.Add(macro); 82 | 83 | public bool HasMacro(CallFrame frame, string macro_name) => GetTryValue(frame, macro_name, out _, out _); 84 | 85 | public bool HasMacro(CallFrame frame, Macro macro) => GetTryValue(frame, macro, out _, out _); 86 | 87 | public bool GetTryValue(CallFrame frame, Macro macro, out Variant value, [NotNullWhen(true)] out Metadata? metadata) => 88 | GetTryValue(frame, macro.Name, out value, out metadata); 89 | 90 | public bool GetTryValue(CallFrame frame, string macro_name, out Variant value, [NotNullWhen(true)] out Metadata? metadata) 91 | { 92 | bool result; 93 | macro_name = macro_name.TrimStart('@'); 94 | 95 | (value, metadata, result) = Interpreter.Telemetry.Measure(TelemetryCategory.MacroResolving, delegate 96 | { 97 | foreach (KnownMacro macro in _macros) 98 | if (macro.Name.Equals(macro_name, StringComparison.OrdinalIgnoreCase)) 99 | return (macro.GetValue(frame), macro.Metadata, true); 100 | 101 | foreach (AbstractMacroProvider provider in Interpreter.PluginLoader.MacroProviders) 102 | if (provider.ProvideMacroValue(frame, macro_name, out (Variant value, Metadata meta)? v) && v.HasValue) 103 | return (v.Value.value, v.Value.meta, true); 104 | 105 | return (Variant.Null, null!, false); 106 | }); 107 | 108 | return result; 109 | } 110 | 111 | public override string ToString() => $"{KnownMacroCount} known macros."; 112 | } 113 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/FunctionReturnValue.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System; 3 | 4 | using Unknown6656.AutoIt3.CLI; 5 | using Unknown6656.Common; 6 | 7 | namespace Unknown6656.AutoIt3.Runtime; 8 | 9 | // TODO: SOME OF THIS COULD BE OBSOLETE WITH C#10'S DISCRIMINATED UNIONS 10 | 11 | public sealed class InterpreterError 12 | { 13 | public static InterpreterError Empty { get; } = new InterpreterError(SourceLocation.Unknown, ""); 14 | 15 | public SourceLocation? Location { get; } 16 | public string Message { get; } 17 | 18 | 19 | public InterpreterError(SourceLocation? location, string message) 20 | { 21 | Location = location; 22 | Message = message; 23 | } 24 | 25 | public static InterpreterError WellKnown(SourceLocation? loc, string key, params object?[] args) => new(loc, MainProgram.LanguageLoader.CurrentLanguage?[key, args] ?? key); 26 | } 27 | 28 | public delegate FunctionReturnValue FunctionReturnValueDelegate(Variant @return, int? error, Variant? extended); 29 | 30 | public sealed class FunctionReturnValue 31 | { 32 | private readonly Union _result; 33 | 34 | 35 | private FunctionReturnValue(InterpreterError error) => _result = error; 36 | 37 | internal FunctionReturnValue(Variant @return, int? error = null, Variant? extended = null) 38 | { 39 | if (extended is int && error is null) 40 | error = -1; 41 | 42 | _result = (@return, error, extended); 43 | } 44 | 45 | public override string ToString() => _result.Match(err => $"FATAL: {err}", val => val.error is int err ? $"ERROR: {err}" : $"SUCCESS: {val.@return}"); 46 | 47 | public bool IsSuccess(out Variant value, out Variant? extended) => IsNonFatal(out value, out int? err, out extended) && err is null; 48 | 49 | public bool IsFatal([MaybeNullWhen(false), NotNullWhen(true)] out InterpreterError? error) => _result.Is(out error); 50 | 51 | public bool IsError(out int error) => IsError(out _, out error, out _); 52 | 53 | public bool IsError(out int error, out Variant? extended) => IsError(out _, out error, out extended); 54 | 55 | public bool IsError(out Variant value, out int error) => IsError(out value, out error, out _); 56 | 57 | public bool IsError(out Variant value, out int error, out Variant? extended) 58 | { 59 | bool res = IsNonFatal(out value, out int? err, out extended); 60 | 61 | if (err is null) 62 | res = false; 63 | 64 | error = err ?? 0; 65 | 66 | return res; 67 | } 68 | 69 | public bool IsNonFatal(out Variant @return, out int? error, out Variant? extended) 70 | { 71 | bool res = _result.Is(out (Variant @return, int? error, Variant? extended) tuple); 72 | 73 | (@return, error, extended) = tuple; 74 | 75 | return res; 76 | } 77 | 78 | public FunctionReturnValue IfNonFatal(FunctionReturnValueDelegate function) => _result.Match(Fatal, t => function(t.@return, t.error, t.extended)); 79 | 80 | public FunctionReturnValue IfNonFatal(Func function) => _result.Match(Fatal, t => function(t.@return)); 81 | 82 | public static FunctionReturnValue Success(Variant value) => new(value); 83 | 84 | public static FunctionReturnValue Success(Variant value, Variant extended) => new(value, null, extended); 85 | 86 | public static FunctionReturnValue Fatal(InterpreterError error) => new(error); 87 | 88 | public static FunctionReturnValue Error(int error) => new(Variant.False, error); 89 | 90 | public static FunctionReturnValue Error(int error, Variant extended) => new(Variant.False, error, extended); 91 | 92 | public static FunctionReturnValue Error(Variant value, int error, Variant extended) => new(value, error, extended); 93 | 94 | public static implicit operator FunctionReturnValue(Variant v) => Success(v); 95 | 96 | public static implicit operator FunctionReturnValue(InterpreterError err) => Fatal(err); 97 | 98 | // public static implicit operator FunctionReturnValue(Union union) => union.Match(Fatal, Success); 99 | } 100 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/MsgBoxConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: MsgBox_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be included in an AutoIt v3 script when using function MsgBox. 8 | ; Author(s) .....: guinness, jpm 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; Message Box Constants 13 | ; Indicates the buttons displayed in the message box 14 | Global Const $MB_OK = 0 ; One push button: OK 15 | Global Const $MB_OKCANCEL = 1 ; Two push buttons: OK and Cancel 16 | Global Const $MB_ABORTRETRYIGNORE = 2 ; Three push buttons: Abort, Retry, and Ignore 17 | Global Const $MB_YESNOCANCEL = 3 ; Three push buttons: Yes, No, and Cancel 18 | Global Const $MB_YESNO = 4 ; Two push buttons: Yes and No 19 | Global Const $MB_RETRYCANCEL = 5 ; Two push buttons: Retry and Cancel 20 | Global Const $MB_CANCELTRYCONTINUE = 6 ; Three buttons: Cancel, Try Again and Continue 21 | Global Const $MB_HELP = 0x4000 ; Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner. 22 | 23 | ; Displays an icon in the message box 24 | Global Const $MB_ICONSTOP = 16 ; Stop-sign icon 25 | Global Const $MB_ICONERROR = 16 ; Stop-sign icon 26 | Global Const $MB_ICONHAND = 16 ; Stop-sign icon 27 | Global Const $MB_ICONQUESTION = 32 ; Question-mark icon 28 | Global Const $MB_ICONEXCLAMATION = 48 ; Exclamation-point icon 29 | Global Const $MB_ICONWARNING = 48 ; Exclamation-point icon 30 | Global Const $MB_ICONINFORMATION = 64 ; Icon consisting of an 'i' in a circle 31 | Global Const $MB_ICONASTERISK = 64 ; Icon consisting of an 'i' in a circle 32 | Global Const $MB_USERICON = 0x00000080 33 | 34 | ; Indicates the default button 35 | Global Const $MB_DEFBUTTON1 = 0 ; The first button is the default button 36 | Global Const $MB_DEFBUTTON2 = 256 ; The second button is the default button 37 | Global Const $MB_DEFBUTTON3 = 512 ; The third button is the default button 38 | Global Const $MB_DEFBUTTON4 = 768 ; The fourth button is the default button. 39 | 40 | ; Indicates the modality of the dialog box 41 | Global Const $MB_APPLMODAL = 0 ; Application modal 42 | Global Const $MB_SYSTEMMODAL = 4096 ; System modal 43 | Global Const $MB_TASKMODAL = 8192 ; Task modal 44 | 45 | ; Indicates miscellaneous message box attributes 46 | Global Const $MB_DEFAULT_DESKTOP_ONLY = 0x00020000 ; Same as desktop of the interactive window station 47 | Global Const $MB_RIGHT = 0x00080000 ; The text is right-justified. 48 | Global Const $MB_RTLREADING = 0x00100000 ; Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems. 49 | Global Const $MB_SETFOREGROUND = 0x00010000 ; The message box becomes the foreground window 50 | Global Const $MB_TOPMOST = 0x00040000 ; The message box is created with the WS_EX_TOPMOST window style. 51 | Global Const $MB_SERVICE_NOTIFICATION = 0x00200000 ; The caller is a service notifying the user of an event. 52 | 53 | Global Const $MB_RIGHTJUSTIFIED = $MB_RIGHT ; Do not use, see $MB_RIGHT. Included for backwards compatibility. 54 | 55 | ; Indicates the button selected in the message box 56 | Global Const $IDTIMEOUT = -1 ; The message box timed out 57 | Global Const $IDOK = 1 ; OK button was selected 58 | Global Const $IDCANCEL = 2 ; Cancel button was selected 59 | Global Const $IDABORT = 3 ; Abort button was selected 60 | Global Const $IDRETRY = 4 ; Retry button was selected 61 | Global Const $IDIGNORE = 5 ; Ignore button was selected 62 | Global Const $IDYES = 6 ; Yes button was selected 63 | Global Const $IDNO = 7 ; No button was selected 64 | Global Const $IDCLOSE = 8 ; Close button was selected 65 | Global Const $IDHELP = 9 ; Help button was selected 66 | Global Const $IDTRYAGAIN = 10 ; Try Again button was selected 67 | Global Const $IDCONTINUE = 11 ; Continue button was selected 68 | ; =============================================================================================================================== 69 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/SliderConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Slider_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: GUI control Slider styles and much more constants. 8 | ; Author(s) .....: Valik, Gary Frost, ... 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; Custom Draw Values (Custom Draw values, for example, are specified in the dwItemSpec member of the NMCUSTOMDRAW structure) 13 | Global Const $TBCD_CHANNEL = 0x3 ;Identifies the channel that the trackbar control's thumb marker slides along. 14 | Global Const $TBCD_THUMB = 0x2 ;Identifies the trackbar control's thumb marker. This is the part of the control that the user moves 15 | Global Const $TBCD_TICS = 0x1 ;Identifies the tick marks that are displayed along the trackbar control's edge 16 | 17 | ; Messages 18 | Global Const $__SLIDERCONSTANT_WM_USER = 0x400 19 | Global Const $TBM_CLEARSEL = $__SLIDERCONSTANT_WM_USER + 19 20 | Global Const $TBM_CLEARTICS = $__SLIDERCONSTANT_WM_USER + 9 21 | Global Const $TBM_GETBUDDY = $__SLIDERCONSTANT_WM_USER + 33 22 | Global Const $TBM_GETCHANNELRECT = $__SLIDERCONSTANT_WM_USER + 26 23 | Global Const $TBM_GETLINESIZE = $__SLIDERCONSTANT_WM_USER + 24 24 | Global Const $TBM_GETNUMTICS = $__SLIDERCONSTANT_WM_USER + 16 25 | Global Const $TBM_GETPAGESIZE = $__SLIDERCONSTANT_WM_USER + 22 26 | Global Const $TBM_GETPOS = $__SLIDERCONSTANT_WM_USER 27 | Global Const $TBM_GETPTICS = $__SLIDERCONSTANT_WM_USER + 14 28 | Global Const $TBM_GETSELEND = $__SLIDERCONSTANT_WM_USER + 18 29 | Global Const $TBM_GETSELSTART = $__SLIDERCONSTANT_WM_USER + 17 30 | Global Const $TBM_GETRANGEMAX = $__SLIDERCONSTANT_WM_USER + 2 31 | Global Const $TBM_GETRANGEMIN = $__SLIDERCONSTANT_WM_USER + 1 32 | Global Const $TBM_GETTHUMBLENGTH = $__SLIDERCONSTANT_WM_USER + 28 33 | Global Const $TBM_GETTHUMBRECT = $__SLIDERCONSTANT_WM_USER + 25 34 | Global Const $TBM_GETTIC = $__SLIDERCONSTANT_WM_USER + 3 35 | Global Const $TBM_GETTICPOS = $__SLIDERCONSTANT_WM_USER + 15 36 | Global Const $TBM_GETTOOLTIPS = $__SLIDERCONSTANT_WM_USER + 30 37 | Global Const $TBM_GETUNICODEFORMAT = 0x2000 + 6 38 | Global Const $TBM_SETBUDDY = $__SLIDERCONSTANT_WM_USER + 32 39 | Global Const $TBM_SETLINESIZE = $__SLIDERCONSTANT_WM_USER + 23 40 | Global Const $TBM_SETPAGESIZE = $__SLIDERCONSTANT_WM_USER + 21 41 | Global Const $TBM_SETPOS = $__SLIDERCONSTANT_WM_USER + 5 42 | Global Const $TBM_SETRANGE = $__SLIDERCONSTANT_WM_USER + 6 43 | Global Const $TBM_SETRANGEMAX = $__SLIDERCONSTANT_WM_USER + 8 44 | Global Const $TBM_SETRANGEMIN = $__SLIDERCONSTANT_WM_USER + 7 45 | Global Const $TBM_SETSEL = $__SLIDERCONSTANT_WM_USER + 10 46 | Global Const $TBM_SETSELEND = $__SLIDERCONSTANT_WM_USER + 12 47 | Global Const $TBM_SETSELSTART = $__SLIDERCONSTANT_WM_USER + 11 48 | Global Const $TBM_SETTHUMBLENGTH = $__SLIDERCONSTANT_WM_USER + 27 49 | Global Const $TBM_SETTIC = $__SLIDERCONSTANT_WM_USER + 4 50 | Global Const $TBM_SETTICFREQ = $__SLIDERCONSTANT_WM_USER + 20 51 | Global Const $TBM_SETTIPSIDE = $__SLIDERCONSTANT_WM_USER + 31 52 | Global Const $TBM_SETTOOLTIPS = $__SLIDERCONSTANT_WM_USER + 29 53 | Global Const $TBM_SETUNICODEFORMAT = 0x2000 + 5 54 | 55 | ; Tip Side Params 56 | Global Const $TBTS_BOTTOM = 2 57 | Global Const $TBTS_LEFT = 1 58 | Global Const $TBTS_RIGHT = 3 59 | Global Const $TBTS_TOP = 0 60 | 61 | ; Styles 62 | Global Const $TBS_AUTOTICKS = 0x0001 63 | Global Const $TBS_BOTH = 0x0008 64 | Global Const $TBS_BOTTOM = 0x0000 65 | Global Const $TBS_DOWNISLEFT = 0x0400 66 | Global Const $TBS_ENABLESELRANGE = 0x20 67 | Global Const $TBS_FIXEDLENGTH = 0x40 68 | Global Const $TBS_HORZ = 0x0000 69 | Global Const $TBS_LEFT = 0x0004 70 | Global Const $TBS_NOTHUMB = 0x0080 71 | Global Const $TBS_NOTICKS = 0x0010 72 | Global Const $TBS_REVERSED = 0x200 73 | Global Const $TBS_RIGHT = 0x0000 74 | Global Const $TBS_TOP = 0x0004 75 | Global Const $TBS_TOOLTIPS = 0x100 76 | Global Const $TBS_VERT = 0x0002 77 | 78 | ; Control default styles 79 | Global Const $GUI_SS_DEFAULT_SLIDER = $TBS_AUTOTICKS 80 | ; =============================================================================================================================== 81 | -------------------------------------------------------------------------------- /test/unittest-conversions.au3: -------------------------------------------------------------------------------- 1 | #cs 2 | SCRIPT FOR UNIT-TESTING THE INTERPRETER 3 | 4 | THE INTERPERETER OUTPUT SHOULD BE: 5 | STRING(True) = True 6 | STRING(False) = False 7 | STRING() = 8 | STRING(Default) = Default 9 | STRING(65280) = 65280 10 | STRING(255) = 255 11 | STRING(-81985529216486896) = -81985529216486896 12 | STRING(0xAAFFBB00) = 0xAAFFBB00 13 | STRING(0xaaffbb00) = 0xaaffbb00 14 | STRING(0xfedcba9876543210) = 0xfedcba9876543210 15 | STRING(topkek) = topkek 16 | STRING(420.135) = 420.135 17 | STRING() = 18 | STRING() = 19 | 20 | BINARY(True) = 0x01 21 | BINARY(False) = 0x00 22 | BINARY() = 0x00000000 23 | BINARY(Default) = 0xFFFFFFFF 24 | BINARY(65280) = 0x00FF0000 25 | BINARY(255) = 0xFF000000 26 | BINARY(-81985529216486896) = 0x1032547698BADCFE 27 | BINARY(0xAAFFBB00) = 0xAAFFBB00 28 | BINARY(0xaaffbb00) = 0xAAFFBB00 29 | BINARY(0xfedcba9876543210) = 0xFEDCBA9876543210 30 | BINARY(topkek) = 0x746F706B656B 31 | BINARY(420.135) = 0x5C8FC2F528427A40 32 | BINARY() = 33 | BINARY() = 34 | 35 | NUMBER(True) = 1 36 | NUMBER(False) = 0 37 | NUMBER() = 0 38 | NUMBER(Default) = 0 39 | NUMBER(65280) = 65280 40 | NUMBER(255) = 255 41 | NUMBER(-81985529216486896) = -81985529216486896 42 | NUMBER(0xAAFFBB00) = 12320682 43 | NUMBER(0xaaffbb00) = -1426081024 44 | NUMBER(0xfedcba9876543210) = 0 45 | NUMBER(topkek) = 0 46 | NUMBER(420.135) = 420.135 47 | NUMBER() = 0 48 | NUMBER() = 0 49 | 50 | INT(True) = 1 51 | INT(False) = 0 52 | INT() = 0 53 | INT(Default) = 0 54 | INT(65280) = 65280 55 | INT(255) = 255 56 | INT(-81985529216486896) = -81985529216486896 57 | INT(0xAAFFBB00) = 12320682 58 | INT(0xaaffbb00) = -1426081024 59 | INT(0xfedcba9876543210) = -81985529216486896 60 | INT(topkek) = 0 61 | INT(420.135) = 420 62 | INT() = 0 63 | INT() = 0 64 | 65 | BINARYTOSTRING(True) =  66 | BINARYTOSTRING(False) = 67 | BINARYTOSTRING() = 68 | BINARYTOSTRING(Default) = ÿÿÿÿ 69 | BINARYTOSTRING(65280) = 70 | BINARYTOSTRING(255) = ÿ 71 | BINARYTOSTRING(-81985529216486896) = 2Tv˜ºÜþ 72 | BINARYTOSTRING(0xAAFFBB00) = ªÿ» 73 | BINARYTOSTRING(0xaaffbb00) = ªÿ» 74 | BINARYTOSTRING(0xfedcba9876543210) = þܺ˜vT2 75 | BINARYTOSTRING(topkek) = topkek 76 | BINARYTOSTRING(420.135) = \Âõ(Bz@ 77 | BINARYTOSTRING() = 78 | BINARYTOSTRING() = 79 | 80 | STRINGTOBINARY(True) = 0x54727565 81 | STRINGTOBINARY(False) = 0x46616C7365 82 | STRINGTOBINARY() = 83 | STRINGTOBINARY(Default) = 0x44656661756C74 84 | STRINGTOBINARY(65280) = 0x3635323830 85 | STRINGTOBINARY(255) = 0x323535 86 | STRINGTOBINARY(-81985529216486896) = 0x2D3831393835353239323136343836383936 87 | STRINGTOBINARY(0xAAFFBB00) = 0x30784141464642423030 88 | STRINGTOBINARY(0xaaffbb00) = 0x30786161666662623030 89 | STRINGTOBINARY(0xfedcba9876543210) = 0x307866656463626139383736353433323130 90 | STRINGTOBINARY(topkek) = 0x746F706B656B 91 | STRINGTOBINARY(420.135) = 0x3432302E313335 92 | STRINGTOBINARY() = 93 | STRINGTOBINARY() = 94 | 95 | HEX(True) = 00000001 96 | HEX(False) = 00000000 97 | HEX() = 00000000 98 | HEX(Default) = 00000000 99 | HEX(65280) = 0000FF00 100 | HEX(255) = 000000FF 101 | HEX(-81985529216486896) = FEDCBA9876543210 102 | HEX(0xAAFFBB00) = AAFFBB00 103 | HEX(0xaaffbb00) = AAFFBB00 104 | HEX(0xfedcba9876543210) = 0000000000000000 105 | HEX(topkek) = 0000000000000000 106 | HEX(420.135) = 407A4228F5C28F5C 107 | HEX() = 00000000 108 | HEX() = 00000000 109 | 110 | DEC(True) = 0 111 | DEC(False) = 0 112 | DEC() = 0 113 | DEC(Default) = 0 114 | DEC(65280) = 414336 115 | DEC(255) = 597 116 | DEC(-81985529216486896) = 0 117 | DEC(0xAAFFBB00) = 0 118 | DEC(0xaaffbb00) = 0 119 | DEC(0xfedcba9876543210) = 0 120 | DEC(topkek) = 0 121 | DEC(420.135) = 0 122 | DEC() = 0 123 | DEC() = 0 124 | #ce 125 | 126 | Dim $funcs = [String, Binary, Number, Int, BinaryToString, StringToBinary, Hex, Dec] 127 | Dim $inputs = [True, False, Null, Default, 0xff00, 0x00ff, 0xfedcba9876543210, Binary("0xaaffbb00"), "0xaaffbb00", "0xfedcba9876543210", "topkek", 420.135, $funcs, Binary] 128 | 129 | For $func In $funcs 130 | For $input In $inputs 131 | ConsoleWrite(FuncName($func) & "(" & $input & ") = " & Call($func, $input) & @CRLF) 132 | Next 133 | ConsoleWrite(@CRLF) 134 | Next 135 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/GUIConstantsEx.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: GUIConstantsEx 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants to be used in GUI applications. 8 | ; Author(s) .....: Jpm, Valik 9 | ; Dll ...........: 10 | ; =============================================================================================================================== 11 | 12 | ; #CONSTANTS# =================================================================================================================== 13 | ; Events and messages 14 | Global Const $GUI_EVENT_SINGLE = 0 ; (default) Returns a single event. 15 | Global Const $GUI_EVENT_ARRAY = 1 ; returns an array containing the event and extended information. 16 | 17 | Global Const $GUI_EVENT_NONE = 0 18 | Global Const $GUI_EVENT_CLOSE = -3 19 | Global Const $GUI_EVENT_MINIMIZE = -4 20 | Global Const $GUI_EVENT_RESTORE = -5 21 | Global Const $GUI_EVENT_MAXIMIZE = -6 22 | Global Const $GUI_EVENT_PRIMARYDOWN = -7 23 | Global Const $GUI_EVENT_PRIMARYUP = -8 24 | Global Const $GUI_EVENT_SECONDARYDOWN = -9 25 | Global Const $GUI_EVENT_SECONDARYUP = -10 26 | Global Const $GUI_EVENT_MOUSEMOVE = -11 27 | Global Const $GUI_EVENT_RESIZED = -12 28 | Global Const $GUI_EVENT_DROPPED = -13 29 | 30 | Global Const $GUI_RUNDEFMSG = 'GUI_RUNDEFMSG' 31 | 32 | ; State 33 | Global Const $GUI_AVISTOP = 0 34 | Global Const $GUI_AVISTART = 1 35 | Global Const $GUI_AVICLOSE = 2 36 | 37 | Global Const $GUI_CHECKED = 1 38 | Global Const $GUI_INDETERMINATE = 2 39 | Global Const $GUI_UNCHECKED = 4 40 | 41 | Global Const $GUI_DROPACCEPTED = 8 42 | Global Const $GUI_NODROPACCEPTED = 4096 43 | Global Const $GUI_ACCEPTFILES = $GUI_DROPACCEPTED ; to be suppressed 44 | 45 | Global Const $GUI_SHOW = 16 46 | Global Const $GUI_HIDE = 32 47 | Global Const $GUI_ENABLE = 64 48 | Global Const $GUI_DISABLE = 128 49 | 50 | Global Const $GUI_FOCUS = 256 51 | Global Const $GUI_NOFOCUS = 8192 52 | Global Const $GUI_DEFBUTTON = 512 53 | 54 | Global Const $GUI_EXPAND = 1024 55 | Global Const $GUI_ONTOP = 2048 56 | 57 | ; Font 58 | Global Const $GUI_FONTNORMAL = 0 59 | Global Const $GUI_FONTITALIC = 2 60 | Global Const $GUI_FONTUNDER = 4 61 | Global Const $GUI_FONTSTRIKE = 8 62 | 63 | ; Resizing 64 | Global Const $GUI_DOCKAUTO = 0x0001 65 | Global Const $GUI_DOCKLEFT = 0x0002 66 | Global Const $GUI_DOCKRIGHT = 0x0004 67 | Global Const $GUI_DOCKHCENTER = 0x0008 68 | Global Const $GUI_DOCKTOP = 0x0020 69 | Global Const $GUI_DOCKBOTTOM = 0x0040 70 | Global Const $GUI_DOCKVCENTER = 0x0080 71 | Global Const $GUI_DOCKWIDTH = 0x0100 72 | Global Const $GUI_DOCKHEIGHT = 0x0200 73 | 74 | Global Const $GUI_DOCKSIZE = 0x0300 ; width+height 75 | Global Const $GUI_DOCKMENUBAR = 0x0220 ; top+height 76 | Global Const $GUI_DOCKSTATEBAR = 0x0240 ; bottom+height 77 | Global Const $GUI_DOCKALL = 0x0322 ; left+top+width+height 78 | Global Const $GUI_DOCKBORDERS = 0x0066 ; left+top+right+bottom 79 | 80 | ; Graphic 81 | Global Const $GUI_GR_CLOSE = 1 82 | Global Const $GUI_GR_LINE = 2 83 | Global Const $GUI_GR_BEZIER = 4 84 | Global Const $GUI_GR_MOVE = 6 85 | Global Const $GUI_GR_COLOR = 8 86 | Global Const $GUI_GR_RECT = 10 87 | Global Const $GUI_GR_ELLIPSE = 12 88 | Global Const $GUI_GR_PIE = 14 89 | Global Const $GUI_GR_DOT = 16 90 | Global Const $GUI_GR_PIXEL = 18 91 | Global Const $GUI_GR_HINT = 20 92 | Global Const $GUI_GR_REFRESH = 22 93 | Global Const $GUI_GR_PENSIZE = 24 94 | Global Const $GUI_GR_NOBKCOLOR = -2 95 | 96 | ; Background color special flags 97 | Global Const $GUI_BKCOLOR_DEFAULT = -1 98 | Global Const $GUI_BKCOLOR_TRANSPARENT = -2 99 | Global Const $GUI_BKCOLOR_LV_ALTERNATE = 0xFE000000 100 | 101 | ; GUICtrlRead Constants 102 | Global Const $GUI_READ_DEFAULT = 0 ; (Default) Returns a value with state or data of a control. 103 | Global Const $GUI_READ_EXTENDED = 1 ; Returns extended information of a control (see Remarks). 104 | 105 | ; GUISetCursor Constants 106 | Global Const $GUI_CURSOR_NOOVERRIDE = 0 ; (default) Don't override a control's default mouse cursor. 107 | Global Const $GUI_CURSOR_OVERRIDE = 1 ; override control's default mouse cursor. 108 | 109 | ; Other 110 | Global Const $GUI_WS_EX_PARENTDRAG = 0x00100000 111 | ; =============================================================================================================================== 112 | -------------------------------------------------------------------------------- /src/util/AutoIt3.Common/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.IO; 4 | using System; 5 | 6 | namespace Unknown6656.AutoIt3.Common; 7 | 8 | 9 | // TODO : verify if these extensions are still needed. might be implemented in Unknown6656.Core 10 | 11 | public static unsafe partial class StreamExtensions 12 | { 13 | public static void WriteNullable(this BinaryWriter writer, T? data) where T : unmanaged 14 | { 15 | if (data is T t) 16 | { 17 | writer.Write(true); 18 | writer.WriteNative(t); 19 | } 20 | else 21 | writer.Write(false); 22 | } 23 | 24 | public static T? ReadNullable(this BinaryReader reader) where T : unmanaged 25 | { 26 | if (reader.ReadBoolean()) 27 | return reader.ReadNative(); 28 | 29 | return null; 30 | } 31 | 32 | public static void WriteNullable(this BinaryWriter writer, string? data) 33 | { 34 | if (data is string s) 35 | { 36 | writer.Write(true); 37 | writer.Write(s); 38 | } 39 | else 40 | writer.Write(false); 41 | } 42 | 43 | public static string? ReadNullable(this BinaryReader reader) 44 | { 45 | if (reader.ReadBoolean()) 46 | return reader.ReadString(); 47 | 48 | return null; 49 | } 50 | 51 | public static void WriteNative(this BinaryWriter writer, T data) where T : unmanaged 52 | { 53 | byte* ptr = (byte*)&data; 54 | byte[] bytes = new byte[sizeof(T)]; 55 | 56 | for (int i = 0; i < bytes.Length; ++i) 57 | bytes[i] = ptr[i]; 58 | 59 | writer.Write(bytes, 0, bytes.Length); 60 | } 61 | 62 | public static T ReadNative(this BinaryReader reader) where T : unmanaged 63 | { 64 | T data = default; 65 | byte[] bytes = new byte[sizeof(T)]; 66 | 67 | reader.Read(bytes, 0, bytes.Length); 68 | 69 | for (int i = 0; i < bytes.Length; ++i) 70 | *((byte*)&data + i) = bytes[i]; 71 | 72 | return data; 73 | } 74 | } 75 | 76 | public static class TypeExtensions 77 | { 78 | public static Type? FindAssignableWith(this Type? typeLeft, Type? typeRight) 79 | { 80 | if (typeLeft is null || typeRight is null) 81 | return null; 82 | 83 | Type commonBaseClass = typeLeft.GetCommonBaseClass(typeRight) ?? typeof(object); 84 | 85 | return commonBaseClass.Equals(typeof(object)) 86 | ? typeLeft.GetCommonInterface(typeRight) 87 | : commonBaseClass; 88 | } 89 | 90 | // searching for common base class (either concrete or abstract) 91 | public static Type? GetCommonBaseClass(this Type? typeLeft, Type? typeRight) => 92 | typeLeft is { } && typeRight is { } ? typeLeft.GetClassHierarchy() 93 | .Intersect(typeRight.GetClassHierarchy()) 94 | .FirstOrDefault(type => !type.IsInterface) : null; 95 | 96 | // searching for common implemented interface 97 | // it's possible for one class to implement multiple interfaces, 98 | // in this case return first common based interface 99 | public static Type? GetCommonInterface(this Type? typeLeft, Type? typeRight) => 100 | typeLeft is { } && typeRight is { } ? typeLeft.GetInterfaceHierarchy() 101 | .Intersect(typeRight.GetInterfaceHierarchy()) 102 | .FirstOrDefault() : null; 103 | 104 | // iterate on interface hierarchy 105 | public static IEnumerable GetInterfaceHierarchy(this Type type) 106 | { 107 | if (type.IsInterface) 108 | yield return type; 109 | 110 | foreach (Type t in type.GetInterfaces().OrderByDescending(current => current.GetInterfaces().Count())) 111 | yield return t; 112 | } 113 | 114 | // iterate on class hierarchy 115 | public static IEnumerable GetClassHierarchy(this Type type) 116 | { 117 | if (type is null) 118 | yield break; 119 | 120 | Type? typeInHierarchy = type; 121 | 122 | do 123 | yield return typeInHierarchy; 124 | while ((typeInHierarchy = typeInHierarchy.BaseType) is { IsInterface: false }); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Extensibility/Plugins.Threading.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using System; 3 | 4 | using Unknown6656.AutoIt3.Runtime; 5 | using Unknown6656.Generics; 6 | 7 | namespace Unknown6656.AutoIt3.Extensibility.Plugins.Debugging; 8 | 9 | public sealed class ThreadingFunctionProvider 10 | : AbstractFunctionProvider 11 | { 12 | public ThreadingFunctionProvider(Interpreter interpreter) 13 | : base(interpreter) 14 | { 15 | RegisterFunction(nameof(ThreadIsRunning), 1, ThreadIsRunning); 16 | RegisterFunction(nameof(ThreadKill), 1, ThreadKill); 17 | RegisterFunction(nameof(ThreadStart), 1, 256, ThreadStart); 18 | RegisterFunction(nameof(ThreadWait), 1, ThreadWait); 19 | RegisterFunction(nameof(ThreadGetID), 0, 1, ThreadGetID, Variant.Default); 20 | RegisterFunction(nameof(ThreadList), 0, ThreadList); 21 | } 22 | 23 | public static FunctionReturnValue ThreadIsRunning(CallFrame frame, Variant[] args) 24 | { 25 | if (args[0].TryResolveHandle(frame.Interpreter, out ThreadHandle? handle)) 26 | return (Variant)handle.Thread.IsRunning; 27 | else 28 | return FunctionReturnValue.Error(1); 29 | } 30 | 31 | public static FunctionReturnValue ThreadKill(CallFrame frame, Variant[] args) 32 | { 33 | if (args[0].TryResolveHandle(frame.Interpreter, out ThreadHandle? handle)) 34 | { 35 | Variant running = handle.Thread.IsRunning; 36 | 37 | handle.Thread.Stop(); 38 | handle.Runner.Wait(); 39 | frame.Interpreter.GlobalObjectStorage.Delete(args[0]); 40 | 41 | return running; 42 | } 43 | else 44 | return FunctionReturnValue.Error(1); 45 | } 46 | 47 | public static FunctionReturnValue ThreadWait(CallFrame frame, Variant[] args) 48 | { 49 | if (args[0].TryResolveHandle(frame.Interpreter, out ThreadHandle? handle)) 50 | { 51 | handle.Runner.Wait(); 52 | 53 | FunctionReturnValue result = handle.Runner.Result; 54 | 55 | frame.Interpreter.GlobalObjectStorage.Delete(args[0]); 56 | 57 | return result; 58 | } 59 | else 60 | return FunctionReturnValue.Error(1); 61 | } 62 | 63 | public static FunctionReturnValue ThreadStart(CallFrame frame, Variant[] args) 64 | { 65 | if (!args[0].IsFunction(out ScriptFunction? func)) 66 | func = frame.Interpreter.ScriptScanner.TryResolveFunction(args[0].ToString()); 67 | 68 | if (func is { }) 69 | { 70 | AU3Thread thread = frame.Interpreter.CreateNewThread(); 71 | Task runner = thread.RunAsync(func, frame.PassedArguments[1..], InterpreterRunContext.Interactive); 72 | Variant handle = frame.Interpreter.GlobalObjectStorage.Store(new ThreadHandle(thread, runner)); 73 | 74 | return handle; 75 | } 76 | 77 | return FunctionReturnValue.Error(1); 78 | } 79 | 80 | public static FunctionReturnValue ThreadGetID(CallFrame frame, Variant[] args) 81 | { 82 | AU3Thread thread; 83 | 84 | if (args[0].TryResolveHandle(frame.Interpreter, out ThreadHandle? handle)) 85 | thread = handle.Thread; 86 | else if (args[0].IsDefault) 87 | thread = frame.CurrentThread; 88 | else 89 | return FunctionReturnValue.Error(1); 90 | 91 | return (Variant)thread.ThreadID; 92 | } 93 | 94 | public static FunctionReturnValue ThreadList(CallFrame frame, Variant[] args) => 95 | Variant.FromArray(frame.Interpreter, frame.Interpreter.GlobalObjectStorage.GetAllInstancesOfType().ToArray(LINQ.fst)); 96 | 97 | 98 | private sealed class ThreadHandle 99 | : IDisposable 100 | { 101 | public AU3Thread Thread { get; } 102 | public Task Runner { get; } 103 | 104 | 105 | public ThreadHandle(AU3Thread thread, Task runner) 106 | { 107 | Thread = thread; 108 | Runner = runner; 109 | } 110 | 111 | public void Dispose() 112 | { 113 | if (Runner.Status is TaskStatus.Running or TaskStatus.WaitingForChildrenToComplete) 114 | Runner.Wait(); 115 | 116 | Runner.Dispose(); 117 | Thread.Dispose(); 118 | } 119 | 120 | public override string ToString() => Thread.ToString(); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /test/unittest-stringformat.au3: -------------------------------------------------------------------------------- 1 | #cs 2 | SCRIPT FOR UNIT-TESTING THE INTERPRETER 3 | 4 | THE INTERPERETER OUTPUT SHOULD BE: 5 | Numeric Formats 6 | "%d" on 43951789 => 43951789 ; standard positive integer with no sign 7 | "%d" on -43951789 => -43951789 ; standard negative integer with sign 8 | "%i" on 43951789 => 43951789 ; standard integer 9 | "%09i" on 43951789 => 043951789 ; 9 digits with leading zero 10 | "%e" on 43951789 => 4.395179e+007 ; scientific notation 11 | "%u" on 43951789 => 43951789 ; unsigned integer with positive integer 12 | "%u" on -43951789 => 4251015507 ; unsigned integer with negative integer 13 | "%f" on 43951789 => 43951789.000000 ; floating point 14 | "%.2f" on 43951789 => 43951789.00 ; floating point with 2 digits after decimal point 15 | "%o" on 43951789 => 247523255 ; octal 16 | "%s" on 43951789 => 43951789 ; string 17 | "%x" on 43951789 => 29ea6ad ; hexadecimal (lower-case) 18 | "%X" on 43951789 => 29EA6AD ; hexadecimal (upper-case) 19 | "%+d" on 43951789 => +43951789 ; sign specifier on a positive integer 20 | "%+d" on -43951789 => -43951789 ; sign specifier on a negative integer 21 | 22 | String Formats - [ ] used to show beginning/end of string 23 | "[%s]" on string => [string] ; standard string 24 | "[%10s]" on string => [ string] ; 10 chars right justified with added spaces 25 | "[%-10s]" on string => [string ] ; 10 chars left justified with added spaces 26 | "[%10.8s]" on longstring => [ longstri] ; right justified but precision 8 so truncated 27 | "[%-10.8s]" on longstring => [longstri ] ; left justifed but precision 8 so truncated 28 | "[%010s]" on string => [0000string] ; 10 chars with leading zero 29 | 30 | Date Format - each % uses a new parameter 31 | "%02i\%02i\%04i" 0n (1, 9, 2013) => 01\09\2013 32 | 33 | Just string to format without Vars 34 | "Some \texample text\n" => Some example text 35 | #ce 36 | 37 | Local $iInt_Unsigned = 43951789 38 | Local $iInt_Negative = -43951789 39 | 40 | ConsoleWrite(@CRLF & "Numeric Formats" & @CRLF) 41 | 42 | PrintFormat($iInt_Unsigned, "%d", "standard positive integer with no sign", 1) ; 43951789 43 | PrintFormat($iInt_Negative, "%d", "standard negative integer with sign", 1) ; -43951789 44 | PrintFormat($iInt_Unsigned, "%i", "standard integer", 1) ; 43951789 45 | PrintFormat($iInt_Unsigned, "%09i", "9 digits with leading zero", 1) ; 043951789 46 | PrintFormat($iInt_Unsigned, "%e", "scientific notation") ; 4.395179e+007 47 | PrintFormat($iInt_Unsigned, "%u", "unsigned integer with positive integer", 1) ; 43951789 48 | PrintFormat($iInt_Negative, "%u", "unsigned integer with negative integer", 1) ; 4251015507 49 | PrintFormat($iInt_Unsigned, "%f", "floating point") ; 43951789.000000 50 | PrintFormat($iInt_Unsigned, "%.2f", "floating point with 2 digits after decimal point", 1) ; 43951789.00 51 | PrintFormat($iInt_Unsigned, "%o", "octal", 1) ; 247523255 52 | PrintFormat($iInt_Unsigned, "%s", "string", 1) ; 43951789 53 | PrintFormat($iInt_Unsigned, "%x", "hexadecimal (lower-case)", 1) ; 29ea6ad 54 | PrintFormat($iInt_Unsigned, "%X", "hexadecimal (upper-case)", 1) ; 29EA6AD 55 | PrintFormat($iInt_Unsigned, "%+d", "sign specifier on a positive integer", 1) ; +43951789 56 | PrintFormat($iInt_Negative, "%+d", "sign specifier on a negative integer", 1) ; -43951789 57 | 58 | Local $sString = "string" 59 | Local $sString_Long = "longstring" 60 | 61 | ConsoleWrite(@CRLF & "String Formats - [ ] used to show beginning/end of string" & @CRLF) 62 | 63 | PrintFormat($sString, "[%s]", "standard string", 1) ; [string] 64 | PrintFormat($sString, "[%10s]", "10 chars right justified with added spaces") ; [ string] 65 | PrintFormat($sString, "[%-10s]", "10 chars left justified with added spaces") ; [string ] 66 | PrintFormat($sString_Long, "[%10.8s]", "right justified but precision 8 so truncated") ; [ longer s] 67 | PrintFormat($sString_Long, "[%-10.8s]", "left justifed but precision 8 so truncated") ; [longer s ] 68 | PrintFormat($sString, "[%010s]", "10 chars with leading zero") ; [0000string] 69 | 70 | ConsoleWrite(@CRLF & "Date Format - each % uses a new parameter" & @CRLF) 71 | ConsoleWrite('"%02i\%02i\%04i" 0n (1, 9, 2013) => ' & StringFormat("%02i\%02i\%04i", 1, 9, 2013) & @CRLF) 72 | 73 | ConsoleWrite(@CRLF & "Just string to format without Vars" & @CRLF) 74 | ConsoleWrite('"Some \texample text\n" => ' & StringFormat('Some \texample text\n')) 75 | 76 | 77 | Func PrintFormat($vVar, $sFormat, $sExplan, $iTab = 0) 78 | ConsoleWrite('"' & $sFormat & '" on ' & $vVar & @TAB & ' => ' & StringFormat($sFormat, $vVar)) 79 | If $iTab Then ConsoleWrite(@TAB) 80 | ConsoleWrite(@TAB & " ; " & $sExplan & @CRLF) 81 | EndFunc -------------------------------------------------------------------------------- /src/AutoItInterpreter/AutoItInterpreter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net8.0 5 | true 6 | preview 7 | 8 | enable 9 | 10 | 11 | $(SolutionDir)bin 12 | $(SolutionDir)bin 13 | autoit3 14 | Unknown6656.AutoIt3 15 | 16 | false 17 | true 18 | true 19 | false 20 | Auto 21 | false 22 | false 23 | true 24 | false 25 | false 26 | 27 | Unknown6656 28 | Unknown6656 29 | Copyright © 2020-$([System.DateTime]::Today.ToString(yyyy)), Unknown6656 30 | true 31 | Unknown6656 AutoIt3 Interpreter 32 | Unknown6656.AutoIt3 33 | true 34 | true 35 | snupkg 36 | LICENSE.md 37 | https://github.com/Unknown6656/AutoIt-Interpreter 38 | en 39 | https://github.com/Unknown6656/AutoIt-Interpreter 40 | icon.png 41 | Git 42 | unknown6656;AutoIt;AutoIt3;Interpreter;Compiler 43 | 44 | app.manifest 45 | 46 | 47 | 48 | 49 | True 50 | 51 | 52 | 53 | 54 | 55 | $(SolutionDir)/lib/Piglet.dll 56 | 57 | 58 | 59 | 60 | PreserveNewest 61 | 62 | 63 | 64 | 65 | True 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | PreserveNewest 88 | 89 | 90 | 91 | 92 | PreserveNewest 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/ButtonConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: Button_Constants 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants for GUI control Button styles and Group, Radio, Checkbox. 8 | ; Author(s) .....: Valik 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | ; Group 13 | Global Const $BS_GROUPBOX = 0x0007 14 | 15 | ; Button 16 | Global Const $BS_BOTTOM = 0x0800 17 | Global Const $BS_CENTER = 0x0300 18 | Global Const $BS_DEFPUSHBUTTON = 0x0001 19 | Global Const $BS_LEFT = 0x0100 20 | Global Const $BS_MULTILINE = 0x2000 21 | Global Const $BS_PUSHBOX = 0x000A 22 | Global Const $BS_PUSHLIKE = 0x1000 23 | Global Const $BS_RIGHT = 0x0200 24 | Global Const $BS_RIGHTBUTTON = 0x0020 25 | Global Const $BS_TOP = 0x0400 26 | Global Const $BS_VCENTER = 0x0C00 27 | Global Const $BS_FLAT = 0x8000 28 | Global Const $BS_ICON = 0x0040 29 | Global Const $BS_BITMAP = 0x0080 30 | Global Const $BS_NOTIFY = 0x4000 31 | ; Vista 32 | Global Const $BS_SPLITBUTTON = 0x0000000C 33 | Global Const $BS_DEFSPLITBUTTON = 0x0000000D 34 | Global Const $BS_COMMANDLINK = 0x0000000E 35 | Global Const $BS_DEFCOMMANDLINK = 0x0000000F 36 | 37 | ; Vista SPLIT BUTTON INFO mask flags 38 | Global Const $BCSIF_GLYPH = 0x0001 39 | Global Const $BCSIF_IMAGE = 0x0002 40 | Global Const $BCSIF_STYLE = 0x0004 41 | Global Const $BCSIF_SIZE = 0x0008 42 | 43 | ; Vista SPLIT BUTTON STYLE flags 44 | Global Const $BCSS_NOSPLIT = 0x0001 45 | Global Const $BCSS_STRETCH = 0x0002 46 | Global Const $BCSS_ALIGNLEFT = 0x0004 47 | Global Const $BCSS_IMAGE = 0x0008 48 | 49 | Global Const $BUTTON_IMAGELIST_ALIGN_LEFT = 0 50 | Global Const $BUTTON_IMAGELIST_ALIGN_RIGHT = 1 51 | Global Const $BUTTON_IMAGELIST_ALIGN_TOP = 2 52 | Global Const $BUTTON_IMAGELIST_ALIGN_BOTTOM = 3 53 | Global Const $BUTTON_IMAGELIST_ALIGN_CENTER = 4 ; Doesn't draw text 54 | 55 | ; Checkbox 56 | Global Const $BS_3STATE = 0x0005 57 | Global Const $BS_AUTO3STATE = 0x0006 58 | Global Const $BS_AUTOCHECKBOX = 0x0003 59 | Global Const $BS_CHECKBOX = 0x0002 60 | 61 | ; Radio 62 | Global Const $BS_RADIOBUTTON = 0x4 63 | Global Const $BS_AUTORADIOBUTTON = 0x0009 64 | 65 | Global Const $BS_OWNERDRAW = 0xB 66 | 67 | ; Control default styles 68 | Global Const $GUI_SS_DEFAULT_BUTTON = 0 69 | Global Const $GUI_SS_DEFAULT_CHECKBOX = 0 70 | Global Const $GUI_SS_DEFAULT_GROUP = 0 71 | Global Const $GUI_SS_DEFAULT_RADIO = 0 72 | 73 | ; Messages 74 | Global Const $BCM_FIRST = 0x1600 75 | Global Const $BCM_GETIDEALSIZE = ($BCM_FIRST + 0x0001) 76 | Global Const $BCM_GETIMAGELIST = ($BCM_FIRST + 0x0003) 77 | Global Const $BCM_GETNOTE = ($BCM_FIRST + 0x000A) 78 | Global Const $BCM_GETNOTELENGTH = ($BCM_FIRST + 0x000B) 79 | Global Const $BCM_GETSPLITINFO = ($BCM_FIRST + 0x0008) 80 | Global Const $BCM_GETTEXTMARGIN = ($BCM_FIRST + 0x0005) 81 | Global Const $BCM_SETDROPDOWNSTATE = ($BCM_FIRST + 0x0006) 82 | Global Const $BCM_SETIMAGELIST = ($BCM_FIRST + 0x0002) 83 | Global Const $BCM_SETNOTE = ($BCM_FIRST + 0x0009) 84 | Global Const $BCM_SETSHIELD = ($BCM_FIRST + 0x000C) 85 | Global Const $BCM_SETSPLITINFO = ($BCM_FIRST + 0x0007) 86 | Global Const $BCM_SETTEXTMARGIN = ($BCM_FIRST + 0x0004) 87 | Global Const $BM_CLICK = 0xF5 88 | Global Const $BM_GETCHECK = 0xF0 89 | Global Const $BM_GETIMAGE = 0xF6 90 | Global Const $BM_GETSTATE = 0xF2 91 | Global Const $BM_SETCHECK = 0xF1 92 | Global Const $BM_SETDONTCLICK = 0xF8 93 | Global Const $BM_SETIMAGE = 0xF7 94 | Global Const $BM_SETSTATE = 0xF3 95 | Global Const $BM_SETSTYLE = 0xF4 96 | 97 | ; Notifications 98 | Global Const $BCN_FIRST = -1250 99 | Global Const $BCN_DROPDOWN = ($BCN_FIRST + 0x0002) 100 | Global Const $BCN_HOTITEMCHANGE = ($BCN_FIRST + 0x0001) 101 | Global Const $BN_CLICKED = 0 102 | Global Const $BN_PAINT = 1 103 | Global Const $BN_HILITE = 2 104 | Global Const $BN_UNHILITE = 3 105 | Global Const $BN_DISABLE = 4 106 | Global Const $BN_DOUBLECLICKED = 5 107 | Global Const $BN_SETFOCUS = 6 108 | Global Const $BN_KILLFOCUS = 7 109 | Global Const $BN_PUSHED = $BN_HILITE 110 | Global Const $BN_UNPUSHED = $BN_UNHILITE 111 | Global Const $BN_DBLCLK = $BN_DOUBLECLICKED 112 | 113 | ; check states 114 | Global Const $BST_CHECKED = 0x1 115 | Global Const $BST_INDETERMINATE = 0x2 116 | Global Const $BST_UNCHECKED = 0x0 117 | Global Const $BST_FOCUS = 0x8 118 | Global Const $BST_PUSHED = 0x4 119 | Global Const $BST_DONTCLICK = 0x000080 120 | ; =============================================================================================================================== 121 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/APIRegConstants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ======================================================================================================================= 4 | ; Title .........: WinAPIReg Constants UDF Library for AutoIt3 5 | ; AutoIt Version : 3.3.14.5 6 | ; Language ......: English 7 | ; Description ...: Constants that can be used with UDF library 8 | ; Author(s) .....: Yashied, Jpm 9 | ; =============================================================================================================================== 10 | 11 | ; #CONSTANTS# =================================================================================================================== 12 | 13 | ; _WinAPI_AssocGetPerceivedType() 14 | Global Const $PERCEIVED_TYPE_CUSTOM = -3 15 | Global Const $PERCEIVED_TYPE_UNSPECIFIED = -2 16 | Global Const $PERCEIVED_TYPE_FOLDER = -1 17 | Global Const $PERCEIVED_TYPE_UNKNOWN = 0 18 | Global Const $PERCEIVED_TYPE_TEXT = 1 19 | Global Const $PERCEIVED_TYPE_IMAGE = 2 20 | Global Const $PERCEIVED_TYPE_AUDIO = 3 21 | Global Const $PERCEIVED_TYPE_VIDEO = 4 22 | Global Const $PERCEIVED_TYPE_COMPRESSED = 5 23 | Global Const $PERCEIVED_TYPE_DOCUMENT = 6 24 | Global Const $PERCEIVED_TYPE_SYSTEM = 7 25 | Global Const $PERCEIVED_TYPE_APPLICATION = 8 26 | Global Const $PERCEIVED_TYPE_GAMEMEDIA = 9 27 | Global Const $PERCEIVED_TYPE_CONTACTS = 10 28 | 29 | Global Const $PERCEIVEDFLAG_UNDEFINED = 0x0000 30 | Global Const $PERCEIVEDFLAG_SOFTCODED = 0x0001 31 | Global Const $PERCEIVEDFLAG_HARDCODED = 0x0002 32 | Global Const $PERCEIVEDFLAG_NATIVESUPPORT = 0x0004 33 | Global Const $PERCEIVEDFLAG_GDIPLUS = 0x0010 34 | Global Const $PERCEIVEDFLAG_WMSDK = 0x0020 35 | Global Const $PERCEIVEDFLAG_ZIPFOLDER = 0x0040 36 | 37 | ; _WinAPI_AssocQueryString() 38 | Global Const $ASSOCSTR_COMMAND = 1 39 | Global Const $ASSOCSTR_EXECUTABLE = 2 40 | Global Const $ASSOCSTR_FRIENDLYDOCNAME = 3 41 | Global Const $ASSOCSTR_FRIENDLYAPPNAME = 4 42 | Global Const $ASSOCSTR_NOOPEN = 5 43 | Global Const $ASSOCSTR_SHELLNEWVALUE = 6 44 | Global Const $ASSOCSTR_DDECOMMAND = 7 45 | Global Const $ASSOCSTR_DDEIFEXEC = 8 46 | Global Const $ASSOCSTR_DDEAPPLICATION = 9 47 | Global Const $ASSOCSTR_DDETOPIC = 10 48 | Global Const $ASSOCSTR_INFOTIP = 11 49 | Global Const $ASSOCSTR_QUICKTIP = 12 50 | Global Const $ASSOCSTR_TILEINFO = 13 51 | Global Const $ASSOCSTR_CONTENTTYPE = 14 52 | Global Const $ASSOCSTR_DEFAULTICON = 15 53 | Global Const $ASSOCSTR_SHELLEXTENSION = 16 54 | 55 | Global Const $ASSOCF_INIT_NOREMAPCLSID = 0x00000001 56 | Global Const $ASSOCF_INIT_BYEXENAME = 0x00000002 57 | Global Const $ASSOCF_OPEN_BYEXENAME = 0x00000002 58 | Global Const $ASSOCF_INIT_DEFAULTTOSTAR = 0x00000004 59 | Global Const $ASSOCF_INIT_DEFAULTTOFOLDER = 0x00000008 60 | Global Const $ASSOCF_NOUSERSETTINGS = 0x00000010 61 | Global Const $ASSOCF_NOTRUNCATE = 0x00000020 62 | Global Const $ASSOCF_VERIFY = 0x00000040 63 | Global Const $ASSOCF_REMAPRUNDLL = 0x00000080 64 | Global Const $ASSOCF_NOFIXUPS = 0x00000100 65 | Global Const $ASSOCF_IGNOREBASECLASS = 0x00000200 66 | Global Const $ASSOCF_INIT_IGNOREUNKNOWN = 0x00000400 67 | 68 | ; _WinAPI_Reg... 69 | Global Const $HKEY_CLASSES_ROOT = 0x80000000 70 | Global Const $HKEY_CURRENT_CONFIG = 0x80000005 71 | Global Const $HKEY_CURRENT_USER = 0x80000001 72 | Global Const $HKEY_LOCAL_MACHINE = 0x80000002 73 | Global Const $HKEY_PERFORMANCE_DATA = 0x80000004 74 | Global Const $HKEY_PERFORMANCE_NLSTEXT = 0x80000060 75 | Global Const $HKEY_PERFORMANCE_TEXT = 0x80000050 76 | Global Const $HKEY_USERS = 0x80000003 77 | 78 | Global Const $KEY_CREATE_LINK = 0x0020 79 | Global Const $KEY_CREATE_SUB_KEY = 0x0004 80 | Global Const $KEY_ENUMERATE_SUB_KEYS = 0x0008 81 | Global Const $KEY_NOTIFY = 0x0010 82 | Global Const $KEY_QUERY_VALUE = 0x0001 83 | Global Const $KEY_SET_VALUE = 0x0002 84 | Global Const $KEY_WOW64_32KEY = 0x0200 85 | Global Const $KEY_WOW64_64KEY = 0x0100 86 | Global Const $KEY_READ = 0x00020019 ; BitOR($STANDARD_RIGHTS_READ, $KEY_QUERY_VALUE, $KEY_ENUMERATE_SUB_KEYS, $KEY_NOTIFY) 87 | Global Const $KEY_WRITE = 0x00020006 ; BitOR($STANDARD_RIGHTS_WRITE, $KEY_SET_VALUE, $KEY_CREATE_SUB_KEY) 88 | Global Const $KEY_EXECUTE = $KEY_READ 89 | Global Const $KEY_ALL_ACCESS = 0x000f003f ; BitOR($STANDARD_RIGHTS_REQUIRED, $KEY_QUERY_VALUE, $KEY_SET_VALUE, $KEY_CREATE_SUB_KEY, $KEY_ENUMERATE_SUB_KEYS, $KEY_NOTIFY, $KEY_CREATE_LINK) 90 | 91 | Global Const $REG_NOTIFY_CHANGE_NAME = 0x01 92 | Global Const $REG_NOTIFY_CHANGE_ATTRIBUTES = 0x02 93 | Global Const $REG_NOTIFY_CHANGE_LAST_SET = 0x04 94 | Global Const $REG_NOTIFY_CHANGE_SECURITY = 0x08 95 | 96 | Global Const $REG_OPTION_BACKUP_RESTORE = 0x04 97 | Global Const $REG_OPTION_CREATE_LINK = 0x02 98 | Global Const $REG_OPTION_NON_VOLATILE = 0x00 99 | Global Const $REG_OPTION_VOLATILE = 0x01 100 | ; =============================================================================================================================== 101 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Include/Constants.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | #include "AutoItConstants.au3" 4 | #include "ColorConstants.au3" 5 | #include "DirConstants.au3" 6 | #include "FileConstants.au3" 7 | #include "MsgBoxConstants.au3" 8 | #include "ProcessConstants.au3" 9 | #include "StringConstants.au3" 10 | #include "TrayConstants.au3" 11 | 12 | ; #INDEX# ======================================================================================================================= 13 | ; Title .........: Constants 14 | ; AutoIt Version : 3.3.14.5 15 | ; Language ......: English 16 | ; Description ...: Constants to be included in an AutoIt v3 script. 17 | ; Author(s) .....: JLandes, Nutster, CyberSlug, Holger, ... 18 | ; =============================================================================================================================== 19 | 20 | ; #CONSTANTS# =================================================================================================================== 21 | ; Sets the way coords are used in the mouse and pixel functions 22 | ; in AutoItConstants.au3 23 | 24 | ; Sets how errors are handled if a Run/RunWait function fails 25 | ; in AutoItConstants.au3 26 | 27 | ; Alters the use of Caps Lock 28 | ; in AutoItConstants.au3 29 | 30 | ; Alters the method that is used to match window titles 31 | ; in AutoItConstants.au3 32 | 33 | ; Common Control Styles 34 | ; in AutoItConstants.au3 35 | 36 | ; DrawIconEx Constants 37 | ; in WinAPIConstants.au3 38 | 39 | ; EnumDisplayDevice Constants 40 | ; in WinAPIConstants.au3 41 | 42 | ; Dir Constants 43 | ; in DirConstants.au3 44 | 45 | ; DriveGetType() Constants 46 | ; in AutoItConstants.au3 47 | 48 | ; File Constants 49 | ; in FileConstants.au3 50 | 51 | ; FlashWindowEx Constants 52 | ; in WinAPIConstants.au3 53 | 54 | ; FormatMessage Constants 55 | ; in WinAPIConstants.au3 56 | 57 | ; GetWindows Constants 58 | ; in WinAPIConstants.au3 59 | 60 | ; GetWindowLong Constants 61 | ; in WinAPIConstants.au3 62 | 63 | ; Standard Icon Index Constants 64 | ; in WinAPIConstants.au3 65 | 66 | ; Image Load Constants 67 | ; in WinAPIConstants.au3 68 | 69 | ; Image Type Constants 70 | ; in WinAPIConstants.au3 71 | 72 | ; Keyboard Constants 73 | ; Changes how keys are processed 74 | ; in WinAPIConstants.au3 75 | 76 | ; Sets the state of the Caps Lock key 77 | ; in WinAPIConstants.au3 78 | 79 | ; LoadLibraryEx Constants 80 | ; in WinAPIConstants.au3 81 | 82 | ; Reserved IDs for System Objects 83 | ; in MenuConstants.au3 84 | ; in ScrollBarsConstants.au3 85 | ; in AutoItConstants.au3 86 | 87 | ; Virtual Keys Constants 88 | ; in WinAPIvkeysConstants.au3 89 | 90 | ; Message Box Constants 91 | ; Indicates the buttons displayed in the message box 92 | ; in MsgBoxConstants.au3 93 | 94 | ; Displays an icon in the message box 95 | ; in MsgBoxConstants.au3 96 | 97 | ; Indicates the default button 98 | ; in MsgBoxConstants.au3 99 | 100 | ; Indicates the modality of the dialog box 101 | ; in MsgBoxConstants.au3 102 | 103 | ; Indicates miscellaneous message box attributes 104 | ; in MsgBoxConstants.au3 105 | 106 | ; Indicates the button selected in the message box 107 | ; in MsgBoxConstants.au3 108 | 109 | ; Progress and Splash Constants 110 | ; Indicates properties of the displayed progress or splash dialog 111 | ; in AutoItConstants.au3 112 | 113 | ; Tray Tip Constants 114 | ; in TrayConstants.au3 115 | 116 | ; Mouse Constants 117 | ; Indicates current mouse cursor 118 | ; in AutoItConstants.au3 119 | 120 | ; Process Constants 121 | ; Indicates the type of shutdown 122 | ; in AutoItConstants.au3 123 | 124 | ; OpenProcess Constants 125 | ; in ProcessConstants.au3 126 | 127 | ; String Constants 128 | ; in StringConstants.au3 129 | ; Indicates if string operations should be case sensitive 130 | 131 | ; StringStripWS Constants 132 | ; Indicates the type of stripping that should be performed 133 | ; in StringConstants.au3 134 | 135 | ; StringSplit Constants 136 | ; in StringConstants.au3 137 | 138 | ; Token Constants 139 | ; in SecurityConstants.au3 140 | 141 | ; Tray Constants 142 | ; in TrayConstants.au3 143 | 144 | ; Run Constants 145 | ; in AutoItConstants.au3 146 | 147 | ; Colour Constants 148 | ; in ColorConstants.au3 149 | 150 | ; UBound Constants 151 | ; in AutoItConstants.au3 152 | 153 | ; Mouse Event Constants 154 | ; in AutoItConstants.au3 155 | 156 | ; Reg Value type Constants 157 | ; in AutoItConstants.au3 158 | 159 | ; Z order 160 | ; in AutoItConstants.au3 161 | 162 | ; SetWindowPos Constants 163 | ; in AutoItConstants.au3 164 | 165 | ; Keywords (returned from the IsKeyword() function 166 | ; in AutoItConstants.au3 167 | 168 | ; language identifiers 169 | ; in WinAPIlangConstants.au3 170 | 171 | ; sublanguage identifiers 172 | ; in WinAPIlangConstants.au3 173 | 174 | ; Sorting IDs. (from WINNT.H) 175 | ; in WinAPIlangConstants.au3 176 | ; =============================================================================================================================== 177 | -------------------------------------------------------------------------------- /src/AutoItInterpreter/Runtime/StringFormatter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.RegularExpressions; 3 | using System.Text; 4 | using System.Linq; 5 | using System; 6 | 7 | using Unknown6656.Generics; 8 | 9 | namespace Unknown6656.AutoIt3.Runtime; 10 | 11 | /// 12 | /// Contains a string formatting engine compatible with the specification . 13 | /// 14 | public static class StringFormatter 15 | { 16 | private static readonly Regex REGEX_FROMAT = new(@"^%(?[+\-0#]*)(?\d+)?(\.(?\d+))?(?[diouxXeEfgGs])", RegexOptions.Compiled); 17 | private static readonly Regex REGEX_ESCAPE = new(@"^\\[rnt\\]", RegexOptions.Compiled); 18 | 19 | 20 | /// 21 | /// Formats the given string using the given arguments according to the AutoIt-specification. 22 | /// 23 | /// Format string. 24 | /// Format string arguments. 25 | /// Formatted string. 26 | public static string FormatString(string format, IEnumerable args) => FormatString(format, args.ToArray()); 27 | 28 | /// 29 | /// Formats the given string using the given arguments according to the AutoIt-specification. 30 | /// 31 | /// Format string. 32 | /// Format string arguments. 33 | /// Formatted string. 34 | public static string FormatString(string format, params Variant[] args) 35 | { 36 | StringBuilder output = new(); 37 | int arg_index = 0; 38 | 39 | while (format.Length > 0) 40 | if (format.StartsWith("%%")) 41 | { 42 | output.Append('%'); 43 | format = format[2..]; 44 | } 45 | else if (REGEX_FROMAT.Match(format) is { Success: true, Groups: var g, Length: int len }) 46 | { 47 | int.TryParse(g["width"].Value, out int width); 48 | int.TryParse(g["precision"].Value, out int precision); 49 | FormatFlags[] flags = g["flag"].Value.Distinct().ToArray(c => (FormatFlags)c); 50 | char type = g["type"].Value[0]; 51 | Variant arg = arg_index < args.Length ? args[arg_index] : default; 52 | 53 | string result = type switch 54 | { 55 | 'd' or 'i' => LINQ.Do(delegate 56 | { 57 | long value = (long)arg; 58 | 59 | return (value > 0 && flags.Contains(FormatFlags.Prefix) ? "+" : "") + value.ToString().PadLeft(Math.Max(precision - 1, 0), '0'); 60 | }), 61 | 'o' => Convert.ToString((uint)(int)arg, 8).PadLeft(precision, '0'), 62 | 'u' => ((ulong)(long)arg).ToString().PadLeft(precision, '0'), 63 | 'x' or 'X' => ((ulong)(long)arg).ToString($"{type}{precision}"), 64 | 'e' or 'E' or 'f' or 'g' or 'G' => arg.ToNumber().ToString($"{type}{precision}"), 65 | _ when precision is 0 => arg.ToString(), 66 | _ => arg.ToString()[..(precision + 1)], 67 | }; 68 | 69 | if (flags.Contains(FormatFlags.ZeroPadding) && width > result.Length) 70 | { 71 | string pad = new('0', result.Length - width); 72 | 73 | result = result[0] == '-' ? '-' + pad + result[1..] : pad + result; 74 | } 75 | 76 | if (flags.Contains(FormatFlags.Blank)) 77 | if (type is 'o') 78 | result = "0o" + result; 79 | else if (type is 'x' or 'X') 80 | result = $"0{type}{result}"; 81 | 82 | result = flags.Contains(FormatFlags.LeftAlign) ? result.PadRight(width) : result.PadLeft(width); 83 | format = format[len..]; 84 | ++arg_index; 85 | 86 | output.Append(result); 87 | } 88 | else if (REGEX_FROMAT.Match(format) is { Success: true, Value: string escape }) 89 | { 90 | output.Append(escape[1] switch 91 | { 92 | 'r' => '\r', 93 | 'n' => '\n', 94 | 't' => '\t', 95 | '\\' => '\\', 96 | _ => escape[1], 97 | }); 98 | format = format[2..]; 99 | } 100 | else 101 | { 102 | output.Append(format[0]); 103 | format = format[1..]; 104 | } 105 | 106 | return output.ToString(); 107 | } 108 | 109 | private enum FormatFlags 110 | { 111 | Prefix = '+', 112 | LeftAlign = '-', 113 | ZeroPadding = '0', 114 | Blank = '#', 115 | } 116 | } 117 | --------------------------------------------------------------------------------