diff --git a/.gitignore b/.gitignore index d7ad4e1..bfc472a 100644 --- a/.gitignore +++ b/.gitignore @@ -25,20 +25,18 @@ # custom # !lib/*.ahk !lib/**/*.ahk -!lib/**/*.ahk2 -!lib/**/*.ahkv2 # !scripts/*.ahk !scripts/**/*.ahk -!scripts/**/*.ahk2 -!scripts/**/*.ahkv2 # !scripts/bin/*.exe ahkstudio/* autohotinterception/* scripts/SteamBulkKeyActivator/ scripts/temp/ -!scripts/buttons/* Adventure/ AutoGUI/ Lib/TrayIcon.bak.ahk -scripts/AHK-Rare +*.mp3 +*.mp4 +*.wav +/Scripts/sirens \ No newline at end of file diff --git a/AHK-v2-script-converter-master/README.md b/AHK-v2-script-converter-master/README.md deleted file mode 100644 index a75e808..0000000 --- a/AHK-v2-script-converter-master/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# AHK-v2-script-converter -This script will attempt to convert a script written in AHK v1 to the correct syntax so that it works in [AHK v2](https://autohotkey.com/v2/). -It is useful to quickly convert some of the bigger syntax changes. Afterwards you can investigate the converted version for other minor changes that the converter didn't cover. - -I took Frankie's original converter linked below, and updated it to work with the latest AHK v2 alpha build. -I've also added essential unit tests using the [Yunit framework](https://github.com/Uberi/Yunit) to encourage contributions from others. - -However, this project is way more ambitious that I originally thought, and __it needs a lot of work__. See below for how you can [contribute](#contributing). - -# Usage -## Usage 1 -1. [Download](https://github.com/mmikeww/AHK-v2-script-converter/archive/master.zip) the full repo. Then run the included `QuickConvectorV2.ahk` file with AHK V2 Beta -2. Select a string in another program and press XButton1 to convert it, or paste it in the first Edit and press the convert button (Green arrow). -3. When the cursor is on a function in the edit field, press F1 to search the function in the documentation. -4. You can run and close the V1 and V2 code with the play buttons. -5. There are also compare buttons to see better the difference between the scripts. -6. When working on ConvertFuncs.ahk, please set TestMode on in the Gui Menu Settings, in this mode, all the confirmed tests will be checked if the result stays the same. In this mode you can also save tests easily. -![screenshot](https://github.com/mmikeww/AHK-v2-script-converter/blob/master/images/Quick%20Convertor%20V2.png) - -## Usage 2 (alternative) -1. [Download](https://github.com/mmikeww/AHK-v2-script-converter/archive/master.zip) the full repo. Then run the included `v2converter.ahk` script with AHK v2 -2. Choose your input `scriptfile.ahk` written for AHK v1. - The converted script will be named `scriptfile_v2new.ahk` in the same directory -3. Look over the Visual Diff to manually inspect the changes -![screenshot](https://github.com/mmikeww/AHK-v2-script-converter/blob/master/images/screenshot.jpg) - -## Note -The `v2converter.exe` file (as well as the `tests\Tests.exe` file) is simply a renamed copy of the `AutoHotkey32-v2.0-beta.1.exe` interpreter file. The interpreter alone does nothing without passing a script to it. But here, we take advantage of the [default scriptfile feature](https://lexikos.github.io/v2/docs/Scripts.htm#defaultfile) where the v2converter.exe file will look for a file named v2converter.ahk and automatically run it. You can make changes to the .ahk file and then just run the .exe. The reason for doing this is because most people will still have AHK v1 installed and associated with `*.ahk` files. So it would be inconvenient to run this converter without some workarounds. Likewise, the `diff\VisualDiff.exe` file is just a renamed `AutoHotkeyU32-v1.1.24.02.exe` - -# Known Issues -The converter is not complete. That is, it does not detect all things that need to be changed to make sure the script works in v2. However, for the things that it DOES change, everything should hopefully work, except for the following. Here are the instances that are known to fail: -1. There is a [little known feature](https://autohotkey.com/docs/commands/_EscapeChar.htm) where commas don't need to be escaped if they are in the last parameter of a command. This converter can detect those, except when the command is an IfCommand. This is because the converter needs to check for a same-line action, such as in `IfEqual, var, value, Sleep, 500`. The unit tests for those unescaped commas are commented out. -2. Converting Gui is becoming better, the only big issue is the handling of the g-labels, the methods are completely different. - -# Contributing -There is a lot of work to do and many commands and functions that still need to be changed. There are also many edge cases when trying to parse script code and convert it. Of course, whenever making changes to the code, you should be constantly running the unit tests to confirm that things are still working. Simply run the `tests\Tests.exe` file and pray for green. - -Here are a few ways you can help: - -- Use it to convert your v1 scripts - When you find errors or mistakes in the conversion, [open an issue here on github](https://github.com/mmikeww/AHK-v2-script-converter/issues) -- Write tests - You don't even need to write implementation code. Simply write some tests. There are existing commands that the original converter supported that have not been tested with my changes, such as `StringTrimRight`. Follow the existing format in the `tests\Tests.ahk` file. -- Fix/add existing failing tests - In the folder [Failed conversions](https://github.com/mmikeww/AHK-v2-script-converter/tree/master/tests/Failed%20conversions) we put the tests that are currenly failing as a ah1 file. The correct conversion is the ah2 file. -- Work on any existing [issues](https://github.com/mmikeww/AHK-v2-script-converter/issues) -- Refactor the code - The code isn't in very good condition. And you can lean on the unit testing suite as you try to make it better. -- Add support for other changes. You can find the definitive list here: [v2-changes](https://autohotkey.com/v2/v2-changes.htm) - This would include adding support for new commands or other syntax changes. Follow the example in [this commit](https://github.com/mmikeww/AHK-v2-script-converter/commit/6f9fce882a846b15776431a4b27cac9a2aba30d3). - -And of course, create a Pull Request with your changed code - -# Credits -- Frankie who created the [original v2 converter](https://autohotkey.com/board/topic/65333-v2-script-converter/) -- Uberi for his [updates to the original](https://autohotkey.com/board/topic/65333-v2-script-converter/?p=419671) -- [Mergely](https://github.com/wickedest/Mergely) for the javascript diff library -- Aurelain's [Exo](https://autohotkey.com/boards/viewtopic.php?t=5714) for the interface to run the javascript in an AHK gui -- Mmikeww and AHK_User updated the scrip to start working in V2-Beta -- AHK_User (=dmtr99) Updated the code to be able to convert to the V2-Beta syntax and is currently working on it -- I'm sure many others diff --git a/AHK-v2-script-converter-master/tests/Yunit/README.md b/AHK-v2-script-converter-master/tests/Yunit/README.md deleted file mode 100644 index 97477ef..0000000 --- a/AHK-v2-script-converter-master/tests/Yunit/README.md +++ /dev/null @@ -1,32 +0,0 @@ -Yunit -===== -Super simple unit testing framework for [AutoHotkey](http://www.autohotkey.com/). - -Usage ------ -See [doc/Main.md](doc/Main.md) - -Branch Description ------------------- -- Branch *master* covers usage of YUnit in AutoHotkey from 1.1.x up to 2.0.a77 -- Branch *v2* covers usage of Yunit in AutoHotkey from v2.0-beta.1 (where incompatible -changes in GUI-interface where introduced) - -License -------- -Copyright 2012 Anthony Zhang (Uberi) and Joe Taber (infogulch). - -This file is part of Yunit. Source code is available at . - -Yunit is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . diff --git a/AHK-v2-script-converter-master/tests/Yunit/doc/Main.md b/AHK-v2-script-converter-master/tests/Yunit/doc/Main.md deleted file mode 100644 index 55e9aa7..0000000 --- a/AHK-v2-script-converter-master/tests/Yunit/doc/Main.md +++ /dev/null @@ -1,217 +0,0 @@ -Yunit -===== -Super simple testing framework for AutoHotkey. - -Yunit is designed to aid in the following tasks: - -* Automated code testing. -* Automated benchmarking. -* Basic result reporting and collation. -* Test management. - -Example -------- -See [doc/Example.ahk](Example.ahk) for a working example script that demonstrates Yunit being used for testing. - -A basic test setup looks like the following: - - Yunit.Use(YunitStdout).Test(TestSuite) - - class TestSuite - { - SomeTest() - { - return True - } - } - -Installation ------------- -Installation is simply a matter of adding the Yunit folder to the library path of your project. - -An example directory structure is shown below: - - + SomeProject - | + Lib - | | + Yunit - | | | LICENSE.txt - | | | README.md - | | | ... - | | + OtherLibrary - | | | ... - | README.md - | SomeProject.ahk - | ... - -In AutoHotkey v1.1, library locations are checked as follows: - -1. Local library: %A_ScriptDir%\Lib\ -2. User library: %A_MyDocuments%\Lib\ -3. Standard library: %A_AhkPath%\Lib\ - -Importing ---------- -Yunit and its modules must be imported to be used: - - #Include ;import the basic test routines (mandatory) - #Include ;import the window output module (optional) - #Include ;import the stdout output module (optional) - #Include ;import the OutputDebug output module (optional) - #Include ;import the JUnit output module (optional) - -Output modules only need to be imported if they are going to be used. - -Usage ------ -Yunit is implemented as a class, conveniently named `Yunit`. -This class is static, which basically means you do not need to make a new instance of `Yunit` it to use it. - -To begin, first we need to select the output modules to use (a list of available modules is documented in the *Modules* section below). -In other words, where the results of the tests should go. - -This is done using the `Yunit.Use(Modules*)` method, where `Modules*` represents zero or more modules to use. -When called, the method returns a `Yunit.Tester` object, which represents the options and settings for a group of tests: - - Tester := Yunit.Use(YunitStdout, YunitWindow) - -This code creates a `Yunit.Tester` object that uses the `YunitStdout` and `YunitWindow` modules for output. - -Now that the `Yunit.Tester` object has been created, we can run a set of tests against it. -This is done using the `Yunit.Tester.Test(Classes*)` method, where `Classes*` represents zero or more test classes to use (the format is documented in the *Tests* section below). -When called, the method starts the tests and manages the results: - - Tester.Test(FirstTestSet, SecondTestSet, ThirdTestSet) - -This code runs all tests in all three sets. - -This method is synchronous and blocks the current thread until complete. -Results will be shown while the method is running. - -Instead of using the two lines above, it may be preferable to simply chain them together: - - Yunit.Use(YunitStdout, YunitWindow).Test(FirstTestSet, SecondTestSet, ThirdTestSet) - -Modules -------- -Multiple output modules are available: - -### YunitStdout - - Tester := Yunit.Use(YunitStdout) - -This module writes the test results to the standard output. To see the output, use [this](https://autohotkey.com/docs/commands/FileAppend.htm) at the command prompt: - -`"%ProgramFiles%\AutoHotkey\AutoHotkey.exe" "TestsScript.ahk" | more` - -The results are formatted one per line, each entry being in the following form: - - Result: Category.TestName Data - -* _Result_ - result of the test ("PASS" or "FAIL"). -* _Category_ - category or categories that the test is located under, with subcategories separated by dots (Category.Subcategory.OtherCategory). -* _TestName_ - name of the test being run. -* _Data_ - data given by the test, such as specific error messages or benchmark numbers. - -### YunitOutputDebug - - Tester := Yunit.Use(YunitOutputDebug) - -This module writes the test results via OutputDebug. To see the output, see how to use [OutputDebug](https://autohotkey.com/docs/commands/OutputDebug.htm) - -The results are formatted one per line, each entry being in the following form: - - (Counter) Result: Category.TestName Data - -* _Counter_ - Number of the performed test -* _Result_ - result of the test ("PASS" or "FAIL"). -* _Category_ - category or categories that the test is located under, with subcategories separated by dots (Category.Subcategory.OtherCategory). -* _TestName_ - name of the test being run. -* _Data_ - data given by the test, such as specific error messages or benchmark numbers. - -### YunitJUnit - - Tester := Yunit.Use(YunitJUnit) - -This module writes the test results JUnit compatible XML-Output. The XML-File is generated in the _directory where the Test-script_ resides and -has the name _junit.xml_. - -The JUnit format is commonly used on Continuous-Integration servers (like [jenkins](https://jenkins.io/)) - -See [here for more information on the JUnit-format](https://pzolee.blogs.balabit.com/2012/11/jenkins-vs-junit-xml-format/) - -### YunitWindow - - Tester := Yunit.Use(YunitWindow) - -This module displays the test results in a window with icons showing the status of each test. - -The results are shown in the form of a tree control, with each test suite having a top level node, and categories or tests having child nodes. - -Beside each node is an icon: - -* _Green up arrow_ - test passed successfully. -* _Yellow triangle with exclamation mark_ - test failed. -* _Two papers_ - test result/description. - -Tests that result in data will have an additional child node that can be expanded to show it. - -Test Suites and Categories --------------------------- -Test suites are written as classes. Class methods are considered tests; nested classes are considered categories. -Classes nested within these nested classes are considered subcategories, and so on: - - class TestSuite - { - This_Is_A_Test() - { - ;... - } - - class This_Is_A_Category - { - This_Is_A_Test() - { - ;... - } - - This_Is_Another_Test() - { - ;... - } - } - } - -The above corresponds to the following test structure: - - TestSuite: - This_Is_A_Test - This_Is_A_Category: - This_Is_A_Test - This_Is_Another_Test - -The test and category names are determined from their identifiers in the code. Test and category names may be duplicated as long as they are in different categories. - -The order in which tests are called is arbitrary. - -Writing Tests -------------- -A test is a class method that takes no arguments and has no return value. -For a test to fail it must throw an Error exception. -Any test that returns normally is considered a success. -The method `Yunit.Assert(Value, Message)` conveniently throws an Error exception when `Value` evaluates to false, with an optional `Message` which is displayed if it fails. If the Assert() fails however, no subsequent code within the test function will execute. So, it should always be the last line within the function. - - This_Is_A_Test() - { - Yunit.Assert(1 = 1) ;test passes - } - - This_Is_Another_Test() - { - Yunit.Assert(1 = 2, "Description of the failure") ;test fails - MsgBox, hello world ;this never runs since the test above failed - } - -The special test methods `Begin()` and `End()`, if present, will be called on the instance of the class before and after _each test_, respectively. -Use this to do setup on the `this` object for each test in a category. - -In addition, the special class methods `__New()` and `__Delete()` are called before testing starts on a category and after it finishes, respectively. diff --git a/lib/bluscream.ahk b/lib/bluscream.ahk index 57ca436..8af9e02 100644 --- a/lib/bluscream.ahk +++ b/lib/bluscream.ahk @@ -10,6 +10,7 @@ #Include %A_LineFile%\..\bluscream\utils.ahk #Include %A_LineFile%\..\bluscream\tray.ahk #Include %A_LineFile%\..\bluscream\addon.ahk +#Include %A_LineFile%\..\bluscream\toast.ahk ObjectCount(object) { count := 0 @@ -204,7 +205,7 @@ ProcessExists(PID_or_Name){ Process, Exist, % PID_or_Name Return Errorlevel } -StdOutToVar( sCmd ) { ; GAHK32 ; Modified Version : SKAN 05-Jul-2013 http://goo.gl/j8XJXY +StdOutToVar2( sCmd ) { ; GAHK32 ; Modified Version : SKAN 05-Jul-2013 http://goo.gl/j8XJXY Static StrGet := "StrGet" ; Original Author : Sean 20-Feb-2007 http://goo.gl/mxCdn DllCall( "CreatePipe", UIntP,hPipeRead, UIntP,hPipeWrite, UInt,0, UInt,0 ) @@ -245,7 +246,7 @@ StdOutToVar( sCmd ) { ; GAHK32 ; Modified Version : SKAN 05-Jul-2013 http://go Return sOutput, DllCall( "SetLastError", UInt,ExitCode ) } -StdOutStream( sCmd, Callback = "" ) { ; Modified : SKAN 31-Aug-2013 http://goo.gl/j8XJXY +StdOutStream2( sCmd, Callback = "" ) { ; Modified : SKAN 31-Aug-2013 http://goo.gl/j8XJXY Static StrGet := "StrGet" ; Thanks to : HotKeyIt http://goo.gl/IsH1zs ; Original : Sean 20-Feb-2007 http://goo.gl/mxCdn diff --git a/lib/bluscream/toast.ahk b/lib/bluscream/toast.ahk new file mode 100644 index 0000000..5ce0c7c --- /dev/null +++ b/lib/bluscream/toast.ahk @@ -0,0 +1,101 @@ +global toastQueue := [] +global isShowingToast := false +global CloseToastFn := "" +; Function to add a toast to the queue +ShowToast(message, title := "AutoHotkey", icon_path := "toast.bmp", position := "topleft", time_seconds := 10, bg_color := "#222222") { + toastQueue.Push({message: message, title: title, icon_path: icon_path, position: position, time_seconds: time_seconds, bg_color: bg_color}) + CheckAndShowNextToast() +} +; Function to check if there's a toast ready to be shown +CheckAndShowNextToast() { + global toastQueue, isShowingToast + if (!isShowingToast) { + if (toastQueue.Length() > 0) { + isShowingToast := true + localToast := toastQueue.Pop() + CreateToast(localToast.message, localToast.title, localToast.icon_path, localToast.position, localToast.time_seconds, localToast.bg_color) + scriptlog(toJson(localToast)) + ; StartCheckTimer(-localToast.time_seconds * 1000) + } else { + SetTimer, % CloseToastFn, Off + } + } +} +StartCheckTimer(time) { + ; random, rnd, 1, 100 + CheckToastQueueFn := Func("CheckAndShowNextToast").bind(0) + SetTimer, % CheckToastQueueFn, % time +} +StartToastTimer(time) { + global CloseToastFn + ; random, rnd, 1, 100 + CloseToastFn := Func("CloseToast").bind(0) + SetTimer, % CloseToastFn, % time +} +; Function to close the toast window +CloseToast() { + global isShowingToast + scriptlog("CloseToast()") + Gui, Toast:Destroy + ; if (isShowingToast) + isShowingToast := False + if (toastQueue.Length() < 1) + SetTimer, % CloseToastFn, Off + CheckAndShowNextToast() +} +; Define the CreateToast function +CreateToast(message, title := "AutoHotkey", icon_path := "toast.bmp", position := "topleft", time_seconds := 10, bg_color := "222222") { + Gui, Toast:New + width := 1440 + height := 744 + ; WinGetPos,,, width, height + scriptlog("title " . toJson(title)) + scriptlog("message " . toJson(message)) + scriptlog("guiPosition " . toJson(guiPosition)) + scriptlog("width " . toJson(width)) + scriptlog("height " . toJson(height)) + if (width == "") + return + Gui, Toast:Font, s25 cFFFFFF + Gui, Toast:Add, Text, x80, %title% + Gui, Toast:Font, s15 + Gui, Toast:Add, Text, x20 y80, %message% + + ; Determine the position based on the position parameter + switch position + { + case "topleft": + guiPosition := "x" . (A_ScreenWidth / 2 - width / 2) - 150 . " y" . (A_ScreenHeight / 2 - height / 2) - 100 + case "topright": + guiPosition := "x" . (A_ScreenWidth - width - 20) . " y" . (A_ScreenHeight / 2 - height / 2) + case "bottomleft": + guiPosition := "x" . (A_ScreenWidth / 2 - width / 2) . " y" . (A_ScreenHeight - height - 20) + case "bottomright": + guiPosition := "x" . (A_ScreenWidth - width - 20) . " y" . (A_ScreenHeight - height - 20) + default: + guiPosition := "x" . (A_ScreenWidth / 2 - width / 2) . " y" . (A_ScreenHeight / 2 - height / 2) ; Default to top center + } + + Gui, Toast:+AlwaysOnTop -Caption +E0x20 +LastFound + + Gui, Toast:Show, % guiPosition . " NoActivate AutoSize" ; +E0x20 -Caption +AlwaysOnTop + ; Gui, Toast:Show, % "x" . (A_ScreenWidth / 2 - width / 2) . " y" . (A_ScreenHeight / 2 - height / 2) . " w" . width . " h" . height . " NoActivate" + + ; Set the background color + Gui, Toast:Color, %bg_color% + + ; Optionally set an icon + if (icon_path != "") { + Gui, Toast:Add, Picture, x10 y10 w64 h64, %icon_path% + } + + ; Set the transparency + Gui, Toast:+LastFound + WinSet, TransColor, % "c" . bg_color . " 240" + + timer := time_seconds * 1000 + scriptlog(toJson(timer)) + + ; Close the window after the specified time + StartToastTimer(timer) +} \ No newline at end of file diff --git a/lib/bluscream/ui.ahk b/lib/bluscream/ui.ahk index 444e3b9..779f934 100644 --- a/lib/bluscream/ui.ahk +++ b/lib/bluscream/ui.ahk @@ -149,4 +149,5 @@ HideTaskbar(hide) { NumPut(hide ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize) DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA) } + initialized := true \ No newline at end of file diff --git a/lib/virtual_desktop.ahk b/lib/virtual_desktop.ahk index e4c42df..27b0676 100644 --- a/lib/virtual_desktop.ahk +++ b/lib/virtual_desktop.ahk @@ -2,24 +2,29 @@ #Include class VirtualDesktop { - dir := new Directory("C:\Program Files\Virtual Desktop Streamer") - exe := dir.CombineFile(vd.windows.streamer.exe) - connected := vd.windows.server.process.exists() windows := { server: new Window("", "", "VirtualDesktop.Server.exe") ,streamer: new Window("Virtual Desktop Streamer", "HwndWrapper[VirtualDesktop.Streamer;UI Thread;", "VirtualDesktop.Streamer.exe") ,service: new Window("","","VirtualDesktop.Service.exe")} + dir := new Directory("C:\Program Files\Virtual Desktop Streamer") + connected := false service_name := "VirtualDesktop.Service" - streamer_path := new Paths.Public().programs.CombineFile("Virtual Desktop Streamer.lnk") + ; streamer_path := new File("C:\Program Files\Virtual Desktop Streamer\VirtualDesktop.Streamer.exe") ; new Paths.Public().programs.CombineFile("Virtual Desktop Streamer", "Virtual Desktop Streamer.lnk") doublechecking := false safe_mode := false args := "" eventhandlers := {} state := "None" - __New(exe := "", eventcallback := "") { - if (exe!="") { - this.exe := new File(exe) - this.dir := this.exe.directory + __New(streamer_path := "", eventcallback := "") { + if (streamer_path!="") { + this.streamer_path := new File(streamer_path) + this.dir := this.streamer_path.directory + } else { + this.streamer_path := this.dir.CombineFile(this.windows.streamer.exe) } + this.connected := this.windows.server.process.exists() + } + + init() { } ensure() { @@ -30,8 +35,8 @@ class VirtualDesktop { } streamer := this.windows.streamer.Process if (!streamer.exists()) { - scriptlog(streamer.name . " not running, starting " . vd.streamer_path.Quote()) - vd.streamer_path.run() + scriptlog(streamer.name . " not running, starting " . this.streamer_path.Quote()) + this.streamer_path.run() } server := this.windows.server.Process if (!server.exists()) { diff --git a/scripts/adb media keys.ahk b/scripts/adb media keys.ahk index 57ff150..73af7e9 100644 --- a/scripts/adb media keys.ahk +++ b/scripts/adb media keys.ahk @@ -1,91 +1,203 @@ +; Hotkeys for media keys +#InstallKeybdHook +#InstallMouseHook +#NoEnv +#SingleInstance force +#Include #include ; https://github.com/Bluscream/ahk-scripts/blob/master/lib/consoleapps.ahk ; Define the ADB path. Adjust the path according to your ADB installation. adb_path := "adb" ; Default behavior for volume keys -HandleVolumeKeys := true +HandleVolumeKeys := false +device_id := "7bb16eeeb8e9c86c7578552408caede5" +global no_ui := true ; Check for command line switches Loop, %0% { Parameter := %A_Index% - if (Parameter = "noVolume") + StringLower, LowerParam, Parameter + if (LowerParam = "--no-volume") { HandleVolumeKeys := false + Break } } +adb_devices := Trim(ComCommand(adb_path . " devices")) +adb_devices := StrReplace(adb_devices, "`r`n" , "") +if (adb_devices == "List of devices attached") { ; \r\n\r\n + result = ConnectAdb() + if (result != "") + scriptlog(result) +} +; If you want to disable media controls controlling PC media at the same time, +; just remove the ~ infront of each hotkey +; This will make it so the PC media keys no longer control the PC media, only android + +~Media_Play_Pause::SendCommand("play-pause") ; Play/Pause +~Media_Stop::SendCommand("stop") ; Stop +~Media_Prev::SendCommand("previous") ; Previous +~Media_Next::SendCommand("next") ; Next +~Volume_Up:: ; Volume Up + if (HandleVolumeKeys) + SendCommand("volume_up") + else + Send, {Volume_Up} + return +~Volume_Down:: ; Volume Down + if (HandleVolumeKeys) + SendCommand("volume_down") + else + Send, {Volume_Down} + return +~Volume_Mute:: ; Mute + if (HandleVolumeKeys) + SendCommand("mute") + else + Send, {Volume_Mute} + return + +return ; Ensure the script keeps running + +SendCommand(command) { + SendADBCommand(MakeAdbCommand(command)) + ; SendHASSCommand(MakeHASSCommand(command)) + return command +} +RunCommand(cmd) { + RunWait % cmd, , Min UseErrorLevel + if (ErrorLevel = "ERROR") { + MsgBox, % "ADB command failed with exitcode " . ExitCode + } +} +ComCommand(cmd) { + ComOBJ := ComObjCreate("WScript.Shell").Exec(cmd) + Response := ComOBJ.StdOut.ReadAll() + if (ComOBJ.ExitCode != 0) { + MsgBox, % "ADB command failed: " . Response + } + return response +} +; region ADB +ConnectAdb() { + global adb_path + InputBox, host , % "ADB", % "Enter ADB ip:port",,,,,,,, % "192.168.2.28:" + cmd := adb_path . " connect " . host + result := ComCommand(cmd) + return result +} ; Function to send ADB command MakeAdbCommand(command) { global adb_path - return adb_path . " shell cmd media_session dispatch " . command + ; scriptlog("got command: " . command) + if (command == "play-pause") { + return adb_path . " shell cmd media_session dispatch play-pause" + } else if (command == "stop") { + return adb_path . " shell cmd media_session dispatch stop" + } else if (command == "previous") { + return adb_path . " shell cmd media_session dispatch previous" + } else if (command == "next") { + return adb_path . " shell cmd media_session dispatch next" + } else if (command == "volume_up") { + return adb_path . " shell cmd media_session volume --show --adj raise" + } else if (command == "volume_down") { + return adb_path . " shell cmd media_session volume --show --adj lower" + }else if (command == "mute") { + return adb_path . " shell cmd media_session dispatch mute" + } } -; SendADBCommand(command) { -; cmd := MakeAdbCommand(command) -; RunWait % cmd, , Min UseErrorLevel -; if (ErrorLevel = "ERROR") { -; MsgBox, % "ADB command failed with exitcode " . ExitCode -; } -; } -; SendADBCommand(command) { -; cmd := MakeAdbCommand(command) -; ComOBJ := ComObjCreate("WScript.Shell").Exec(cmd) -; Response := ComOBJ.StdOut.ReadAll() -; if (ComOBJ.ExitCode != 0) { -; MsgBox, % "ADB command failed: " . Response -; } -; } -SendADBCommand(command) { ; Requires http://www.autohotkey.com/board/topic/96903-simplified-versions-of-seans-stdouttovar/?p=610306 - cmd := MakeAdbCommand(command) +SendADBCommand(cmd) { ; Requires http://www.autohotkey.com/board/topic/96903-simplified-versions-of-seans-stdouttovar/?p=610306 + ; cmd := MakeAdbCommand(cmd) + ; scriptlog("Sending adb command: " . cmd) result := StdOutToVar(cmd) + ; scriptlog("Got adb response: " . result) if (InStr(result, "err") || InStr(result, "fail")) { MsgBox, % "ADB command failed:`n`n" . result } } +; endregion ADB +; region HASS +MakeHASSCommand(command) { + if (command == "play-pause") { + return "media_player/media_play_pause" + } else if (command == "stop") { + return "media_player/media_stop" + } else if (command == "previous") { + return "media_player/media_previous_track" + } else if (command == "next") { + return "media_player/media_next_track" + } else if (command == "volume_up") { + return "media_player/volume_up" + } else if (command == "volume_down") { + return "media_player/volume_down" + }else if (command == "mute") { + return "media_player/volume_mute" + } +} +SendHASSCommand(action) { + global device_id + EnvGet, HASS_SERVER, HASS_SERVER + EnvGet, HASS_TOKEN, HASS_TOKEN + HASS_TOKEN := "Bearer " . HASS_TOKEN -; Hotkeys for media keys -#InstallKeybdHook -#InstallMouseHook -#NoEnv -#SingleInstance force - -; If you want to disable media controls controlling PC media at the same time, -; just remove the ~ infront of each hotkey -; This will make it so the PC media keys no longer control the PC media, only android + url := HASS_SERVER . "/api/services/" . action + ; scriptlog(url) + payload := { "device_id": device_id } + jsonPayload := toJson(payload, false) ; "{""target"": {""device_id"": """ device_id """}}" + ; scriptlog(jsonPayload) -; Play/Pause -~Media_Play_Pause::SendADBCommand("play-pause") + ; scriptlog("Sending hass command: " . jsonPayload) + if (startsWith(url, "https:")) { + ; Set up the HTTP request headers + http := ComObjCreate("MSXML2.XMLHTTP") + http.Open("POST", url, true) + http.setRequestHeader("Authorization", HASS_TOKEN) + http.setRequestHeader("Content-Type", "application/json") -; Stop -~Media_Stop::SendADBCommand("stop") + ; Bypass SSL certificate validation (use with caution) + ; sslSettings := ComObjectCreate("wininet.SecuritySupportFlags") + ; sslSettings.Add(0x00000001) ; SECURITY_FLAG_IGNORE_UNKNOWN_CA + ; sslSettings.Add(0x00000002) ; SECURITY_FLAG_IGNORE_CERT_DATE_INVALID + ; sslSettings.Add(0x00000004) ; SECURITY_FLAG_IGNORE_CERT_CN_OR_SUBJECT_ALT_NAME_MISMATCH + ; sslSettings.Add(0x00000008) ; SECURITY_FLAG_IGNORE_CERT_STATUS_PROBLEM + ; sslSettings.Add(0x00000010) ; SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE + ; DllCall("WinInet.dll", "int", "InternetSetOption", "ptr", headers, "int", 0x0000000C, "uint", 0x00000200, "ptr", sslSettings) -; Previous -~Media_Prev::SendADBCommand("previous") + DllCall("WinInet.dll", "int", "InternetSetOption", "ptr", http, "int", 0x0000000C, "uint", 0x00000200, "ptr", &sslSettings) -; Next -~Media_Next::SendADBCommand("next") + ; Send the request + http.send(jsonPayload) -; Volume Up -~Volume_Up:: -if (HandleVolumeKeys) - SendADBCommand("volume --adj raise") -else - Send, {Volume_Up} -return -; Volume Down -~Volume_Down:: -if (HandleVolumeKeys) - SendADBCommand("volume --adj lower") -else - Send, {Volume_Down} -return -; Mute -~Volume_Mute:: -if (HandleVolumeKeys) - SendADBCommand("mute") -else - Send, {Volume_Mute} -return + ; ; Wait for the response + ; while !headers.readyState || headers.readyState != 4 { + ; Sleep, 100 + ; } -; Ensure the script keeps running -return + ; ; Check the response status + ; if (headers.status == 200) { + ; MsgBox, Notification sent successfully! + ; } else { + ; MsgBox, % "Failed to send notification. Status Code:" . headers.status + ; } + } else { + ; Create a WinHttp.WinHttpRequest.5.1 object + http := ComObjCreate("WinHttp.WinHttpRequest.5.1") + ; Set up the HTTP request + http.Open("POST", url, false) + http.SetRequestHeader("Authorization", HASS_TOKEN) + http.SetRequestHeader("Content-Type", "application/json") + ; Send the request + http.Send(jsonPayload) + ; scriptlog(toJson(http, true)) + ; Wait for the response + ; scriptlog(toJson(http.StatusText(), true)) + ; scriptlog(toJson(http.ResponseText(), true)) + ; While (!http.ResponseText) { + ; Sleep, 100 + ; } + } + ; scriptlog("Got hass response: " . http.StatusText()) +} +; endregion HASS \ No newline at end of file diff --git a/scripts/bbr.ahk b/scripts/bbr.ahk new file mode 100644 index 0000000..02da02f --- /dev/null +++ b/scripts/bbr.ahk @@ -0,0 +1,162 @@ +#NoEnv +#SingleInstance, Force +#Persistent +SendMode, Input +SetBatchLines, -1 +SetWorkingDir, %A_ScriptDir% +; OutputDebug DBGVIEWCLEAR + +#Include +#Include + +global no_ui := false +scriptlog("bbr.ahk::start") + +global net_log_path := "H:\WSCC\Apps\x64\cports.log" +; global net_ref_keys:=["prefix","Added_On","State","Protocol","Local_Address","Local_Port","Local_Port_Name","Remote_Address","Remote_Port","Remote_Port_Name","Remote_Host_Name","Remote_IPCountry","Process_Created_On","Process_ID","Process_Name","Process_Path","Process_Services","Process_Attributes","Window_Title","Product_Name","File_Description","File_Version","Company","Module_Filename","User_Name"] +; ;"%Added_On%";"%State%";"%Protocol%";"%Local_Address%";"%Local_Port%";"%Local_Port_Name%";"%Remote_Address%";"%Remote_Port%";"%Remote_Port_Name%";"%Remote_Host_Name%";"%Remote_IP Country%";"%Process_Created_On%";"%Process_ID%";"%Process_Name%";"%Process_Path%";"%Process_Services%";"%Process_Attributes%";"%Window_Title%";"%Product_Name%";"%File_Description%";"%File_Version%";"%Company%";"%Module_Filename%";"%User_Name%"; +global net_process_name := "BattleBit.exe" + +global log_path := "C:\Users\blusc\AppData\LocalLow\BattleBitDevTeam\BattleBit\Player.log" +global title := "BattleBit Remastered" +global icon := "G:\SteamLibrary\steamapps\common\BattleBit Remastered\IconGroup103.ico" +Menu, Tray, Icon, % icon + +; global last_join_addr := "" + +lt := new LogTailer(log_path, Func("OnNewLine"), true) +lt := new LogTailer(net_log_path, Func("OnNewNetLine"), true) +ShowToast(title, "AutoHotkey", icon, "topleft", 5) +scriptlog("bbr.ahk::end") +return + +Toast(message, _title := "BattleBit Remastered", time_seconds := 10) { + global icon, title + if (_title == "") + _title := title + ShowToast(message, _title, icon, "topleft", time_seconds) + ; ShowToast(message, title := "AutoHotkey", icon_path := "toast.bmp", position := "topleft", time_seconds := 10, bg_color := "#222222") +} + +OnNewNetLine(line) { + global net_process_name + ; Define the reference keys + + ; Split the input string + splitInput := StrSplit(line, ";") + + ProcessName := splitInput[15] + if (ProcessName != net_process_name) + return + + ; AddedOn := splitInput[2] + State := splitInput[3] + if (State != "Established") + return + Protocol := splitInput[4] + if (Protocol != "UDP") + return + ; LocalAddress := splitInput[5] + ; LocalPort := splitInput[6] + ; LocalPortName := splitInput[7] + RemoteAddress := splitInput[8] + RemotePort := splitInput[9] + ; RemotePortName := splitInput[10] + RemoteHostName := splitInput[11] + RemoteIPCountry := splitInput[12] + + scriptlog("New connection to " . RemoteAddress . ":" . RemotePort . " (" . RemoteHostName . " / " . RemoteIPCountry . ")") + Toast(RemoteAddress . ":" . RemotePort, RemoteIPCountry) + + ; ProcessCreated_On := splitInput[13] + ; ProcessID := splitInput[14] + ; ProcessPath := splitInput[16] + ; ProcessServices := splitInput[17] + ; ProcessAttributes := splitInput[18] + ; WindowTitle := splitInput[19] + ; ProductName := splitInput[20] + ; FileDescription := splitInput[21] + ; FileVersion := splitInput[22] + ; Company := splitInput[23] + ; ModuleFilename := splitInput[24] + ; UserName := splitInput[25] + ; prefix := splitInput[1] + ; suffix := splitInput[26] + + ; scriptlog("Prefix: " . prefix) + ; scriptlog("Added On: " . AddedOn) + ; scriptlog("State: " . State) + ; scriptlog("Protocol: " . Protocol) + ; scriptlog("Local Address: " . LocalAddress) + ; scriptlog("Local Port: " . LocalPort) + ; scriptlog("Local Port Name: " . LocalPortName) + ; scriptlog("Remote Address: " . RemoteAddress) + ; scriptlog("Remote Port: " . RemotePort) + ; scriptlog("Remote Port Name: " . RemotePortName) + ; scriptlog("Remote Host Name: " . RemoteHostName) + ; scriptlog("Remote IP Country: " . RemoteIPCountry) + ; scriptlog("Process Created On: " . ProcessCreated_On) + ; scriptlog("Process ID: " . ProcessID) + ; scriptlog("Process Name: " . ProcessName) + ; scriptlog("Process Path: " . ProcessPath) + ; scriptlog("Process Services: " . ProcessServices) + ; scriptlog("Process Attributes: " . ProcessAttributes) + ; scriptlog("Window Title: " . WindowTitle) + ; scriptlog("Product Name: " . ProductName) + ; scriptlog("File Description: " . FileDescription) + ; scriptlog("File Version: " . FileVersion) + ; scriptlog("Company: " . Company) + ; scriptlog("Module Filename: " . ModuleFilename) + ; scriptlog("User Name: " . UserName) + ; scriptlog("Suffix: " . suffix) +} + +OnNewLine(line){ + ; global last_join_addr + + res := CheckLine(line, "Build: (.*)") ; Initialize engine version: (.*) \(.*\)") + if (res.Count() > 0) { + Toast("Started: " . res[1]) + return + } + + res := CheckLine(line, "Received: SlotReserving_ServerFull") + if (res.Count() > 0) { + Toast("Failed to connect", "Server is full") + return + } + + res := CheckLine(line, "Received: SlotReserving_WrongPassword") + if (res.Count() > 0) { + Toast("Failed to connect", "Wrong Password") + return + } + + res := CheckLine(line, "Received: SlotReserving_SlotReserved") + if (res.Count() > 0) { + Toast("Joined Server") + return + } + + res := CheckLine(line, "UserInterface.PauseMenu.PauseMenu:DisconnectFull()") + if (res.Count() > 0) { + Toast("Disconnected") + return + } + + res := CheckLine(line, "Application is closing now !") + if (res.Count() > 0) { + Toast("Exiting") + return + } + +} +CheckLine(inputStr, pattern) { + result := [] + if RegExMatch(inputStr, "O)" . pattern, matches) { + Loop, % matches.Count() { + result.Push(matches.Value(A_Index)) + } + } + return result +} diff --git a/scripts/bloat.ahk b/scripts/bloat.ahk index b85d3a5..9008e73 100644 --- a/scripts/bloat.ahk +++ b/scripts/bloat.ahk @@ -7,7 +7,7 @@ DetectHiddenWindows On global noui := true global bloat := { services: ["ShadowUSB","CCleanerPerformanceOptimizerService","battlenet_helpersvc","AcrSch2Svc","mmsminisrv","aakore","AcronisActiveProtectionService","MSI_Case_Service","MSI_VoiceControl_Service","MSI_Central_Service","ALDITALKVerbindungsassistent_Service","DSAUpdateService","DSAService","LGHUBUpdaterService","GlassWire","MBAMService","FoxitReaderUpdateService","EABackgroundService"] - ,processes: ["ShadowUSB","CCleanerPerformanceOptimizerService","Agent","Battle.net","CCleaner64","adp-agent","aakore","anti_ransomware_service","bt","ShareX","tomcat8","TecnoManager","PowerToys.PowerOCR","msiexec","msedge","GalaxyClient Helper","GalaxyClient","MSI_Central_Service","MSI_Case_Service","MSI.TerminalServer","MSI.CentralServer","CC_Engine_x64","DCv2","DCv2_Startup","MSI Center","browser_assistant","Overwolf","OverwolfBrowser","OverwolfBrowser","OverwolfBrowser","OverwolfHelper","OverwolfHelper64","OverwolfTSHelper","MEGAsync","ALDITALKVerbindungsassistent_Launcher","ALDITALKVerbindungsassistent_Service","DSATray", "CefSharp.BrowserSubprocess","lghub_updater","GlassWire","vsls-agent","webhelper","vrwebhelper","winginx","memcached","mongod","mysqld","redis-server","updatechecker","WindowMenuPlus","WindowMenuPlus64","gamesense-discord-x64","SteelSeriesEngine","SteelSeriesGGClient","SteelSeriesGG","SteelSeriesPrismSync","TECKNET wireless gaming mouse","RaiDrive","CompactGUI","DiskDefrag","TabReports","TabMakePortable","TabCareCenter","Integrator","ActionCenter","AnyDeskMSI","DiscordCanary","GoogleDriveFS","PowerToys.AlwaysOnTop","fdm"] + ,processes: ["ShadowUSB","CCleanerPerformanceOptimizerService","Agent","Battle.net","CCleaner64","adp-agent","aakore","anti_ransomware_service","bt","ShareX","tomcat8","TecnoManager","PowerToys.PowerOCR","msiexec","msedge","GalaxyClient Helper","GalaxyClient","MSI_Central_Service","MSI_Case_Service","MSI.TerminalServer","MSI.CentralServer","CC_Engine_x64","DCv2","DCv2_Startup","MSI Center","browser_assistant","OverwolfTSHelper","MEGAsync","ALDITALKVerbindungsassistent_Launcher","ALDITALKVerbindungsassistent_Service","DSATray", "CefSharp.BrowserSubprocess","lghub_updater","GlassWire","vsls-agent","webhelper","vrwebhelper","winginx","memcached","mongod","mysqld","redis-server","updatechecker","gamesense-discord-x64","SteelSeriesEngine","SteelSeriesGGClient","SteelSeriesGG","SteelSeriesPrismSync","TECKNET wireless gaming mouse","RaiDrive","CompactGUI","DiskDefrag","TabReports","TabMakePortable","TabCareCenter","Integrator","ActionCenter","AnyDeskMSI","DiscordCanary","GoogleDriveFS","PowerToys.AlwaysOnTop","fdm"] ,tasks: ["AuroraStartup","GoogleUpdateTaskMachineCore","GoogleUpdateTaskMachineUA","MicrosoftEdgeUpdateTaskMachineCore","MicrosoftEdgeUpdateTaskMachineUA","OneDrive Per-Machine Standalone Update Task","Onward Custom Map Sync","Paranoid-SafetyNet","\Microsoft\VisualStudio\VSIX Auto Update"] ,custom: [] } @@ -47,12 +47,12 @@ global ahk := { services: [] ,custom: [] } global anticheat := { services: ["PnkBstrA","BEService","EasyAntiCheat_EOS","EasyAntiCheat"] - ,processes: ["PnkBstrA","BEService_bsquad","BEService","EasyAntiCheat","EasyAntiCheat_launc"] + ,processes: ["PnkBstrA","BEService_bsquad","BEService","EasyAntiCheat","EasyAntiCheat_launc","EasyAntiCheat_launcher"] ,tasks: [] ,custom: [] } global important := { services: ["DisplayFusionService","cbdhsvc_14aa56","Adguard Service","BoxToGoRC","DiagTrack","OpenRGB","Everything","EFS","Wallpaper Engine Service"] - ,processes: ["DisplayFusionService","DisplayFusion","DisplayFusionHookApp64","DisplayFusionHookApp32","Everything","java","javaw","NVIDIA RTX Voice","CCUpdate","AdguardSvc","Adguard","EpicWebHelper","EpicGamesLauncher","Twinkle Tray","SuperF4","BoxToGoRCService","RetroBar","OpenRGB","RestartOnCrash","usbdeview","wallpaper64","wallpaper32","webwallpaper32"] + ,processes: ["Overwolf","OverwolfBrowser","OverwolfHelper","OverwolfHelper64","WindowMenuPlus","WindowMenuPlus64","DisplayFusionService","DisplayFusion","DisplayFusionHookApp64","DisplayFusionHookApp32","Everything","java","javaw","NVIDIA RTX Voice","CCUpdate","AdguardSvc","Adguard","EpicWebHelper","EpicGamesLauncher","Twinkle Tray","SuperF4","BoxToGoRCService","RetroBar","OpenRGB","RestartOnCrash","usbdeview","wallpaper64","wallpaper32","webwallpaper32"] ,tasks: [] ,custom: [] } diff --git a/scripts/button_panel.ahk b/scripts/button_panel.ahk index 76493bd..428ae11 100644 --- a/scripts/button_panel.ahk +++ b/scripts/button_panel.ahk @@ -5,6 +5,7 @@ #NoTrayIcon SetTitleMatchMode, 2 SetWorkingDir %A_ScriptDir% +SendMode, InputThenPlay ; Event|Play|Input|InputThenPlay SetBatchLines -1 #Include %A_ScriptDir%\AutoXYWH.ahk @@ -64,7 +65,7 @@ initUI: Gui Add, Button, hWndhBtnStartnnxsoverlay9 vBtnStartnnxsoverlay9 gOnBtnStartXSOClicked x480 y208 w216 h172, % "XSOverlay" - Gui Add, Button, hWndhBtn10 vBtn10 gOnBtn10Clicked x248 y208 w216 h84, % "ChilloutVR" + Gui Add, Button, hWndhBtn10 vBtn10 gOnBtn10Clicked x248 y208 w216 h84, % "ChilloutVR (Switch VR)" Gui Add, Button, hWndhBtnStartVRChat vBtnStartVRChat gOnBtnStartVRChatClicked x248 y296 w216 h84, % "VRChat" Gui Add, Button, hWndhBtn11 vBtn11 gOnBtn11Clicked x712 y208 w216 h172, % "Youtube`n`nMusic" @@ -208,8 +209,17 @@ OnBtnStartRetrobarClicked(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { OnBtn10Clicked(CtrlHwnd, GuiEvent, EventInfo, ErrLevel := "") { ; scriptlog("ChilloutVR") - KillProcesses(["VRCX","VRChat","ChilloutVR","conhost","cmd"]) - Run % """G:\Steam\steamapps\common\ChilloutVR\ChilloutVR.exe"" -vr -skipsteam --disable-videoplayers" + ; KillProcesses(["VRCX","VRChat","ChilloutVR","conhost","cmd"]) + ; Run % """G:\Steam\steamapps\common\ChilloutVR\ChilloutVR.exe"" -vr -skipsteam --disable-videoplayers" + WinActivate, ChilloutVR ahk_class UnityWndClass ahk_exe ChilloutVR.exe ; Activates the ChilloutVR window + if ErrorLevel ; Checks if the window was found and activated successfully + { + MsgBox, Could not find the ChilloutVR window. Please check if the window is open and try again. + return ; Exits the script if the window could not be found + } + Send, ^f6 ; Sends CTRL+F6 + Sleep, 5000 ; Waits for 5 seconds + Send, ^f6 ; Sends CTRL+F6 again GuiClose(0) } diff --git a/scripts/elevenlabs.ahk b/scripts/elevenlabs.ahk new file mode 100644 index 0000000..591816e --- /dev/null +++ b/scripts/elevenlabs.ahk @@ -0,0 +1,43 @@ +#NoEnv +#SingleInstance, Force +#Persistent +#Include +SendMode, Input +SetBatchLines, -1 +SetWorkingDir, %A_ScriptDir% + +global no_ui := false +global isConverting := false ; Initialize the global flag as false + +scriptlog("start") +SetTimer, CheckFiles, 5000 ; Check every 5 seconds +return + +CheckFiles: + global isConverting + if (isConverting) + return + FilePattern := "D:\\Downloads\\ElevenLabs_*.mp3" + Loop, %FilePattern% + { + if (A_LoopFileAttrib ~= "A") ; Check if not converting and the file is ready + { + mp3FilePath := A_LoopFileLongPath + scriptlog("Found File: " . mp3FilePath) + wavFilePath := "C:\\Users\\blusc\\Desktop\\femboy sounds\\" . A_LoopFileName . ".wav" + scriptlog("Converting to: " . wavFilePath) + + isConverting := true ; Set the flag to true indicating a conversion is in progress + ; Convert MP3 to WAV using FFmpeg + RunWait, % ComSpec . " /c ffmpeg -i """ mp3FilePath """ """ wavFilePath """", , Hide + scriptlog("Converted to: " . wavFilePath) + + ; Delete the original MP3 file + FileDelete, % mp3FilePath + scriptlog("Deleted: " . mp3FilePath) + } + } + isConverting := false ; Reset the flag after conversion is done + return + +scriptlog("end") \ No newline at end of file diff --git a/scripts/emoji_regional_speak.ahk b/scripts/emoji_regional_speak.ahk index 7c3dfc4..d7f6383 100644 --- a/scripts/emoji_regional_speak.ahk +++ b/scripts/emoji_regional_speak.ahk @@ -1,6 +1,5 @@ #SingleInstance Force #NoEnv -#NoTrayIcon #Persistent SetWorkingDir %A_ScriptDir% Process Priority,, Low @@ -50,19 +49,19 @@ Process Priority,, Low ::!::❕ ::?::❔ -; ::ab::🆎 -; ::cl::🆑 -; ::sos::🆘 -; ::wc::🚾 -; ::atm::🏧 -; ::100::💯 -; ::abc::🔤 -; ::abcd::🔠 -; ::ng::🆖 -; ::ok::🆗 -; ::up::🆙 -; ::cool::🆒 -; ::new::🆕 -; ::free::🆓 -; ::id::🆔 -; ::vs::🆚 \ No newline at end of file +::ab::🆎 +::cl::🆑 +::sos::🆘 +::wc::🚾 +::atm::🏧 +::100::💯 +::abc::🔤 +::abcd::🔠 +::ng::🆖 +::ok::🆗 +::up::🆙 +::cool::🆒 +::new::🆕 +::free::🆓 +::id::🆔 +::vs::🆚 \ No newline at end of file diff --git a/scripts/hotkeys.ahk b/scripts/hotkeys.ahk index 037dfeb..393de2a 100644 --- a/scripts/hotkeys.ahk +++ b/scripts/hotkeys.ahk @@ -14,21 +14,7 @@ global bspid := 0 global no_ui := true global debug := false -global available_hotkeys := { "Win + H": "List Available Hotkeys" -, "(Shift) + Win + C": "Run cmd (as admin)" -, "(Shift) + Win + P": "Run powershell (as admin)" -, "(Shift) + Win + T": "Run Windows Terminal (as admin)" -, "(Shift) + Win + E": "Run explorer (as admin)" -, "Ctrl + Shift + Esc": "Run taskmgr" -, "Alt + Control + Shift + T": "Toggle Taskbar" -, "Win + X": "Run Quick Start Panel" -, "Shift + Win + N": "Run Numpad" -, "Ctrl + B": "Run copywrite.py" -, "Ctrl + Shift + V": "Run copywrite.py" -, "Ctrl + Alt + V": "Run split_clipboard.py" -, "Steam Button": "Run Steam Big Picture" -, "Steam Button + LB": "Restart Virtual Desktop" -, "Steam Button + RB": "Run Virtual Desktop"} +global available_hotkeys := { "Win + H": "List Available Hotkeys", "(Shift) + Win + C": "Run cmd (as admin)", "(Shift) + Win + P": "Run powershell (as admin)", "(Shift) + Win + T": "Run Windows Terminal (as admin)", "(Shift) + Win + E": "Run explorer (as admin)", "Ctrl + Shift + Esc": "Run taskmgr", "Alt + Control + Shift + T": "Toggle Taskbar", "Win + X": "Run Quick Start Panel", "Shift + Win + N": "Run Numpad", "Ctrl + B": "Run copywrite.py", "Ctrl + Shift + V": "Run copywrite.py", "Ctrl + Alt + V": "Run split_clipboard.py", "Steam Button": "Run Steam Big Picture", "Steam Button + LB": "Restart Virtual Desktop", "Steam Button + RB": "Run Virtual Desktop"} return @@ -54,11 +40,12 @@ showHotKeys() { ; > = This prefix character causes the hotkey to be triggered even if the user is holding down one or more modifier keys (Ctrl, Alt, Shift, and Win) at the time the hotkey is pressed. This prefix character is equivalent to specifying {Blind} for this hotkey. ; < = This prefix character causes the hotkey to be triggered by the left-hand version of the key only. This is usually only necessary for keys whose right-hand version might have a different effect such as the NumPad keys. This prefix character is equivalent to specifying {LAlt} for this hotkey. +; ~LWin:: Run "C:\Program Files\Open-Shell\StartMenu.exe" -toggle ; Win <#h::showHotKeys() ; Win + H +#h::Window.fromTop().hide(true) ; Shift + Win + H ; Force hide current window <#c::Run cmd ; Win + C +#c::ShellRun("cmd") ; Shift + Win + C -<#p::Run powershell ; Win + P +<#p::Run pwsh ; powershell ; Win + P +#p::ShellRun("powershell") ; Shift + Win + P <#t::Run shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App ; Win + T +#t::ShellRun("shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App") ; Shift + Win + T @@ -66,11 +53,13 @@ showHotKeys() { +#e::ShellRun("explorer") ; Shift + Win + E ; <#r::Run explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0} ^+Esc::Run taskmgr ; Ctrl + Shift + Esc -!^+t:: HideTaskbar(hide := !hide) ; Alt + Control + Shift + T +!^+t::HideTaskbar(hide := !hide) ; Alt + Control + Shift + T +^Space::ShowPowerLauncher() +#Space::ShowPowerLauncher() <#x:: ; Win + X ; IfWinExist, Quick Start Panel ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exe ; { - ; WinActivate, Quick Start Panel ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exe + ; WinActivate, Quick Start Panel ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exesssasd ; } IfWinNotExist, Quick Start Panel ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exe { @@ -149,12 +138,6 @@ showHotKeys() { ; else ; Send {Media_Next} ; return -; isExplorerRunning() { -; return new Process("explorer.exe").exists() -; } -; isOBSRunning() { -; return new Process("obs64.exe").exists() -; } ; CheckVivecraftInstaller: ; SetTimer, CheckVivecraftInstaller, Off @@ -181,4 +164,19 @@ showHotKeys() { ; ControlSetText, Edit1, % dir, % winstr2 ; } ; SetTimer, CheckEasyFileLocker, 2500 - ; return \ No newline at end of file + ; return + +return +; isExplorerRunning() { +; return new Process("explorer.exe").exists() +; } +; isOBSRunning() { +; return new Process("obs64.exe").exists() +; } +ShowPowerLauncher() { + Run % "C:\Program Files\PowerToys\PowerToys.PowerLauncher.exe" + ; WinWait, PowerToys.PowerLauncher ahk_exe PowerToys.PowerLauncher + Sleep, 50 + WinRestore, PowerToys.PowerLauncher ahk_exe PowerToys.PowerLauncher + WinActivate, PowerToys.PowerLauncher ahk_exe PowerToys.PowerLauncher +} \ No newline at end of file diff --git a/scripts/htopmini.ahk b/scripts/htopmini.ahk new file mode 100644 index 0000000..9e620a6 --- /dev/null +++ b/scripts/htopmini.ahk @@ -0,0 +1,536 @@ +; http://www.auto-hotkey.com/boards/viewtopic.php?f=6&t=254 +; http://weather.yahooapis.com/forecastrss?w=2455920&u=f + +; =================================================================================== +; AHK Version ...: AHK_L 1.1.15.00 x64 Unicode +; Win Version ...: Windows 7 Professional x64 SP1 +; Description ...: htopmini +; Version .......: v0.8.3 +; Modified ......: 2014.04.11-2027 +; Author ........: jNizM +; Licence .......: WTFPL (http://www.wtfpl.net/txt/copying/) +; =================================================================================== +;@Ahk2Exe-SetName htopmini +;@Ahk2Exe-SetDescription htopmini +;@Ahk2Exe-SetVersion v0.8.3 +;@Ahk2Exe-SetCopyright Copyright (c) 2013-2014`, jNizM +;@Ahk2Exe-SetOrigFilename htopmini.ahk +; =================================================================================== + + +; ################################################################################### +; ### GLOBAL SETTINGS ### +; ################################################################################### + +;#Warn +#NoEnv +#SingleInstance Force +SetBatchLines -1 + +global WinTitel := "htopmini " A_Now +global Today := A_DD "." A_MM "." A_YYYY +global OldFormat := A_FormatInteger +global varPerc := 0 +global Weather_ID := "2455920" ; Yahoo Weather Location ID +global Weather_DG := "f" ; Celius = c | Fahrenheit = f +global ownPID := DllCall("Kernel32.dll\GetCurrentProcessId") +global BuildVersion := DllCall("Kernel32.dll\GetVersion") >> 16 & 0xffff + + +; ################################################################################### +; ### MENU ### +; ################################################################################### + +Menu, Tray, DeleteAll +Menu, Tray, NoStandard +Menu, Tray, Add, Toggle Percentage, Menu_Percentage +Menu, Tray, Add, +Menu, Tray, Add, Reset Transparency, Menu_Transparency +Menu, Tray, Add, Toggle AlwaysOnTop, Menu_AlwaysOnTop +Menu, Tray, Add, Show/Hide, Menu_ShowHide +Menu, Tray, Add, +Menu, Tray, Add, Exit, Close +Menu, Tray, Default, Show/Hide + + +; ################################################################################### +; ### GUI MAIN ### +; ################################################################################### + +MakeGui: +Gui +LastFound -Caption +ToolWindow +hwndhMain +Gui, Margin, 10, 10 +Gui, Color, 000000 +Gui, Font, cFFFFFF, Consolas +Gui, Add, Text, xm ym w250 vTime01 +Gui, Add, Text, xm+260 ym w170 0x202 vTemp01, +Gui, Add, Text, xm y+2 w430 h1 0x7 + +Gui, Font, cFFFFFF, +Gui, Add, Text, xm y+4 w30 0x200, CPU: +Gui, Font, c00FF00, +Gui, Add, Text, xm+40 yp w80 0x202 vCPU1, +Gui, Add, Text, xm+140 yp w80 0x202 vCPU2, +Gui, Add, Progress, xm+250 yp+1 w180 h10 BackgroundF0F0F0 vCPU3, +Gui, Add, Text, xm y+3 w430 h1 0x7 + +Gui, Font, cFFFFFF, +Gui, Add, Text, xm y+3 w30 0x200, Mem: +Gui, Font, c00FF00, +Gui, Add, Text, xm+40 yp w80 0x202 vMEM01, +Gui, Font, cFFFFFF, +Gui, Add, Text, xm+140 yp w80 0x202 vMEM02, +Gui, Add, Progress, xm+250 yp+1 w180 h10 BackgroundF0F0F0 vMEM03, +Gui, Font, c000000 s7, +Gui, Add, Text, xm+250 yp w180 h11 0x202 +BackgroundTrans vMEM04, + +Gui, Font, cFFFFFF s8, +Gui, Add, Text, xm y+3 w30 0x200, Swp: +Gui, Font, c00FF00, +Gui, Add, Text, xm+40 yp w80 0x202 vSWP01, +Gui, Font, cFFFFFF, +Gui, Add, Text, xm+140 yp w80 0x202 vSWP02, +Gui, Add, Progress, xm+250 yp+1 w180 h10 BackgroundF0F0F0 vSWP03, +Gui, Font, c000000 s7, +Gui, Add, Text, xm+250 yp w180 h11 0x202 +BackgroundTrans vSWP04, +Gui, Font, cFFFFFF s8, +Gui, Add, Text, xm y+3 w430 h1 0x7 + +DriveGet, DrvLstFxd, List, FIXED +loop, Parse, DrvLstFxd +{ + Gui, Font, cFFFFFF, + Gui, Add, Text, xm y+1 w30 0x200 gDriveClick, F_%A_Loopfield%:\ + Gui, Font, c00FF00, + Gui, Add, Text, xm+40 yp w80 0x202 vD%A_Loopfield%1, + Gui, Font, cFFFFFF, + Gui, Add, Text, xm+140 yp w80 0x202 vD%A_Loopfield%2, + Gui, Add, Progress, xm+250 yp+1 w180 h10 vD%A_Loopfield%3, + Gui, Font, c000000 s7, + Gui, Add, Text, xm+250 yp w180 h11 0x202 +BackgroundTrans vD%A_Loopfield%4, + Gui, Font, cFFFFFF s8, +} +DriveGet, DrvLstRmvbl, List, REMOVABLE +loop, Parse, DrvLstRmvbl +{ + Gui, Font, cFFFFFF, + Gui, Add, Text, xm y+1 w30 0x200 gDriveClick, R_%A_Loopfield%:\ + Gui, Font, c00FF00, + Gui, Add, Text, xm+40 yp w80 0x202 vD%A_Loopfield%1, + Gui, Font, cFFFFFF, + Gui, Add, Text, xm+140 yp w80 0x202 vD%A_Loopfield%2, + Gui, Add, Progress, xm+250 yp+1 w180 h10 vD%A_Loopfield%3, + Gui, Font, c000000 s7, + Gui, Add, Text, xm+250 yp w180 h11 0x202 +BackgroundTrans vD%A_Loopfield%4, + Gui, Font, cFFFFFF s8, +} +DriveGet, DrvLstNtwrk, List, NETWORK +loop, Parse, DrvLstNtwrk +{ + Gui, Font, cFFFFFF, + Gui, Add, Text, xm y+1 w30 0x200 gDriveClick, N_%A_Loopfield%:\ + Gui, Font, c00FF00, + Gui, Add, Text, xm+40 yp w80 0x202 vD%A_Loopfield%1, + Gui, Font, cFFFFFF, + Gui, Add, Text, xm+140 yp w80 0x202 vD%A_Loopfield%2, + Gui, Add, Progress, xm+250 yp+1 w180 h10 vD%A_Loopfield%3, + Gui, Font, c000000 s7, + Gui, Add, Text, xm+250 yp w180 h11 0x202 +BackgroundTrans vD%A_Loopfield%4, + Gui, Font, cFFFFFF s8, +} +Gui, Add, Text, xm y+3 w430 h1 0x7 + +Gui, Font, cFFFFFF, +Gui, Add, Text, xm y+1 w30 0x200, IN/OUT: +Gui, Font, c00FF00, +Gui, Add, Text, xm+40 yp w80 0x202 vIN1, +Gui, Font, cFF0000, +Gui, Add, Text, xm+140 yp w80 0x202 vOU1, +Gui, Add, Text, xm y+3 w430 h1 0x7 + +Gui, Font, cFFFFFF, +Gui, Add, Text, xm y+10 w150 0x200 vOwnMem, +Gui, Add, Button, xm+240 yp-6 w60 h20 -Theme 0x8000 gClear, Clear +Gui, Add, Button, xm+305 yp w60 h20 -Theme 0x8000 gMinimi, Minimize +Gui, Add, Button, xm+370 yp w60 h20 -Theme 0x8000 gClose, Close +Gui, Show, % "AutoSize" (htopx ? " x" htopx " y" htopy : ""), % WinTitel +WinSet, Transparent, 170, % WinTitel + +SetTimer, UpdateTime, 1000 +SetTimer, UpdateWeather, -1000 +SetTimer, UpdateCPULoad, -1000 +SetTimer, UpdateMemory, -1000 +SetTimer, UpdateTraffic, 1000 +SetTimer, UpdateDrive, -1000 +SetTimer, UpdateMemHtop, -1000 + +OnMessage(0x201, "WM_LBUTTONDOWN") +OnMessage(0x219, "WM_DEVICECHANGE") + +return + + +; ################################################################################### +; ### SCRIPT ### +; ################################################################################### + +UpdateTime: + GuiControl,, Time01, % Today " " A_Hour ":" A_Min ":" A_Sec " | Up: " GetDurationFormat(A_TickCount / 1000) +return + +UpdateWeather: + url := DownloadToString("http://weather.yahooapis.com/forecastrss?w=" Weather_ID "&u=" Weather_DG) + RegExMatch(url, "(?<=Weather for )(.*)(?=\<\/description\>\s\)", varCity) + RegExMatch(url, "(?<=temp="")(.*)(?="" date)", varTemp) + RegExMatch(url, "(?<=temperature="")(.*)(?=""\s*distance)", varUnits) + GuiControl,, Temp01, % varCity " | " varTemp " °" varUnits + SetTimer, UpdateWeather, 60000 +return + +UpdateCPULoad: + GuiControl,, CPU1, % GetProcessCount() " proc" + CPU := CPULoad() + GuiControl,, CPU2, % CPU " % " + GuiControl, % ((CPU <= "50") ? "+c00FF00" : ((CPU <= "80") ? "+cFFA500" : "+cFF0000")), CPU3 + GuiControl,, CPU3, % CPU + SetTimer, UpdateCPULoad, 1000 +return + +UpdateMemory: + GMSEx := GlobalMemoryStatusEx() + GMSExM01 := Round(GMSEx[2] / 1024**2, 2) ; Total Physical Memory in MB + GMSExM02 := Round(GMSEx[3] / 1024**2, 2) ; Available Physical Memory in MB + GMSExM03 := Round(GMSExM01 - GMSExM02, 2) ; Used Physical Memory in MB + GMSExM04 := Round(GMSExM03 / GMSExM01 * 100, 2) ; Used Physical Memory in % + GMSExS01 := Round(GMSEx[4] / 1024**2, 2) ; Total PageFile in MB + GMSExS02 := Round(GMSEx[5] / 1024**2, 2) ; Available PageFile in MB + GMSExS03 := Round(GMSExS01 - GMSExS02, 2) ; Used PageFile in MB + GMSExS04 := Round(GMSExS03 / GMSExS01 * 100, 2) ; Used PageFile in % + + GuiControl,, MEM01, % GMSExM03 " MB" + GuiControl,, MEM02, % GMSExM01 " MB" + GuiControl, % (GMSExM04 <= "75") ? "+c00FF00" : (GMSExM04 <= "90") ? "+cFFA500" : "+cFF0000", MEM03 + GuiControl,, MEM03, % GMSExM04 + GuiControl,, MEM04, % (varPerc = "1") ? GMSExM04 " % " : "" + + GuiControl,, SWP01, % GMSExS03 " MB" + GuiControl,, SWP02, % GMSExS01 " MB" + GuiControl, % (GMSExS04 <= "75") ? "+c00FF00" : (GMSExS04 <= "90") ? "+cFFA500" : "+cFF0000", SWP03 + GuiControl,, SWP03, % GMSExS04 + GuiControl,, SWP04, % (varPerc = "1") ? GMSExS04 " % " : "" + + SetTimer, UpdateMemory, 2000 +return + +UpdateDrive: + loop, Parse, DrvLstFxd + { + i := A_LoopField + DriveGet, cap%i%, Capacity, %i%:\ + DriveSpaceFree, free%i%, %i%:\ + used%i% := cap%i% - free%i% + perc%i% := used%i% / cap%i% * 100 + GuiControl,, D%i%1, % Round(used%i% / 1024, 2) " GB" + GuiControl,, D%i%2, % Round(cap%i% / 1024, 2) " GB" + GuiControl, % "+Range0-" cap%i%, D%i%3 + GuiControl, % (perc%i% <= "80") ? "+c00FF00" : (perc%i% <= "90") ? "+cFFA500" : "+cFF0000", D%i%3 + GuiControl,, D%i%3, % used%i% + GuiControl,, D%i%4, % (varPerc = "1") ? Round(perc%i%, 2) " % " : "" + } + loop, Parse, DrvLstRmvbl + { + j := A_LoopField + DriveGet, cap%j%, Capacity, %j%:\ + DriveSpaceFree, free%j%, %j%:\ + used%j% := cap%j% - free%j% + perc%j% := used%j% / cap%j% * 100 + GuiControl,, D%j%1, % Round(used%j% / 1024, 2) " GB" + GuiControl,, D%j%2, % Round(cap%j% / 1024, 2) " GB" + GuiControl, % "+Range0-" cap%j%, D%j%3 + GuiControl, % (perc%j% <= "80") ? "+c00FF00" : (perc%j% <= "90") ? "+cFFA500" : "+cFF0000", D%j%3 + GuiControl,, D%j%3, % used%j% + GuiControl,, D%j%4, % (varPerc = "1") ? Round(perc%j%, 2) " % " : "" + } + loop, Parse, DrvLstNtwrk + { + k := A_LoopField + DriveGet, cap%k%, Capacity, %k%:\ + DriveSpaceFree, free%k%, %k%:\ + used%k% := cap%k% - free%k% + perc%k% := used%k% / cap%k% * 100 + GuiControl,, D%k%1, % Round(used%k% / 1024, 2) " GB" + GuiControl,, D%k%2, % Round(cap%k% / 1024, 2) " GB" + GuiControl, % "+Range0-" cap%k%, D%k%3 + GuiControl, % (perc%k% <= "80") ? "+c00FF00" : (perc%k% <= "90") ? "+cFFA500" : "+cFF0000", D%k%3 + GuiControl,, D%k%3, % used%k% + GuiControl,, D%k%4, % (varPerc = "1") ? Round(perc%k%, 2) " % " : "" + } + SetTimer, UpdateDrive, 5000 +return + +UpdateTraffic: + dnNew := 0 + upNew := 0 + GetIfTable(tb) + loop, % DecodeInteger(&tb) + { + dnNew += DecodeInteger(&tb + 4 + 860 * (A_Index - 1) + 552) + upNew += DecodeInteger(&tb + 4 + 860 * (A_Index - 1) + 576) + } + dnRate := Round((dnNew - dnOld) / 1024) + upRate := Round((upNew - upOld) / 1024) + GuiControl,, In1, % dnRate " kb/s" + GuiControl,, Ou1, % upRate " kb/s" + dnOld := dnNew + upOld := upNew +return + +UpdateMemHtop: + if (BuildVersion >= "7600") + { + GPMI := GetProcessMemoryInfo_PMCEX(ownPID) + PUsage := Round(GPMI[10] / 1024, 0) + } + else + { + GPMI := GetProcessMemoryInfo_PMC(ownPID) + PUsage := Round(GPMI[8] / 1024, 0) + } + GuiControl,, OwnMem, % "PID: " ownPID " | " PUsage " K" + SetTimer, UpdateMemHtop, 2000 +return + +DriveClick: + Run, % SubStr(A_GuiControl, 3) +Return + +Clear: + ClearMemory() + FreeMemory() +return + +Minimi: + Gui, Hide +return + +Menu_Percentage: + varPerc := (varPerc = "0") ? "1" : "0" + Menu, Tray, ToggleCheck, Toggle Percentage +return + +Menu_Transparency: + WinSet, Transparent, 170, % name +return + +Menu_AlwaysOnTop: + WinSet, AlwaysOnTop, Toggle, %WinTitel% + Menu, Tray, ToggleCheck, Toggle AlwaysOnTop +return + +Menu_ShowHide: + WinGet, winStyle, Style, %WinTitel% + if (winStyle & 0x10000000) + { + WinHide, %WinTitel% + } + else + { + WinShow, %WinTitel% + WinSet, AlwaysOnTop, Toggle, %WinTitel% + WinSet, AlwaysOnTop, Toggle, %WinTitel% + } +return + +^WheelUp::GUITrans(1) +^WheelDown::GUITrans(0) + + +; ################################################################################### +; ### FUNCTIONS ### +; ################################################################################### + +WM_LBUTTONDOWN(wParam, lParam, msg, hwnd) +{ + global hMain + if (hwnd = hMain) + { + PostMessage, 0xA1, 2,,, % WinTitel + } +} + +WM_DEVICECHANGE(wParam, lParam, msg, hwnd) +{ + global hmain, htopx, htopy + if (wParam = 0x8000 || wParam = 0x8004) + { + Thread, NoTimers + WinGetPos, htopx, htopy,,, ahk_id %hmain% + Gui, Destroy + Gosub, MakeGui + } +} + +; GUITrans ========================================================================== +GUITrans(b := 1) +{ + WinGet, ct, Transparent, % WinTitel + WinSet, Transparent, % ((b = 1) ? ct + 1 : ct - 1), % WinTitel +} + +; DownloadToString ================================================================== +DownloadToString(url, encoding := "utf-8") +{ + static a := "AutoHotkey/" A_AhkVersion + if (!DllCall("LoadLibrary", "Str", "wininet") || !(h := DllCall("wininet\InternetOpen", "Str", a, "UInt", 1, "Ptr", 0, "Ptr", 0, "UInt", 0, "Ptr"))) + { + return 0 + } + c := s := 0, o := "" + if (f := DllCall("wininet\InternetOpenUrl", "Ptr", h, "Str", url, "Ptr", 0, "UInt", 0, "UInt", 0x80003000, "Ptr", 0, "Ptr")) + { + while (DllCall("wininet\InternetQueryDataAvailable", "Ptr", f, "UInt*", s, "UInt", 0, "Ptr", 0) && s > 0) + { + VarSetCapacity(b, s, 0) + DllCall("wininet\InternetReadFile", "Ptr", f, "Ptr", &b, "UInt", s, "UInt*", r) + o .= StrGet(&b, r >> (encoding = "utf-16" || encoding = "cp1200"), encoding) + } + DllCall("wininet\InternetCloseHandle", "Ptr", f) + } + DllCall("wininet\InternetCloseHandle", "Ptr", h) + return o +} + +; ProcessCount ====================================================================== +GetProcessCount() +{ + proc := "" + for process in ComObjGet("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_Process") + { + proc++ + } + return proc +} + +; CPULoad =========================================================================== +CPULoad() +{ + static PIT, PKT, PUT + if (Pit = "") + { + return 0, DllCall("GetSystemTimes", "Int64P", PIT, "Int64P", PKT, "Int64P", PUT) + } + DllCall("GetSystemTimes", "Int64P", CIT, "Int64P", CKT, "Int64P", CUT) + IdleTime := PIT - CIT, KernelTime := PKT - CKT, UserTime := PUT - CUT + SystemTime := KernelTime + UserTime + return ((SystemTime - IdleTime) * 100) // SystemTime, PIT := CIT, PKT := CKT, PUT := CUT +} + +; GlobalMemoryStatus ================================================================ +GlobalMemoryStatusEx() +{ + static MEMORYSTATUSEX, init := VarSetCapacity(MEMORYSTATUSEX, 64, 0) && NumPut(64, MEMORYSTATUSEX, "UInt") + if (DllCall("Kernel32.dll\GlobalMemoryStatusEx", "Ptr", &MEMORYSTATUSEX)) + { + return { 2 : NumGet(MEMORYSTATUSEX, 8, "UInt64") + , 3 : NumGet(MEMORYSTATUSEX, 16, "UInt64") + , 4 : NumGet(MEMORYSTATUSEX, 24, "UInt64") + , 5 : NumGet(MEMORYSTATUSEX, 32, "UInt64") } + } +} + +; GetProcessMemoryInfo ============================================================== +GetProcessMemoryInfo_PMCEX(PID) +{ + pu := "" + hProcess := DllCall("Kernel32.dll\OpenProcess", "UInt", 0x001F0FFF, "UInt", 0, "UInt", PID) + if (hProcess) + { + static PMCEX, size := (A_PtrSize = 8 ? 80 : 44), init := VarSetCapacity(PMCEX, size, 0) && NumPut(size, PMCEX) + if (DllCall("Kernel32.dll\K32GetProcessMemoryInfo", "Ptr", hProcess, "UInt", &PMCEX, "UInt", size)) + { + pu := { 10 : NumGet(PMCEX, (A_PtrSize = 8 ? 72 : 40), "Ptr") } + } + DllCall("Kernel32.dll\CloseHandle", "Ptr", hProcess) + } + return pu +} +GetProcessMemoryInfo_PMC(PID) +{ + pu := "" + hProcess := DllCall("Kernel32.dll\OpenProcess", "UInt", 0x001F0FFF, "UInt", 0, "UInt", PID) + if (hProcess) + { + static PMC, size := (A_PtrSize = 8 ? 72 : 40), init := VarSetCapacity(PMC, size, 0) && NumPut(size, PMC) + if (DllCall("psapi.dll\GetProcessMemoryInfo", "Ptr", hProcess, "UInt", &PMC, "UInt", size)) + { + pu := { 8 : NumGet(PMC, (A_PtrSize = 8 ? 56 : 32), "Ptr") } + } + DllCall("Kernel32.dll\CloseHandle", "Ptr", hProcess) + } + return pu +} + +; secsToStr ========================================================================= +GetDurationFormat(ullDuration, lpFormat := "d'd 'hh:mm:ss") +{ + VarSetCapacity(lpDurationStr, 128, 0) + DllCall("Kernel32.dll\GetDurationFormat", "UInt", 0x400 + , "UInt", 0 + , "Ptr", 0 + , "Int64", ullDuration * 10000000 + , "WStr", lpFormat + , "WStr", lpDurationStr + , "Int", 64) + return lpDurationStr +} + +; NetTraffic ======================================================================== +GetIfTable(ByRef tb, bOrder = True) +{ + nSize := 4 + 860 * GetNumberOfInterfaces() + 8 + VarSetCapacity(tb, nSize) + return DllCall("Iphlpapi.dll\GetIfTable", "UInt", &tb, "UInt*", nSize, "UInt", bOrder) +} +GetIfEntry(ByRef tb, idx) +{ + VarSetCapacity(tb, 860) + DllCall("ntdll\RtlFillMemoryUlong", "Ptr", &tb + 512, "Ptr", 4, "UInt", idx) + return DllCall("Iphlpapi.dll\GetIfEntry", "UInt", &tb) +} +GetNumberOfInterfaces() +{ + DllCall("Iphlpapi.dll\GetNumberOfInterfaces", "UInt*", nIf) + return nIf +} +DecodeInteger(ptr) +{ + return *ptr | *++ptr << 8 | *++ptr << 16 | *++ptr << 24 +} + +; ClearMemory ======================================================================= +ClearMemory() +{ + for process in ComObjGet("winmgmts:\\.\root\CIMV2").ExecQuery("SELECT * FROM Win32_Process") + { + handle := DllCall("Kernel32.dll\OpenProcess", "UInt", 0x001F0FFF, "Int", 0, "Int", process.ProcessID) + DllCall("Kernel32.dll\SetProcessWorkingSetSize", "UInt", handle, "Int", -1, "Int", -1) + DllCall("Psapi.dll\EmptyWorkingSet", "UInt", handle) + DllCall("Kernel32.dll\CloseHandle", "Int", handle) + } + return +} +FreeMemory() +{ + return DllCall("Psapi.dll\EmptyWorkingSet", "UInt", -1) +} + + +; ################################################################################### +; ### EXIT ### +; ################################################################################### + +Close: +GuiClose: +GuiEscape: + ExitApp + diff --git a/scripts/htopmini2.ahk b/scripts/htopmini2.ahk new file mode 100644 index 0000000..c28f7ca --- /dev/null +++ b/scripts/htopmini2.ahk @@ -0,0 +1,68 @@ +#singleinstance force + +Gui, Add, ListView, x2 y0 w400 h500, Name|PID|CPU +for process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process") + LV_Add("", process.Name, process.processId,"...") +Gui, Show,, Process List + +SetTimer, UpdateCpuUsage +Return + +UpdateCpuUsage: + Loop % LV_GetCount() { + LV_GetText(pid, A_Index, 2) + cpuUsage := Round(GetProcessTimes(pid)) "%" + LV_Modify(A_Index, "Col3", cpuUsage) + } +Return +GetCpuLoad(period := 500) { + total := GetSystemTimes(idle) + Sleep, % period + total2 := GetSystemTimes(idle2) + Return 100*(1 - (idle2 - idle)/(total2 - total)) + } + + GetSystemTimes(ByRef IdleTime) { + DllCall("GetSystemTimes", "Int64P", IdleTime, "Int64P", KernelTime, "Int64P", UserTime) + Return KernelTime + UserTime + } +; Return values +; -1 on first run +; -2 if process doesn't exist or you don't have access to it +; Process cpu usage as percent of total CPU +GetProcessTimes(PID) +{ + static aPIDs := [] + ; If called too frequently, will get mostly 0%, so it's better to just return the previous usage + if aPIDs.HasKey(PID) && A_TickCount - aPIDs[PID, "tickPrior"] < 250 + return aPIDs[PID, "usagePrior"] + + DllCall("GetSystemTimes", "Int64*", lpIdleTimeSystem, "Int64*", lpKernelTimeSystem, "Int64*", lpUserTimeSystem) + if !hProc := DllCall("OpenProcess", "UInt", 0x400, "Int", 0, "Ptr", pid) + return -2, aPIDs.HasKey(PID) ? aPIDs.Remove(PID, "") : "" ; Process doesn't exist anymore or don't have access to it. + DllCall("GetProcessTimes", "Ptr", hProc, "Int64*", lpCreationTime, "Int64*", lpExitTime, "Int64*", lpKernelTimeProcess, "Int64*", lpUserTimeProcess) + DllCall("CloseHandle", "Ptr", hProc) + + if aPIDs.HasKey(PID) ; check if previously run + { + ; find the total system run time delta between the two calls + systemKernelDelta := lpKernelTimeSystem - aPIDs[PID, "lpKernelTimeSystem"] ;lpKernelTimeSystemOld + systemUserDelta := lpUserTimeSystem - aPIDs[PID, "lpUserTimeSystem"] ; lpUserTimeSystemOld + ; get the total process run time delta between the two calls + procKernalDelta := lpKernelTimeProcess - aPIDs[PID, "lpKernelTimeProcess"] ; lpKernelTimeProcessOld + procUserDelta := lpUserTimeProcess - aPIDs[PID, "lpUserTimeProcess"] ;lpUserTimeProcessOld + ; sum the kernal + user time + totalSystem := systemKernelDelta + systemUserDelta + totalProcess := procKernalDelta + procUserDelta + ; The result is simply the process delta run time as a percent of system delta run time + result := 100 * totalProcess / totalSystem + } + else result := -1 + + aPIDs[PID, "lpKernelTimeSystem"] := lpKernelTimeSystem + aPIDs[PID, "lpUserTimeSystem"] := lpUserTimeSystem + aPIDs[PID, "lpKernelTimeProcess"] := lpKernelTimeProcess + aPIDs[PID, "lpUserTimeProcess"] := lpUserTimeProcess + aPIDs[PID, "tickPrior"] := A_TickCount + return aPIDs[PID, "usagePrior"] := result +} \ No newline at end of file diff --git a/scripts/iw_color_preview.ahk b/scripts/iw_color_preview.ahk index 949794a..396c2e3 100644 --- a/scripts/iw_color_preview.ahk +++ b/scripts/iw_color_preview.ahk @@ -114,7 +114,7 @@ SetFields(a) { GuiControl,,txt_hexa, % color.hexa ; Gui Add, Edit, hWndhEdtValue8 vtxt_hexrgba gOnTxtEdited x104 y168 w120 h21 -VScroll GuiControl,,txt_hexrgba, % color.hexrgba - GuiControl, Color, img_color, % color.hexrgba + GuiControl,, img_color, % color.hexrgba ; Color editing := false } diff --git a/scripts/ohd.ahk b/scripts/ohd.ahk new file mode 100644 index 0000000..501d197 --- /dev/null +++ b/scripts/ohd.ahk @@ -0,0 +1,80 @@ +#NoEnv +#SingleInstance, Force +#Persistent +SendMode, Input +SetBatchLines, -1 +SetWorkingDir, %A_ScriptDir% +; OutputDebug DBGVIEWCLEAR + +#Include +#Include + +global no_ui := false +scriptlog("ohd.ahk::start") + +global log_path := "C:\Users\blusc\AppData\Local\HarshDoorstop\Saved\Logs\HarshDoorstop.log" ; D:\Documents\My Mods\SpecialK\Profiles\Operation Harsh Doorstop\logs\game_output.log" +global log_path_dev := "G:\Steam\steamapps\common\Harsh Doorstop Developer Build\HarshDoorstop\Saved\Logs\HarshDoorstop.log" +global title := "Operation: Harsh Doorstop" +global icon := "G:\SteamLibrary\steamapps\common\Harsh Doorstop\HarshDoorstop\Binaries\Win64\IconGroup123.png" +Menu, Tray, Icon, % icon + +global last_join_addr := "" + +lt := new LogTailer(log_path, Func("OnNewLine"), true) +lt2 := new LogTailer(log_path_dev, Func("OnNewLine"), true) +ShowToast(title, "AutoHotkey", icon, "topleft", 5) +scriptlog("ohd.ahk::end") +return + +Toast(message, _title := "Operation: Harsh Doorstop", time_seconds := 10) { + global icon, title + if (_title == "") + _title := title + ShowToast(message, _title, icon, "topleft", time_seconds) + ; ShowToast(message, title := "AutoHotkey", icon_path := "toast.bmp", position := "topleft", time_seconds := 10, bg_color := "#222222") +} + + +OnNewLine(line){ + global last_join_addr + ; scriptlog(line) + res := CheckLine(line, "NetworkFailure: PendingConnectionFailure, Error: '(.*)'") + if (res.Count() > 0) { + Toast("Failed to connect to`n" . last_join_addr, res[1]) + return + } + + res := CheckLine(line, "NetworkFailure: ConnectionLost, Error: '(.*)'") + if (res.Count() > 0) { + Toast(res[1], "Connection Lost") ; (Maybe kicked?) + return + } + + res := CheckLine(line, "LogNet: UPendingNetGame::SendInitialJoin: Sending hello. \[UNetConnection\] RemoteAddr: (.*), Name: ") + if (res.Count() > 0) { + last_join_addr := res[1] + return + } + + ; res := CheckLine(line, "LogLoad: Took .* seconds to LoadMap\((.*)\)") + ; if (res.Count() > 0) { + ; Toast(res[1], "Loaded Map") + ; return + ; } + + res := CheckLine(line, "LogExit: Exiting.") + if (res.Count() > 0) { + Toast("Exiting") + return + } + +} +CheckLine(inputStr, pattern) { + result := [] + if RegExMatch(inputStr, "O)" . pattern, matches) { + Loop, % matches.Count() { + result.Push(matches.Value(A_Index)) + } + } + return result +} diff --git a/scripts/randommousemover.ahk b/scripts/randommousemover.ahk index 73c6ea4..81b033a 100644 --- a/scripts/randommousemover.ahk +++ b/scripts/randommousemover.ahk @@ -1,20 +1,50 @@ CoordMode, mouse, window -toggle := 0, fixedY := A_ScreenHeight/2 ; choose the y you like +global interval_min := 29 ; seconds +global interval_max := 61 ; seconds +global tooltips := false -SetTimer, MoveTheMouse, -%time% +global toggle := 0 + +Menu, TRAY, add, Toggle Mouse Mover, ToggleMouseMover +Gui Add, CheckBox, vg_BackupOnSave x12 y93 w300 h23 +Checked%g_BackupOnSave% +; SetTimer, MoveTheMouse, -%time% + +^ESC::ExitApp +F1::ToggleMouseMover() -F1:: -MouseGetPos, MouseX, MouseY -if toggle := !toggle - gosub, MoveTheMouse -else - SetTimer, MoveTheMouse, off return +ToggleMouseMover() { + global interval_min, interval_max, toggle, tooltips + ; MouseGetPos, MouseX, MouseY + if (toggle == 1) { + toggle := 0 + Menu, Tray, UnCheck, Toggle Mouse Mover + SetTimer, MoveTheMouse, off + if (tooltips) { + ToolTip, % "Stopped Mouse mover" + Sleep, 5000 + ToolTip + } + } else { + toggle := 1 + Menu, Tray, Check, Toggle Mouse Mover + Random, interval, % interval_min, % interval_max + SetTimer, MoveTheMouse, % interval*1000 ; gosub, MoveTheMouse + if (tooltips) { + ToolTip, % "Started Mouse mover with " . interval . "s interval" + Sleep, % interval*1000 + ToolTip + } + } + return +} + MoveTheMouse: -Random, x, 1, % A_ScreenWidth -MouseMove, %x%, %fixedY%, 100 -Random, Time, 1000*60, 1000*60*5 -SetTimer, MoveTheMouse, -%time% ; every 3 seconds -return \ No newline at end of file + Random, x, 1, % A_ScreenWidth + Random, y, 1, % A_ScreenHeight + Random, speed, 1, 100 + MouseMove, % x, % y, % speed + ; Random, Time, 1000*60, 1000*60*2 + return \ No newline at end of file diff --git a/scripts/rect_show.ahk b/scripts/rect_show.ahk index e37fb5f..709f116 100644 --- a/scripts/rect_show.ahk +++ b/scripts/rect_show.ahk @@ -8,6 +8,9 @@ ESC:: return GetRect() { c := ParseCoords(GetCoords()) + if (!c || c == "") { + ExitApp + } AddRect(c[1],c[2],c[3],c[4]) } GetCoords() { diff --git a/scripts/regextester.ahk b/scripts/regextester.ahk new file mode 100644 index 0000000..710edad --- /dev/null +++ b/scripts/regextester.ahk @@ -0,0 +1,300 @@ +; +; Original Script can be found at: +; http://www.autohotkey.com/board/topic/81045-regular-expression-tester/ +; this script can be found at: +; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=77133#p334841 +; + +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. + +/* + Regex Tester - A front end for testing Perl Compatible Regular Expressions. + The results update in realtime and any setting or expression + errors are highlighted in red. + + Alt+C will copy the currently displayed expression to the Clipboard. + + Version 1.0 + from 5-29-2012 + By Robert Ryan + + updated 6.10.2020 + by toralf + - GUI resizable + - Errorlevel text is show when needle is wrong + - fixed: Match results were shown from previous correct needle when needle was wrong + - RegEx Option `n, `r and `a are now handled via checkboxes, since edit control doesn't handle them well + + updated 15.6.2020 + by toralf + - added ability to have Needles broken up in multiple lines with comments + +*/ + +; AutoeExecute + #NoEnv + #SingleInstance force + + gosub MakeGui + gosub UpdateMatch + gosub UpdateReplace + Gui Show, , RegEx Tester - v15.06.2020 +return + +#IfWinActive Regex Tester +!c:: + Gui Submit, NoHide + ClipBoard := (TabSelection = "RegExMatch") ? mNeedle : rNeedle + MsgBox, 64, RegEx Copied, %Clipboard% has been copied to the Clipboard, 3 +return + +GuiEscape: +GuiClose: + ExitApp +return + +RemoveComments(Line){ + If !(Pos := InStr(Trim(Line), ";")) + Return Line ; no quote character in this line + + If (Pos = 1) + Return ; whole line is pure comment + + ;remove comments (first clean line of quotes strings) + If (Pos := RegExMatch(RemoveQuotedStrings(Line), "\s+;.*$")) + Line := SubStr(Line, 1, Pos - 1) + + Return Line +} + +RemoveQuotedStrings(Line){ + ;the concept how to remove quoted strings was taken from CoCo's ListClasses script (line 77; http://ahkscript.org/boards/viewtopic.php?p=43349#p42793) + ;replace quoted strings with dots and dashes to keep length of line constant, and that other character positions do not change + static q := Chr(34) ; quote character + + ;Replace quoted literal strings 1) replace two consecutive quotes with dots + CleanLine := StrReplace(Line, q . q, "..") + + Pos := 1 ; 2) replace ungreedy strings in quotes with dashes + Needle := q . ".*?" . q + While Pos := RegExMatch(CleanLine, Needle, QuotedString, Pos){ + ReplaceString = + Loop, % StrLen(QuotedString) + ReplaceString .= "-" + CleanLine := RegExReplace(CleanLine, Needle, ReplaceString, Count, 1, Pos) + } + Return CleanLine +} + +; This is called any time any of the edit boxes on the RegExMatch tab are changed. +UpdateMatch: + Gui Submit, NoHide + + if not IsInteger(mStartPos) { + mStartPos := 1 + Gui Font, cRed + GuiControl Font, mStartPos + }else { + Gui Font, cDefault + GuiControl Font, mStartPos + } + + ;when needle is broken in several lines comments are stripped off every line and lines with text are concatenated + LineArray := StrSplit(mNeedle, "`n", "`r") + If (LineArray.MaxIndex() > 1) { + tmp = + For i, Line in LineArray + If (CleanLine := RemoveComments(Trim(Line))) + tmp .= CleanLine + mNeedle := tmp + } + ; Set Needle to return an object ( O maybe set even twice) + mNeedle := RegExReplace(mNeedle, "^(\w*)\)", "O$1)", cnt) + if (! cnt) { + mNeedle := "O)" mNeedle + } + + If mLF + mNeedle := "`n" mNeedle + If mCR + mNeedle := "`r" mNeedle + If mAnyCRLF + mNeedle := "`a" mNeedle + + Match = + FoundPos := RegExMatch(mHaystack, mNeedle, Match, mStartPos) + if (ErrLvl := ErrorLevel) { + Gui Font, cRed + GuiControl Font, mNeedle + ResultText := "FoundPos: " FoundPos "`n" + . "ErrorLevel: `n" ErrLvl "`n`n" + . "Needle: `n""" mNeedle """`n`n" + }else { + Gui Font, cDefault + GuiControl Font, mNeedle + ResultText := "FoundPos: " FoundPos "`n" + ResultText .= "Match: " Match.Value() "`n" + . "Needle: `n""" mNeedle """`n`n" + Loop % Match.Count() { + ResultText .= "Match[" + ResultText .= (Match.Name[A_Index] = "") + ? A_Index + : Match.Name[A_Index] + ResultText .= "]: " Match[A_Index] "`n" + + } + } + + GuiControl, , mResult, %ResultText% +return + +; This is called any time any of the edit boxes on the RegExReplace tab are changed. +UpdateReplace: + Gui Submit, NoHide + + If not IsInteger(rStartPos) { + rStartPos := 1 + Gui Font, cRed + GuiControl Font, rStartPos + }Else { + Gui Font, cDefault + GuiControl Font, rStartPos + } + + If not IsInteger(rLimit) { + rLimit := -1 + Gui Font, cRed + GuiControl Font, rLimit + }Else { + Gui Font, cDefault + GuiControl Font, rLimit + } + + ;when needle is broken in several lines comments are stripped off every line and lines with text are concatenated + LineArray := StrSplit(rNeedle, "`n", "`r") + If (LineArray.MaxIndex() > 1) { + tmp = + For i, Line in LineArray + If (CleanLine := RemoveComments(Trim(Line))) + tmp .= CleanLine + rNeedle := tmp + } + + If rLF + rNeedle := "`n" rNeedle + If rCR + rNeedle := "`r" rNeedle + If rAnyCRLF + rNeedle := "`a" rNeedle + + NewStr := RegExReplace(rHaystack, rNeedle, rReplacement, rCount, rLimit, rStartPos) + If (ErrLvl := ErrorLevel) { + Gui Font, cRed + GuiControl Font, rNeedle + ResultText := "Count: " rCount "`n" + . "ErrorLevel: `n" ErrLvl "`n`n" + . "Needle: `n""" rNeedle """`n`n" + }Else { + Gui Font, cDefault + GuiControl Font, rNeedle + ResultText := "Count: " rCount "`n" + . "NewStr: `n" NewStr + } + + GuiControl, , rResult, %ResultText% +return + +MakeGui: + Gui, +ReSize +MinSize + Gui Font, s10, Consolas + Gui Add, Tab2, r25 w430 vTabSelection, RegExMatch|RegExReplace + + Gui Tab, RegExMatch + Gui Add, Text, , Text to be searched: + Gui Add, Edit, r10 w400 vmHaystack gUpdateMatch + Gui Add, Text, Section vmTxtRegEx, Regular Expression: Option + Gui Add, Checkbox, x+2 vmLF gUpdateMatch, ``n + Gui Add, Checkbox, x+2 vmCR gUpdateMatch, ``r + Gui Add, Checkbox, x+2 vmAnyCRLF gUpdateMatch, ``a + Gui Add, Edit, xs r5 w305 vmNeedle gUpdateMatch + Gui Add, Text, x+15 ys vmTxtStart, Start: (1) + Gui Add, Edit, r1 w75 vmStartPos gUpdateMatch, 1 + Gui Add, Text, xs vmTxtResult, Results: + Gui Add, Edit, r14 w400 +readonly -TabStop vmResult + + Gui Tab, RegExReplace + Gui Add, Text, , Text to be searched: + Gui Add, Edit, r10 w400 vrHaystack gUpdateReplace, + Gui Add, Text, Section vrTxtRegEx, Regular Expression: Option + Gui Add, Checkbox, x+2 vrLF gUpdateReplace, ``n + Gui Add, Checkbox, x+2 vrCR gUpdateReplace, ``r + Gui Add, Checkbox, x+2 vrAnyCRLF gUpdateReplace, ``a + Gui Add, Edit, xs r5 w305 vrNeedle gUpdateReplace, + Gui Add, Text, vrTxtReplace, Replacement Text: + Gui Add, Edit, r2 w305 vrReplacement gUpdatereplace, + Gui Add, Text, vrTxtResult, Results: + Gui Add, Edit, r10 w400 +readonly -TabStop vrResult + Gui Add, Text, ys xs+320 Section vrTxtStart, Start: (1) + Gui Add, Edit, r1 w75 vrStartPos gUpdateReplace, 1 + Gui Add, Text, xs y+15 vrTxtLimit, Limit: (-1) + Gui Add, Edit, r1 w75 vrLimit gUpdateReplace, -1 +return + +IsInteger(str) { + if str is integer + return true + else + return false +} + +GuiSize(GuiHwnd, EventInfo, Width, Height){ + AutoXYWH("wh", "TabSelection") + AutoXYWH("wh0.333", "mHaystack", "rHaystack") + AutoXYWH("y0.3333", "mTxtRegEx", "rTxtRegEx", "mLF", "mCR", "mAnyCRLF", "rLF", "rCR", "rAnyCRLF") + AutoXYWH("xy0.3333", "mTxtStart", "rTxtStart", "mStartPos", "rStartPos", "rTxtLimit", "rLimit", "", "") + AutoXYWH("y0.3333wh0.333", "mNeedle", "") + AutoXYWH("y0.6666", "mTxtResult", "rTxtResult") + AutoXYWH("y0.6666wh0.333", "mResult", "rResult") + + AutoXYWH("y0.3333wh0.166", "rNeedle") + AutoXYWH("y0.5wh0.166", "rReplacement") + AutoXYWH("y0.5", "rTxtReplace", "") +} + +AutoXYWH(DimSize, cList*){ ;https://www.autohotkey.com/boards/viewtopic.php?t=1079 + Static cInfo := {} + + If (DimSize = "reset") + Return cInfo := {} + + For i, ctrl in cList { + ctrlID := A_Gui ":" ctrl + If !cInfo.hasKey(ctrlID) { + ix := iy := iw := ih := 0 + GuiControlGet i, %A_Gui%: Pos, %ctrl% + MMD := InStr(DimSize, "*") ? "MoveDraw" : "Move" + fx := fy := fw := fh := 0 + For i, dim in (a := StrSplit(RegExReplace(DimSize, "i)[^xywh]"))) + If !RegExMatch(DimSize, "i)" . dim . "\s*\K[\d.-]+", f%dim%) + f%dim% := 1 + + If (InStr(DimSize, "t")) { + GuiControlGet hWnd, %A_Gui%: hWnd, %ctrl% + hParentWnd := DllCall("GetParent", "Ptr", hWnd, "Ptr") + VarSetCapacity(RECT, 16, 0) + DllCall("GetWindowRect", "Ptr", hParentWnd, "Ptr", &RECT) + DllCall("MapWindowPoints", "Ptr", 0, "Ptr", DllCall("GetParent", "Ptr", hParentWnd, "Ptr"), "Ptr", &RECT, "UInt", 1) + ix := ix - NumGet(RECT, 0, "Int") + iy := iy - NumGet(RECT, 4, "Int") + } + + cInfo[ctrlID] := {x:ix, fx:fx, y:iy, fy:fy, w:iw, fw:fw, h:ih, fh:fh, gw:A_GuiWidth, gh:A_GuiHeight, a:a, m:MMD} + } Else { + dgx := dgw := A_GuiWidth - cInfo[ctrlID].gw, dgy := dgh := A_GuiHeight - cInfo[ctrlID].gh + Options := "" + For i, dim in cInfo[ctrlID]["a"] + Options .= dim (dg%dim% * cInfo[ctrlID]["f" . dim] + cInfo[ctrlID][dim]) A_Space + GuiControl, % A_Gui ":" cInfo[ctrlID].m, % ctrl, % Options +} } } \ No newline at end of file diff --git a/scripts/regextester2.ahk b/scripts/regextester2.ahk new file mode 100644 index 0000000..75c627b --- /dev/null +++ b/scripts/regextester2.ahk @@ -0,0 +1,324 @@ +ScriptName = AHK RegEx Tester +Version = 2.1 +;by toralf +;requires AHK 1.0.46+ +;www.autohotkey.com/forum/topic17844.html + +/* +Version history: + +2.1) +- subpattern can be encapsulated (thanks titan) +- tab with text fields allow theme (thanks titan) +- a small fix for the layout of the result +2) +- script generates ini file right next to script to store data +- remembers last position and size of GUI (thanks majkinetor) +- up to 10 regex can be stored (thanks majkinetor) +- haystack is remembered between sessions (thanks majkinetor) +- regex can be copied to clipboard with a button (thanks Helpy) +1) +- Initial release +*/ + +;Get script/app name +SplitPath, A_ScriptName, , , , OutNameNoExt +;get ini file name +IniFile = %OutNameNoExt%.ini + +SeparatorChars = @µ§&#°¤¶®©¡¦ +DefaultSeparator = @ +DefaultRegEx = The (.*?) (?P.*?) (.*?) (.*?) the +DefaultHaystack = The quick brown fox jumps over the street. + +Separator := ReadIniKey("RegEx","Separator",DefaultSeparator) +RegExList := ReadIniKey("RegEx","RegEx",DefaultRegEx) +StringReplace, RegExList, RegExList, %Separator%, `n, All + +Separator := ReadIniKey("Haystack","Separator",DefaultSeparator) +Haystack := ReadIniKey("Haystack","Haystack",DefaultHaystack) +StringReplace, Haystack, Haystack, %Separator%, `n, All + +Gui, 1:+Resize +MinSize +LastFound +Delimiter`n +Gui1HWND := WinExist() +Gui, 1:Add, Text, , Haystack +Gui, 1:Add, Edit, w220 r8 vEdtHaystack gEvaluateRegEx , %Haystack% +Gui, 1:Add, Text, w220, Needle (RegEx)`nNote: Use \n instead of ``n, etc.`nUnlike in AHK quotes (") must not be escaped. +Gui, 1:Add, ComboBox, w220 r10 vCbbRegEx gEvaluateRegEx , %RegExList% +GuiControl, Choose, CbbRegEx, 1 +Gui, 1:Add, Tab, w220 r2.3 +Theme vTabRegExType gEvaluateRegEx , Match`nReplace + Gui, 1:Tab, Match + Gui, 1:Add, Text, Section +BackgroundTrans , OutputVar: + Gui, 1:Add, Edit, x+2 ys-4 r1 w144 vEdtUnquotedOutputVar gEvaluateRegEx , Out + Gui, 1:Add, Text, xs Section +BackgroundTrans, StartingPos: + Gui, 1:Add, Edit, x+2 ys-4 r1 w28 Right vEdtMStartingPos gEvaluateRegEx , 1 + Gui, 1:Add, Text, x+15 ys +BackgroundTrans, # Subpattern: + Gui, 1:Add, Edit, x+2 ys-4 r1 w28 Right Number vEdtNumSubpattern gEvaluateRegEx , 5 + Gui, 1:Tab, Replace + Gui, 1:Add, Text, Section +BackgroundTrans, Replacement: + Gui, 1:Add, Edit, x+2 ys-4 r1 w129 vEdtReplacement gEvaluateRegEx , $3 + Gui, 1:Add, Text, xs Section +BackgroundTrans, Limit: + Gui, 1:Add, Edit, x+2 ys-4 r1 w28 Right vEdtLimit gEvaluateRegEx , -1 + Gui, 1:Add, Text, x+25 ys +BackgroundTrans, StartingPos: + Gui, 1:Add, Edit, x+2 ys-4 r1 w28 Right vEdtRStartingPos gEvaluateRegEx , 1 +Gui, 1:Tab +Gui, 1:Add, Text, xm, Result +Gui, 1:Add, Edit, w220 r8 vEdtResult , +Gui, 1:Add, Button, vBtnClose gGuiClose , Close +Gui, 1:Add, Button, x+10 vBtnStoreRegEx gBtnStoreRegEx , Store Regex +Gui, 1:Add, Button, x+10 vBtnCopyToCB gBtnCopyToCB , Copy Regex +Gui, 1:Show, Hide, %ScriptName% v%Version% +RestoreGuiPosSize(Gui1HWND, 1) ;restore old size +Gui, 1:Show + +GoSub, EvaluateRegEx +Return + +;user has changed any data in the gui +; => update the regex result +EvaluateRegEx: + If UpdateComboBox + Return + Gui, 1:Submit, NoHide ;get all data + If (!CbbRegEx OR !EdtHaystack){ ;if no haystack or needle + GuiControl, 1:, EdtResult, ;no result and + Return ;ne evaluation + } + If (TabRegExType = "Match") { ;if match is selected + ;what results need to be shown + IsOutputVar := False ;set default options + IsPositionAndLength := False + If EdtUnquotedOutputVar is not space ;output var is wanted + { + IsOutputVar := True ;set option + + Loop, %EdtNumSubpattern% { ;set internal vars to nothing + Output%A_Index% = + OutputPos%A_Index% = + OutputLen%A_Index% = + } + +/* original regex to get the subpattern specified in CbbRegEx, not allowing encapsulation of subpattern +"s)(?|'(\w+)')).+?(? ;a subpattern word enclosed with "<>" + | ;or + '(\w+)' ;a subpattern word enclosed with "''" + ) ;no subpattern end + ) ;no subpattern end + .+? ;any ungreedy text + (?|'(\w+)')" +(? ;a subpattern word enclosed with "<>" + | ;or + '(\w+)' ;a subpattern word enclosed with "''" + ) ;no subpattern end +*/ + pos = 1 ;get named subpattern + sub = 0 + Loop{ + If pos := RegExMatch(CbbRegEx,"(?|'(\w+)')", Name , pos) + { + sub++ ;subpattern index + Name0 := Name1 = "" ? Name2 : Name1 + Output%Name0% = ;set subpattern var to nothing + OutputPos%Name0% = + OutputLen%Name0% = + sub%sub% := Name0 ;subpattern array + pos += StrLen(Name) ;calculate next starting position + } + Else Break ;no more named subpattern found + } + + If RegExMatch(CbbRegEx, "^[\w`]*P[\w`]*\)") ;Positions and length are wanted + IsPositionAndLength := True + } + + ;do the regex + FoundPos := RegExMatch(EdtHaystack, CbbRegEx, Output, EdtMStartingPos) + + ;show results + Result = ErrorLevel = %ErrorLevel%`nFoundPos = %FoundPos%`n + + If IsOutputVar { ;show output var results + Result .= EdtUnquotedOutputVar " = " Output "`n" + + Loop, %sub% { ;named subpattern + If A_index = 1 + Result .= "`n------- Named subpattern --------`n" + If IsPositionAndLength { + T := "OutputPos" sub%A_Index% + Result .= EdtUnquotedOutputVar "Pos" sub%A_Index% " = " %T% "`n" + T := "OutputLen" sub%A_Index% + Result .= EdtUnquotedOutputVar "Len" sub%A_Index% " = " %T% "`n" + }Else{ + T := "Output" sub%A_Index% + Result .= EdtUnquotedOutputVar sub%A_Index% " = " %T% "`n" + } + } + + If (EdtNumSubpattern > 0) { ;numbered subpattern + Result .= "`n------- Subpattern --------`n" + Loop, %EdtNumSubpattern% { + If IsPositionAndLength { + Result .= EdtUnquotedOutputVar "Pos" A_Index " = " OutputPos%A_Index% "`n" + Result .= EdtUnquotedOutputVar "Len" A_Index " = " OutputLen%A_Index% "`n" + }Else + Result .= EdtUnquotedOutputVar A_Index " = " Output%A_Index% "`n" + } + } + } + }Else { ;replace is selected + ;do regex + NewStr := RegExReplace(EdtHaystack, CbbRegEx, EdtReplacement, Count, EdtLimit, EdtRStartingPos) + + ;show result + Result = ErrorLevel = %ErrorLevel%`nCount = %Count%`nNewStr = %NewStr%`n + } + GuiControl, 1:, EdtResult, %Result% ;update gui +Return + +BtnCopyToCB: + Gui, 1:Submit, NoHide + Clipboard = %CbbRegEx% +Return + +BtnStoreRegEx: + Gui, 1:Submit, NoHide + RegExList := StoreRegEx(RegExList, CbbRegEx) +Return + +StoreRegEx(RegExList, CbbRegEx){ + Global UpdateComboBox + RegExList = %CbbRegEx%`n%RegExList% ;add current regex + StringSplit, RegExList, RegExList, `n ;create an array + RegExList = ;empty list + Loop, %RegExList0% { ;loop though array + ID := A_Index + AlreadyInList := False ;check if item is already in list + Loop, % ID - 1 { + If (RegExList%ID% == RegExList%A_Index%) { + AlreadyInList := True + Break + } + } + If !AlreadyInList { ;if item is not in list, add him + RegExList .= RegExList%ID% "`n" + i++ ;stop after 10 items + If (i = 10) + Break + } + } + StringTrimRight, RegExList, RegExList, 1 ;remove last `n + GuiControl, 1:, CbbRegEx, `n%RegExList% ;update combobox + GuiControl, 1:Choose, CbbRegEx, 1 + Return RegExList + } + +GuiClose: + Gui, 1:Submit, NoHide + StoreListInIni("Haystack", EdtHaystack) + StoreListInIni("RegEx", RegExList) + StoreGuiPosSize(Gui1HWND, 1) + ExitApp +Return + +StoreListInIni(Name, List){ + Global SeparatorChars + Loop, Parse, SeparatorChars + { + If (InStr(List, A_LoopField) = 0){ + Separator = %A_LoopField% + Break + } + } + StringReplace, List, List, `n , %Separator%, All + WriteIniKey(Name, "Separator", Separator) + WriteIniKey(Name, Name, List) + } + +;return key value from ini file +ReadIniKey(Section,Key,Default=""){ + global IniFile + DefaultTestValue = kbcewlkj1u234z98hr2310587fh + IniRead, KeyValue, %IniFile%, %Section%, %Key%, %DefaultTestValue% + If (KeyValue = DefaultTestValue) { + WriteIniKey(Section,Key,Default) + KeyValue = %Default% + } + Return KeyValue + } + +;write key value to ini file +WriteIniKey(Section,Key,KeyValue){ + global IniFile + IniWrite, %KeyValue%, %IniFile%, %Section%, %Key% + } + +;restore previous gui position and size +RestoreGuiPosSize(GuiUniqueID, GuiID = 1){ + GuiX := ReadIniKey("Gui" GuiID,"GuiX","") + GuiY := ReadIniKey("Gui" GuiID,"GuiY","") + GuiW := ReadIniKey("Gui" GuiID,"GuiW","") + GuiH := ReadIniKey("Gui" GuiID,"GuiH","") + DetectHiddenWindows, On + WinMove, ahk_id %GuiUniqueID%, , %GuiX%, %GuiY%, %GuiW%, %GuiH% + DetectHiddenWindows, Off + } + +;store current gui position and size +StoreGuiPosSize(GuiUniqueID, GuiID = 1){ + WinGetPos, GuiX, GuiY, GuiW, GuiH, ahk_id %GuiUniqueID% + If (GuiX > -100 AND GuiX < A_ScreenWidth - 20){ + WriteIniKey("Gui" GuiID, "GuiX", GuiX) + WriteIniKey("Gui" GuiID, "GuiY", GuiY) + WriteIniKey("Gui" GuiID, "GuiW", GuiW) + WriteIniKey("Gui" GuiID, "GuiH", GuiH) + } + } + +GuiSize: + Anchor("EdtHaystack","w") + Anchor("CbbRegEx","w") + Anchor("TabRegExType","w") + Anchor("EdtUnquotedOutputVar","w") + Anchor("EdtReplacement","w") + Anchor("EdtResult","wh") + Anchor("BtnClose","y") + Anchor("BtnStoreRegEx","y") + Anchor("BtnCopyToCB","y") +Return + +Anchor(c, a, r = false) { ; v3.5.1 - Titan + static d + GuiControlGet, p, Pos, %c% + If !A_Gui or ErrorLevel + Return + i = x.w.y.h./.7.%A_GuiWidth%.%A_GuiHeight%.`n%A_Gui%:%c%= + StringSplit, i, i, . + d .= (n := !InStr(d, i9)) ? i9 : + Loop, 4 + x := A_Index, j := i%x%, i6 += x = 3 + , k := !RegExMatch(a, j . "([\d.]+)", v) + (v1 ? v1 : 0) + , e := p%j% - i%i6% * k, d .= n ? e . i5 : "" + , RegExMatch(d, RegExReplace(i9, "([[\\\^\$\.\|\?\*\+\(\)])", "\$1") + . "(?:([\d.\-]+)/){" . x . "}", v) + , l .= InStr(a, j) ? j . v1 + i%i6% * k : "" + r := r ? "Draw" : + GuiControl, Move%r%, %c%, %l% + } \ No newline at end of file diff --git a/scripts/sirens.ahk b/scripts/sirens.ahk new file mode 100644 index 0000000..6c86da9 --- /dev/null +++ b/scripts/sirens.ahk @@ -0,0 +1,56 @@ +#Persistent +#InstallKeybdHook +#UseHook 1 +#SingleInstance force +#include +EnforceAdmin() + +; Initialize variables to keep track of the current sound and its state +currentSound := "" +isPlaying := false + +; Define hotkeys for the numpad keys 1-9 +Numpad1::ToggleSound("innen/martinshorn-pressluft.wav") +Numpad2::ToggleSound("innen/martinshorn-pressluft2.wav") +Numpad3::ToggleSound("innen/rtw.wav") +Numpad4::ToggleSound("innen/polizei-land-alt.wav") +Numpad5::ToggleSound("innen/polizei.wav") +; Add more numpad keys as needed + +; Add a hotkey for Numpad0 to stop all sounds +Numpad0::StopAllSounds() + +ToggleSound(soundFile) { + global currentSound, isPlaying + soundPath := A_ScriptDir . "\sirens\" . soundFile + scriptlog(soundPath) + ; If the same sound is already playing, stop it + if (currentSound = soundFile && isPlaying) { + SoundPlay, %soundPath%, 1 + isPlaying := false + currentSound := "" + } else { + ; Stop the current sound if any + if (currentSound != "" && isPlaying) { + SoundPlay, %currentSound%, 1 + isPlaying := false + } + ; Play the new sound in a loop + isPlaying := true + currentSound := soundFile + while (isPlaying) { + SoundPlay, %soundPath%, 1 + Sleep, 5000 ; Adjust the sleep duration to match the sound's length + } + } +} + +StopAllSounds() { + global currentSound, isPlaying + ; Stop the current sound if any + if (currentSound != "" && isPlaying) { + SoundPlay, %A_ScriptDir%\nonexistant.mp3, 1 + isPlaying := false + currentSound := "" + } +} diff --git a/scripts/startup_idle.ahk b/scripts/startup_idle.ahk new file mode 100644 index 0000000..566f921 --- /dev/null +++ b/scripts/startup_idle.ahk @@ -0,0 +1,76 @@ +#Persistent +#SingleInstance Force +; #NoEnv + +#Include +global no_ui := false + +SetTimer, CheckCPUusage, 1000 ; Check every second + +CheckCPUusage: + ; GetCpuLoudClip := GetCpuLoudClip() + ; scriptlog("GetCpuLoudClip: " . GetCpuLoudClip . "%") + GetCpuLoad := GetCpuLoad() + scriptlog("GetCpuLoad: " . GetCpuLoad . "%") + GetCpuUsage := GetCpuUsage() + scriptlog("GetCpuUsage: " . GetCpuUsage . "%") + GetAccurateCpuUsage := GetAccurateCpuUsage() + scriptlog("GetAccurateCpuUsage: " . GetAccurateCpuUsage . "%") + ; if (cpuUsage < 40) + ; { + ; Run, notepad + ; ExitApp + ; } + return +; GetCpuLoudClip() { +; ClipAll = %ClipBoardAll% +; runwait, cmd.exe /c wmic cpu get loadpercentage | clip,, hide +; loop, parse, Clipboard, `n, `r +; if (A_Index = 3) +; cpuLoadPC := A_LoopField, break +; ClipBoard := ClipAll +; return cpuLoadPC +; } +GetCpuLoad(period := 500) { + total := GetSystemTimes(idle) + Sleep, % period + total2 := GetSystemTimes(idle2) + Return 100*(1 - (idle2 - idle)/(total2 - total)) + } + + GetSystemTimes(ByRef IdleTime) { + DllCall("GetSystemTimes", "Int64P", IdleTime, "Int64P", KernelTime, "Int64P", UserTime) + Return KernelTime + UserTime + } +GetCpuUsage() { + static idleTime := 0, kernelTime := 0, userTime := 0 + DllCall("GetSystemTimes", "Int64*", idleTime, "Int64*", kernelTime, "Int64*", userTime) + + ; Calculate CPU usage based on system times + cpuUsage := ((kernelTime + userTime - idleTime) / (kernelTime + userTime)) * 100 + + return cpuUsage +} +GetAccurateCpuUsage() { + ; Define the structure for PROCESS_BASIC_INFORMATION + VarSetCapacity(PBIIterationCount, 4), PBIIterationCount := 0 + VarSetCapacity(ProcessBasicInformation, 24, 0) + + ; Open the current process + handle := DllCall("OpenProcess", "UInt", 0x001F0FFF, "Bool", false, "Ptr", DllCall("GetCurrentProcess", "Ptr")) + if (handle != 0) { + ; Prepare the parameters for NtQueryInformationProcess + DllCall("Ntdll.dll\NtQueryInformationProcess", "Ptr", handle, "UInt", 0, "Ptr", &ProcessBasicInformation, "UInt", 24) + + ; Extract the CPU usage from ProcessBasicInformation + cpuUsage := NumGet(&ProcessBasicInformation, 8, "UInt") ; Assuming the CPU usage is stored here + + ; Close the handle + DllCall("CloseHandle", "Ptr", handle) + + return cpuUsage + } else { + MsgBox, Failed to open process + return 0 + } +} \ No newline at end of file diff --git a/scripts/togglehold.ahk b/scripts/togglehold.ahk index 6644273..0377926 100644 --- a/scripts/togglehold.ahk +++ b/scripts/togglehold.ahk @@ -1,5 +1,5 @@ #Persistent -#NoTrayIcon +; #NoTrayIcon #NoEnv #SingleInstance, force SetBatchLines, -1 diff --git a/scripts/vr.ahk b/scripts/vr.ahk index 0b09f59..d7d5983 100644 --- a/scripts/vr.ahk +++ b/scripts/vr.ahk @@ -1,18 +1,19 @@ #SingleInstance Force #NoEnv -#NoTrayIcon +; #NoTrayIcon #Persistent SetWorkingDir %A_ScriptDir% SetBatchLines -1 DetectHiddenWindows On #Include -global noui := false +global noui := true ; EnforceAdmin() global perf_mode := false #include global vd := new VirtualDesktop() +vd.init() global traylib := new TrayLib() traylib.start(Func("OnTrayChanged")) vd.last_event := "" @@ -238,14 +239,14 @@ OnVirtualDesktopDisconnected() { scriptlog("OnVirtualDesktopDisconnected") ExecuteEventDir("OnVirtualDesktopDisconnected") if (!steamvr.windows.vrmonitor.exists()) { - vd.restart() + ; vd.restart() } } OnVirtualDesktopConnectionLost(fails) { scriptlog("OnVirtualDesktopConnectionLost (" . fails . ")") ExecuteEventDir("OnVirtualDesktopConnectionLost") if (!steamvr.windows.vrmonitor.exists()) { - vd.restart() + ; vd.restart() } ; if (fails > 1) { ; vd.failcounter := 0 @@ -266,7 +267,7 @@ OnVirtualDesktopInternetLost() { } InternetLostCheck: if (vd.state == "NoInternet" or vd.state == "ConnectionLost") { - vd.restart() + ; vd.restart() } else { SetTimer, InternetLostCheck, Off } diff --git a/scripts/winclose.ahk b/scripts/winclose.ahk index acbfb5f..40468b6 100644 --- a/scripts/winclose.ahk +++ b/scripts/winclose.ahk @@ -6,7 +6,7 @@ #Include EnforceAdmin() -global no_ui := false +global no_ui := true ; https://gist.github.com/Bluscream/119f09441c512ef267ade38bd4a5c9ce#file-winclose-ahk ; Big thanks to Dinenon#8239 ; SetBatchLines, -1 @@ -33,11 +33,11 @@ titles.push({title:"Purchase now", text: "",action: "CloseWindow titles.push({title:"Contribute to NetSpeedMonitor",text: "",action: "CloseWindow"}) titles.push({title:"Please restart app", text: "",action: "CloseWindow"}) titles.push({title:"Proxy Authentication", text: "",action: "CloseWindow"}) -titles.push({title:"Error... ahk_class #32770 ahk_exe MyPhoneExplorer.exe", text: "", action: "CloseWindow"}) ; ClickButton:&OK +titles.push({title:"Error... ahk_class #32770 ahk_exe MyPhoneExplorer.exe", text: "", action: "CloseWindow"}) ; ClickButton$&OK titles.push({title:"C:\WINDOWS\system32\cmd.exe (Admin) ahk_class #32770 ahk_exe ConEmu64.exe",text: "WaitNamedPipe failed", action: "CloseWindow"}) titles.push({title:"",text: "Error OnTimer", action: "CloseWindow"}) -titles.push({title:"",text: "Assertion: ConEmu ", action: "ClickButton:&Ignore"}) -titles.push({title:"",text: "Available ConEmu GUI window not found!", action: "ClickButton:&Retry"}) ; ahk_class #32770 ahk_exe ConEmu64.exe +titles.push({title:"",text: "Assertion: ConEmu ", action: "ClickButton$&Ignore"}) +titles.push({title:"",text: "Available ConEmu GUI window not found!", action: "ClickButton$&Retry"}) ; ahk_class #32770 ahk_exe ConEmu64.exe titles.push({title:"",text: "Error on init, details in Debug.txt", action: "CloseWindow"}) titles.push({title:"",text: "DragDrop registration did not succeed.", action: "CloseWindow"}) titles.push({title:"",text: "Steam is not running. Please start Steam then run this tool again.", action: "CloseWindow"}) @@ -45,18 +45,18 @@ titles.push({title:"",text: "Network error, please try connection to http://devx titles.push({title:"",text: "please let us know about the problem (devxdevelopment@gmail.com),", action: "CloseWindow"}) titles.push({title:"",text: "The trial license has expired. If you wish to continue using all features of this application, then you must buy a license.", action: "CloseWindow"}) titles.push({title:"",text: "System.InvalidOperationException: Starting a second message loop on a single thread is not a valid operation. Use Form.ShowDialog instead.", action: "CloseWindow"}) -titles.push({title:"Run In Safe Mode? ahk_class #32770 ahk_exe h1_sp64_ship.exe", text: "", action: "ClickButton:No"}) -titles.push({title:"GetISteam ahk_class #32770 ahk_exe h1_sp64_ship.exe", text: "", action: "ClickButton:OK"}) -titles.push({title:"Error Applying Security ahk_class #32770 ahk_exe explorer.exe", text: "", action: "ClickButton:&Continue"}) -titles.push({title:"Fehler ahk_class TMessageForm ahk_exe yatqa.exe", text: "", action: "ClickButton:&Ignorieren"}) +titles.push({title:"Run In Safe Mode? ahk_class #32770 ahk_exe h1_sp64_ship.exe", text: "", action: "ClickButton$No"}) +titles.push({title:"GetISteam ahk_class #32770 ahk_exe h1_sp64_ship.exe", text: "", action: "ClickButton$OK"}) +titles.push({title:"Error Applying Security ahk_class #32770 ahk_exe explorer.exe", text: "", action: "ClickButton$&Continue"}) +titles.push({title:"Fehler ahk_class TMessageForm ahk_exe yatqa.exe", text: "", action: "ClickButton$&Ignorieren"}) titles.push({title:"Your Windows license will expire soon ahk_class Shell_SystemDialog ahk_exe LicensingUI.exe", text: "", action: "CloseWindow"}) titles.push({title:"Donate to MyPhoneExplorer! ahk_class ThunderRT6FormDC ahk_exe MyPhoneExplorer.exe", text: "", action: "CloseWindow"}) titles.push({title:"Strony nie znaleziono - Gesundheit Real Desktop 3D – Desktop for Windows ahk_class #32770 ahk_exe rdesc.exe", text: "", action: "CloseWindow"}) titles.push({title:"Can’t reach this page (Not Responding) ahk_class Ghost ", text: "", action: "CloseWindow"}) -titles.push({title:"TC4Shell ahk_class TTrialForm", text: "", action: "ClickButton:&Continue"}) +titles.push({title:"TC4Shell ahk_class TTrialForm", text: "", action: "ClickButton$&Continue"}) titles.push({title:"OpenVR Advanced Settings Overlay - Advanced Settings ahk_class Qt5QWindowIcon ahk_exe AdvancedSettings.exe", text: "", action: "CloseWindow"}) -titles.push({title:"Allow game launch? ahk_class vguiPopupWindow ahk_exe Steam.exe", text: "", action: "Click:X316 Y197"}) -titles.push({title:"Warning ahk_class vguiPopupWindow ahk_exe steam.exe", text: "", action: "Click:X283 Y88"}) +titles.push({title:"Allow game launch? ahk_class vguiPopupWindow ahk_exe Steam.exe", text: "", action: "Click$X316 Y197"}) +titles.push({title:"Warning ahk_class vguiPopupWindow ahk_exe steam.exe", text: "", action: "Click$X283 Y88"}) titles.push({title:"Error ahk_class #32770 ahk_exe SideQuest.exe", text: "", action: "CloseWindow"}) titles.push({title:"WindowMenuPlus ahk_class #32770 ahk_exe WindowMenuPlus.exe", text: "The configuration is available from TaskTray icon menu.", action: "CloseWindow"}) titles.push({title:"Evaluation Feedback ahk_class SunAwtDialog ahk_exe phpstorm64.exe", text: "", action: "CloseWindow"}) @@ -69,30 +69,30 @@ titles.push({title:"taskkill.exe - Anwendungsfehler ahk_class #32770", text: "Di titles.push({title:"Anwendungsfehler ahk_class #32770", text: "", action: "CloseWindow"}) titles.push({title:"Application Error ahk_class #32770", text: "", action: "CloseWindow"}) titles.push({title:"ahk_class CNotificationWindow_Class ahk_exe SUPERANTISPYWARE.EXE", text: "Professional Trial Expires", action: "CloseWindow"} ) -titles.push({title:"Connection Error ahk_class vguiPopupWindow ahk_exe steam.exe", text: "", action: "Click:X105 Y234"}) +titles.push({title:"Connection Error ahk_class vguiPopupWindow ahk_exe steam.exe", text: "", action: "Click$X105 Y234"}) titles.push({title:"Error ahk_class #32770 ahk_exe wallpaper64.exe", text: "Wallpaper Engine was possibly crashed by another application.", action: "CloseWindow"}) titles.push({title:"SUPERAntiSpyware Professional Evaluation Period Expired ahk_class #32770 ahk_exe SUPERANTISPYWARE.EXE", text: "", action: "CloseWindow"}) -titles.push({title:"Message ahk_class #32770", text: "Do you want to start in safe mode?", action: "ClickButton:&No"}) -titles.push({title:"Croteam crash reporter ahk_class CrashReporterWindowClass", text: "", action: "ClickButton:Exit"}) +titles.push({title:"Message ahk_class #32770", text: "Do you want to start in safe mode?", action: "ClickButton$&No"}) +titles.push({title:"Croteam crash reporter ahk_class CrashReporterWindowClass", text: "", action: "ClickButton$Exit"}) titles.push({title:"Message ahk_class #32770", text: "The application has malfunctioned and it will now close.", action: "CloseWindow"}) -titles.push({title:"Crash Report ahk_class SALFRAME ahk_exe soffice.bin", text: "", action: "Click:X554 Y118"}) +titles.push({title:"Crash Report ahk_class SALFRAME ahk_exe soffice.bin", text: "", action: "Click$X554 Y118"}) titles.push({title:"Upgrade To Pro ahk_class ThunderRT6FormDC ahk_exe Repair_Windows.exe", text: "", action: "CloseWindow"}) titles.push({title:"Tweaking.com - Windows Repair - Thank You! ahk_class ThunderRT6FormDC ahk_exe Repair_Windows.exe", text: "", action: "CloseWindow"}) titles.push({title:"Bluetooth Manager ahk_class #32770 ahk_exe TosBtMng.exe", text: "Thank you for evaluating the Bluetooth Stack for Windows by Toshiba", action: "CloseWindow"}) -titles.push({title:"PowerLauncher.exe ahk_class #32770 ahk_exe PowerLauncher.exe", text: "To run this application, you must install .NET Core", action: "ClickButton:&No"}) +titles.push({title:"PowerLauncher.exe ahk_class #32770 ahk_exe PowerLauncher.exe", text: "To run this application, you must install .NET Core", action: "ClickButton$&No"}) titles.push({title:"PowerToys Error ahk_class #32770 ahk_exe PowerToys.exe", text: "Could not start PowerToys as an administrator", action: "CloseWindow"}) -; titles.push({title:"Windows Security Alert ahk_class #32770 ahk_exe rundll32.exe", text: "Windows Defender Firewall has blocked some features of this app", action: "ClickButton:&Cancel"}) +; titles.push({title:"Windows Security Alert ahk_class #32770 ahk_exe rundll32.exe", text: "Windows Defender Firewall has blocked some features of this app", action: "ClickButton$&Cancel"}) titles.push({title:"Ahk2Exe Error ahk_class #32770 ahk_exe Ahk2Exe.exe", text: "", action: "CloseWindow"}) titles.push({title:"ahk_class #32770 ahk_exe AutoHotkeyU32.exe", text: "Warning in #include file", action: "CloseWindow"}) titles.push({title:"Microsoft Visual C++ Runtime Library ahk_class #32770 ahk_exe TeaClient.exe", text: "", action: "CloseWindow"}) -titles.push({title:"Salty Chat ahk_class #32770 ahk_exe ts3client_win64.exe", text: "", action: "ClickButton:&No"}) +titles.push({title:"Salty Chat ahk_class #32770 ahk_exe ts3client_win64.exe", text: "", action: "ClickButton$&No"}) titles.push({title:"MCEdit Error ahk_class QWidget ahk_exe mcedit2.exe", text: "", action: "CloseWindow"}) titles.push({title:"StartAllBack configuration ahk_class TMain ahk_exe StartAllBackCfg.exe", text: "Activate via web browser", action: "CloseWindow"}) titles.push({title:"Error ahk_class #32770 ahk_exe NVIDIA RTX Voice.exe", text: "Initialization failed (no speaker/mic present?)", action: "KillProcess"}) -titles.push({title:"OBS has crashed! ahk_class #32770 ahk_exe obs64.exe", text: "", action: "ClickButton:&No"}) +titles.push({title:"OBS has crashed! ahk_class #32770 ahk_exe obs64.exe", text: "", action: "ClickButton$&No"}) titles.push({title:"Message ahk_class SunAwtDialog ahk_exe BoxToGoRC.exe", text: "", action: "CloseWindow"}) titles.push({title:"Microsoft .NET ahk_exe DllHost.exe", text: "The system cannot find the file specified. (0x80070002)", action: "CloseWindow"}) -titles.push({title:b64Decode("TG9nIGluIHRvOiBibHVA") . " ahk_class SunAwtDialog ahk_exe pycharm64.exe", text: "", action: "SendBase64:TTTTT"}) +titles.push({title:b64Decode("TG9nIGluIHRvOiBibHVA") . " ahk_class SunAwtDialog ahk_exe pycharm64.exe", text: "", action: "SendBase64$TTTTT"}) titles.push({title:"Visual Studio Just-In-Time Debugger ahk_class #32770", text: "", action: "CloseWindow"}) ; titles.push({title:"Lua Error ahk_class #32770 ahk_exe modest-menu.exe", text: "", action: "CloseWindow"}) titles.push({title:"Lua Callback ahk_class #32770 ahk_exe modest-menu.exe", text: "attempt to call a nil value", action: "CloseWindow"}) @@ -100,52 +100,67 @@ titles.push({title:"Lua Callback ahk_class #32770 ahk_exe modest-menu.exe", text titles.push({title:"Kiddion's Modest Menu ahk_class #32770 ahk_exe modest-menu.exe", text: "Already running!", action: "CloseWindow"}) titles.push({title:"Kiddion's Modest Menu ahk_class #32770 ahk_exe modest-menu.exe", text: "Warning: Incompatible game version detected!", action: "CloseWindow"}) titles.push({title:"GTA5.exe - System Error ahk_class #32770", text: "", action: "CloseWindow"}) -titles.push({title:"Error ahk_class #32770 ahk_exe PlayGTAV.exe", text: "Unable to launch game, please verify your game data.", action: "ClickButton:OK"}) +titles.push({title:"Error ahk_class #32770 ahk_exe PlayGTAV.exe", text: "Unable to launch game, please verify your game data.", action: "ClickButton$OK"}) titles.push({title:"Oh Yeah! ahk_class #32770 ahk_exe Launcher.exe", text: "Injection successful", action: "CloseWindow"}) -titles.push({title:"Event Viewer ahk_exe mmc.exe", text: "You can save the contents of this log before clearing it.", action: "ClickButton:&Clear"}) +titles.push({title:"Event Viewer ahk_exe mmc.exe", text: "You can save the contents of this log before clearing it.", action: "ClickButton$&Clear"}) titles.push({title:"Oh Noes! ahk_class #32770 ahk_exe Launcher.exe", text: "Make sure Grand Theft Auto V is not running before starting the authenticator.", action: "CloseWindow"}) titles.push({title:"Oh Noes! ahk_class #32770 ahk_exe Launcher.exe", text: "Auth already running.", action: "CloseWindow"}) titles.push({title:"DesktopWindowXamlSource: WindowsTerminal.exe - System Error ahk_class #32770", text: "", action: "CloseWindow"}) titles.push({title:"WindowsTerminal.exe - System Error ahk_class #32770", text: "", action: "CloseWindow"}) titles.push({title:"Print Pictures Error ahk_class #32770 ahk_exe explorer.exe", text: "Windows Photo Viewer can't print this picture because there's no printer installed, or a service Windows needs isn't running.", action: "CloseWindow"}) -titles.push({title:"About EZShellExtensions.Net", text: "", action: "CloseWindow"}) ; Click:X567 Y-18" +titles.push({title:"About EZShellExtensions.Net", text: "", action: "CloseWindow"}) ; Click$X567 Y-18" titles.push({title:"FileMenu Tools ahk_class #32770 ahk_exe explorer.exe", text: "The operation was canceled by the user.", action: "CloseWindow"}) titles.push({title:"Host message ahk_class Qt5QWindowIcon", text: "", action: "CloseWindow"}) titles.push({title:"Authentication Failure ahk_class Qt631QWindowIcon ahk_exe obs64.exe", text: "", action: "CloseWindow"}) -titles.push({title:"Autoruns ahk_class #32770 ahk_exe Autoruns.exe",text:"Are you sure you want to delete Autoruns entry",action: "Sleep:250;ClickButton:OK"}) ; Focus:Button1 -titles.push({title:"Confirm ahk_class #32770 ahk_exe ImageMagick-",text:"Overwrite the existing file",action: "ClickButton:&Overwrite the existing file"}) +titles.push({title:"Autoruns ahk_class #32770 ahk_exe Autoruns.exe",text:"Are you sure you want to delete Autoruns entry",action: "Sleep$250;ClickButton$OK"}) ; Focus$Button1 +titles.push({title:"Confirm ahk_class #32770 ahk_exe ImageMagick-",text:"Overwrite the existing file",action: "ClickButton$&Overwrite the existing file"}) titles.push({title:"DiscordSetup.exe ahk_class #32770 ahk_exe DiscordSetup.exe",text:"",action: "CloseWindow"}) -titles.push({title:"Download - ahk_class #32770 ahk_exe sardu_4.exe",text:"",action: "ClickButton:&Yes"}) -titles.push({title:"Information ahk_class #32770 ahk_exe sardu_4.exe",text:"",action: "CloseWindow"}) ; ClickButton:&OK -; titles.push({title:"SARDU ahk_class #32770 ahk_exe sardu_4.exe",text:"",action: "ClickButton:&OK"}) -titles.push({title:" | PortableApps.com Installer ahk_class #32770",text:"",action: "ClickButton:I &Agree"}) -titles.push({title:".ahk ahk_class #32770 ahk_exe AutoHotkey.exe",text:"C:\Program Files\AutoHotkey\Lib\bluscream\json.ahk",action: "ClickButton:&Yes"}) +titles.push({title:"Download - ahk_class #32770 ahk_exe sardu_4.exe",text:"",action: "ClickButton$&Yes"}) +titles.push({title:"Information ahk_class #32770 ahk_exe sardu_4.exe",text:"",action: "CloseWindow"}) ; ClickButton$&OK +; titles.push({title:"SARDU ahk_class #32770 ahk_exe sardu_4.exe",text:"",action: "ClickButton$&OK"}) +titles.push({title:" | PortableApps.com Installer ahk_class #32770",text:"",action: "ClickButton$I &Agree"}) +titles.push({title:".ahk ahk_class #32770 ahk_exe AutoHotkey.exe",text:"C:\Program Files\AutoHotkey\Lib\bluscream\json.ahk",action: "ClickButton$&Yes"}) titles.push({title:"Script Error ahk_class Internet Explorer_TridentDlgFrame ahk_exe updatechecker.exe",text:"",action: "CloseWindow"}) -; titles.push({title:"ahk_class TMobaXtermForm ahk_exe MobaXterm.exe",ext_title:"MobaXterm Master Password",action:"ClickButton:TsListView1"}) ; ClickButton:Cancel ; Click:X1673 Y1006 +; titles.push({title:"ahk_class TMobaXtermForm ahk_exe MobaXterm.exe",ext_title:"MobaXterm Master Password",action:"ClickButton$TsListView1"}) ; ClickButton$Cancel ; Click$X1673 Y1006 titles.push({title:"HASS.Agent ahk_class WindowsForms10.Window.8.app.0.2982bee_r3_ad1 ahk_exe HASS.Agent.exe",text:"Error trying to bind the API to port ",action: "CloseWindow"}) titles.push({title:"Taskbar ahk_class #32770 ahk_exe explorer.exe",text:"",action: "CloseWindow"}) titles.push({title:"RaiDrive ahk_class HwndWrapper[RaiDrive;;4a926fae-babf-4e16-8d32-436648ddf991] ahk_exe RaiDrive.exe",text:"standard 2022.6.92",action: "CloseWindow"}) titles.push({title:"ShareX - Hotkey registration failed ahk_class #32770 ahk_exe ShareX.exe",text:"",action: "CloseWindow"}) -; titles.push({title:"Process Lasso ahk_class #32770 ahk_exe processlasso.exe", text: "", action: "ClickButton:Button3"}) +; titles.push({title:"Process Lasso ahk_class #32770 ahk_exe processlasso.exe", text: "", action: "ClickButton$Button3"}) titles.push({title:"Message ahk_class #32770 ahk_exe BlackSquadGame.exe",text:"This is application must to run from launcher.",action: "CloseWindow"}) titles.push({title:"BattlEye Launcher ahk_class #32770 ahk_exe BlackSquadGame_BELauncher.exe",text:"",action: "CloseWindow"}) titles.push({title:"RunDLL ahk_class #32770 ahk_exe rundll32.exe",text:"Missing entry: ",action: "CloseWindow"}) -titles.push({title:"Error ahk_class #32770 ahk_exe iw4x.exe",text:"Fatal error",action: "ClickButton:No"}) +titles.push({title:"Error ahk_class #32770 ahk_exe iw4x.exe",text:"Fatal error",action: "ClickButton$No"}) titles.push({title:"Error ahk_class #32770 ahk_exe RestartOnCrash.exe",text:"OK",action: "CloseWindow"}) titles.push({title:"Attention! ahk_class #32770 ahk_exe ADBAppControl.exe",text:"Removing or disabling SYSTEM applications may result in failure of the device and reset to factory settings (with data wipe). Are you sure you want to continue?",action: "ClickButton:&Yes"}) titles.push({title:"Task completed ahk_class #32770 ahk_exe ADBAppControl.exe",text:"OK",action: "CloseWindow"}) -titles.push({title:"AirServer® Universal ahk_class NativeHWNDHost ahk_exe AirServer.exe",text:"",action: "ClickButton:Try;CloseWindow"}) -titles.push({title:"Invalid License Key • DisplayFusion Pro ahk_exe DisplayFusion.exe",text:"",action: "ClickButton:Maybe Later"}) -titles.push({title:"VRCX ahk_class #32770 ahk_exe VRCX.exe",text:"VRCX is already running, start another instance?",action: "ClickButton:No"}) +titles.push({title:"AirServer® Universal ahk_class NativeHWNDHost ahk_exe AirServer.exe",text:"",action: "ClickButton$Try;CloseWindow"}) +titles.push({title:"Invalid License Key • DisplayFusion Pro ahk_exe DisplayFusion.exe",text:"",action: "ClickButton$Maybe Later"}) +titles.push({title:"VRCX ahk_class #32770 ahk_exe VRCX.exe",text:"VRCX is already running, start another instance?",action: "ClickButton$No"}) titles.push({title:"Setup ahk_class #32770",text:"Newer or same version already installed. Setup will exit now.",action: "CloseWindow"}) -titles.push({title:"Remote Desktop Connection ahk_class #32770 ahk_exe mstsc.exe",text:"OK",action: "ClickButton:OK"}) -titles.push({title:"About / Registration info... ahk_class #32770 ahk_exe voicemeeter8x64.exe",action: "CloseWindow"}) ; Click:X543 Y432 +titles.push({title:"Remote Desktop Connection ahk_class #32770 ahk_exe mstsc.exe",text:"OK",action: "ClickButton$OK"}) +titles.push({title:"About / Registration info... ahk_class #32770 ahk_exe voicemeeter8x64.exe",action: "CloseWindow"}) ; Click$X543 Y432 titles.push({title:"Battle.net ahk_class Qt5151QWindowIcon ahk_exe Battle.net.exe ahk_pid 16320 ahk_id 526450",w:400,h:176,action:"CloseWindow"}) titles.push({title:"Arma 2: British Armed Forces Uninstall ahk_class #32770",text:"Arma 2: British Armed Forces was successfully uninstalled.",action:"CloseWindow"}) titles.push({title:"Arma 2 Army of The Czech Republic Setup ahk_class #32770 ahk_exe datacachepreprocessor.exe",text:"!!! MISSING STRING",action:"CloseWindow"}) titles.push({title:"Steam Error ahk_class #32770 ahk_exe datacachepreprocessor.exe",text:"Application load error ",action:"CloseWindow"}) titles.push({title:"vorpX Control ahk_class #32770 ahk_exe vorpControl.exe",text:"The vorpX Service is not running. vorpX will try to start it now.",action:"CloseWindow"}) titles.push({title:"RivaTunerStatisticsServer ahk_class #32770 ahk_exe RTSS.exe",text:"Direct3D12 components cannot be hooked right now. It is strongly recommended to restart application.",action:"CloseWindow"}) +titles.push({title:"Saving ahk_class #32770 ahk_exe TS SE Tool.exe",text:"File saved",action:"ClickButton$OK"}) +titles.push({title:"Already running! ahk_class SunAwtDialog ahk_exe javaw.exe",text:"",action:"CloseWindow"}) +titles.push({title:"ADB AppControl ahk_class #32770 ahk_exe ADBAppControl.exe",text:"The device does not respond for a long time and may be in sleep mode.",action:"CloseWindow"}) +titles.push({title:"Internal Failure ahk_class #32770 ahk_exe ChilloutVR.exe",text:"Failed to load original DLL",action:"CloseWindow;Run$steam://rungameid/661130"}) +titles.push({title:"Test ahk_class #32770 ahk_exe AutoHotkeyU64.exe",text:"",action:"CloseWindow;Run$steam://rungameid/661130"}) +titles.push({title:"ahk_exe WWAHost.exe",text:"",action:"CloseWindow;KillProcess"}) +titles.push({title:"Safe Mode ahk_class Qt663QWindowIcon ahk_exe obs64.exe",text:"",action:"CloseWindow"}) ; Click$X428 Y112 +titles.push({title:"ahk_exe RaiDrive.exe",text:"ads.raidrive.com/standard/c/widget_",action:"CloseWindow"}) ; Intermediate D3D Window2 +titles.push({title:"Process Lasso ahk_class #32770 ahk_exe ProcessLasso.exe",text:"Purchase now",action:"CloseWindow"}) + + +; ahk_class HwndWrapper[RaiDrive;;098cd9be-3432-4d65-8a52-9db506143841] +; ads.raidrive.com/standard/c/widget_202309?v=2023.9.209&s=300x250&l=en +; Chrome Legacy Window + ; titles.push({title: "DB Browser for SQLite ahk_class Qt5QWindowIcon ahk_exe DB Browser for SQLite.exe", text: "", action: "Click:X232 Y67"}) ; titles.push({title: "ahk_class CabinetWClass ahk_exe Explorer.EXE", text: "UNREGISTERED VERSION", action: "CloseWindow"}) @@ -226,7 +241,7 @@ runChecks(hwnd_ := 0x0){ WinGet, proc, ProcessName, %title% scriptlog("Closing window " . title . " from process " . proc . " with " . action) for i, action in actions { - action := StrSplit(action, ":") + action := StrSplit(action, "$") if (action[1] == "CloseWindow"){ closeWindow("ahk_id " . hwnd_) Continue @@ -252,8 +267,12 @@ runChecks(hwnd_ := 0x0){ } else if (action[1] == "Sleep"){ Sleep, % action[2] Continue + } else if (action[1] == "Run"){ + Run % action[2] + Continue } } + return } } } diff --git a/scripts/yatqa copy.ahk b/scripts/yatqa copy.ahk new file mode 100644 index 0000000..0cf2879 --- /dev/null +++ b/scripts/yatqa copy.ahk @@ -0,0 +1,45 @@ +#SingleInstance Force +#NoEnv +SetWorkingDir %A_ScriptDir% +SetBatchLines -1 +#include +global noui := false + +; YaTQA › Yet another TeamSpeak³ Query App ‹ v3.9.9 [registered for Full Name] + +yatqa := "ahk_class TMainForm ahk_exe yatqa.exe" +suffix := " [Modded]" + + +while (True) { + WinWaitActive, % yatqa + ; Control, Hide,,Button37, %yatqa% + WinGetTitle, window_title, %yatqa% + ; scriptlog(window_title) + window_title := RegExReplace(window_title, " \[registered for .*\]" , " [registered for REDACTED]", "", 1) + window_title := StrReplace(window_title, suffix, "") + WinSetTitle, %yatqa%,, %window_title%%suffix% + ControlSetText, TButton5, YANNI, %yatqa% + Control, Add, Penis, TListView1 + ; ControlMove, TButton5, 100, 100, 50,50,%yatqa% + WinWaitClose, % yatqa +} +return +#IfWinActive ahk_class TMainForm ahk_exe yatqa.exe +MButton:: + if (!active) { + InputBox, interval, Serverlist Auto Refresh Interval, Please enter a interval in seconds, + if ErrorLevel + Return + } + active:=!active + SetTimer, AutoRefresh, % active ? interval : "Delete" + +AutoRefresh: + ControlGetText, btn_text , TButton5, %yatqa% + if (btn_text != "Aktualisieren" || btn_text != "Refresh") { + gosub MButton + Return + } + ControlClick , TButton5, %yatqa% + return \ No newline at end of file diff --git a/scripts/yatqa.ahk b/scripts/yatqa.ahk index 0cf2879..7c85461 100644 --- a/scripts/yatqa.ahk +++ b/scripts/yatqa.ahk @@ -3,43 +3,71 @@ SetWorkingDir %A_ScriptDir% SetBatchLines -1 #include -global noui := false - -; YaTQA › Yet another TeamSpeak³ Query App ‹ v3.9.9 [registered for Full Name] -yatqa := "ahk_class TMainForm ahk_exe yatqa.exe" -suffix := " [Modded]" +; Global Variables +global noui := false +global active := false +global interval := 0 +global running := true +global yatqa := "ahk_class TMainForm ahk_exe yatqa.exe" +global suffix := " [Modded]" +; Tray Menu Setup +Menu, Tray, NoStandard +MenuItem, &Feature1, Feature1 +MenuItem, &Feature2, Feature2 +MenuItem, &Feature3, Feature3 +Return -while (True) { - WinWaitActive, % yatqa - ; Control, Hide,,Button37, %yatqa% - WinGetTitle, window_title, %yatqa% - ; scriptlog(window_title) - window_title := RegExReplace(window_title, " \[registered for .*\]" , " [registered for REDACTED]", "", 1) - window_title := StrReplace(window_title, suffix, "") - WinSetTitle, %yatqa%,, %window_title%%suffix% - ControlSetText, TButton5, YANNI, %yatqa% - Control, Add, Penis, TListView1 - ; ControlMove, TButton5, 100, 100, 50,50,%yatqa% - WinWaitClose, % yatqa -} -return -#IfWinActive ahk_class TMainForm ahk_exe yatqa.exe -MButton:: +; Feature 1 Functionality +Feature1: + global active := !active if (!active) { - InputBox, interval, Serverlist Auto Refresh Interval, Please enter a interval in seconds, + InputBox, interval, Serverlist Auto Refresh Interval, Please enter an interval in seconds, if ErrorLevel Return } - active:=!active SetTimer, AutoRefresh, % active ? interval : "Delete" - +Return + AutoRefresh: + ; This function needs to be adapted to work within the combined script + ; It was originally designed to interact with specific controls in the YaTQA application + ; You might need to adjust the control identifiers or logic depending on the actual UI elements ControlGetText, btn_text , TButton5, %yatqa% if (btn_text != "Aktualisieren" || btn_text != "Refresh") { - gosub MButton + gosub Feature1 Return } ControlClick , TButton5, %yatqa% - return \ No newline at end of file + return + +; Feature 2 Functionality +Feature2: + while (running) { + WinWaitActive, ahk_class #32770 ahk_exe yatqa.exe + if (ErrorLevel) { + running := false + continue + } + WinGetTitle, otherWindowTitle, YaTQA › ahk_class TMainForm ahk_exe yatqa.exe + ControlSetText, Edit1, %otherWindowTitle%, ahk_class #32770 ahk_exe yatqa.exe + WinWaitClose, ahk_class #32770 ahk_exe yatqa.exe + } +Return + +; Feature 3 Functionality +Feature3: + global title := "Fehler ahk_class TMessageForm ahk_exe yatqa.exe" ; Error + global button := "&Ignorieren" ; TButton1 ; Ignore + while(true) { + WinWait, %title% + Sleep 10 + ControlClick, %button%, %title% + } +Return + +; Main Loop +while (true) { + Sleep, 100 +} diff --git a/scripts/yatqa2.ahk b/scripts/yatqa2.ahk new file mode 100644 index 0000000..6c56344 --- /dev/null +++ b/scripts/yatqa2.ahk @@ -0,0 +1,83 @@ +#SingleInstance Force +#NoEnv +#Persistent +#NoTrayIcon +SetWorkingDir %A_ScriptDir% +SetBatchLines -1 +; #include + +global noui := false +global running := true +global yatqa_window_main_title := "ahk_class TMainForm ahk_exe yatqa.exe" +global yatqa_window_save_title := "Save As ahk_class #32770 ahk_exe yatqa.exe" + +scriptlog(text) { + OutputDebug, %text% +} +SanitizeFilename(inputString) { + trimmed := Trim(inputString) + sanitized := RegExReplace(trimmed, "[^\w]", " ") + sanitized := RegExReplace(sanitized, "[^\w\s]", "_") + sanitized := RegExReplace(sanitized, "\s+", " ") + if (StrLen(sanitized) > 255) + sanitized := SubStr(sanitized, 1, 255) + return Trim(sanitized) +} + +; Function to toggle the loop +toggleLoop() { + global running + running := !running +} + +; Create the tray menu +CreateTrayMenu() { + ; Menu, Tray, NoStandard + Menu, Tray, Add, Toggle Loop, toggleLoop + Menu, Tray, Check, Toggle Loop + Menu, Tray, Default, Toggle Loop +} + +; Call the function to create the tray menu +CreateTrayMenu() + +while (running) { + scriptlog("Waiting for Save As Window") + ; Wait for the "Save As" window to become active + WinWaitActive, % yatqa_window_save_title + scriptlog("Found Save As Window") + + ; If the window is not found, break the loop + if (ErrorLevel) { + scriptlog("Failed to find Save As Window") + running := false + continue + } + + ; Get the title of the other window + WinGetTitle, main_window_title, % yatqa_window_main_title + main_window_title := Trim(main_window_title) + scriptlog("main_window_title: """ . main_window_title . """") + fileName := "" + matching := RegExMatch(main_window_title, "YaTQA › (?.+) › (?.+)", match) + scriptlog("match: " . match) + if (matching) { + name := SanitizeFilename(matchname) + if (name) + fileName .= name + ip := Trim(matchip) + if (ip) + fileName .= " (" . ip . ")" + } + + fileName := fileName . ".ts3_channels" + if (fileName) { + scriptlog("Filename: " . fileName) + ControlSetText, Edit1, % fileName, % yatqa_window_save_title + } + + ; Wait for the "Save As" window to close + WinWaitClose, % yatqa_window_save_title +} + +exitapp