Skip to content

Commit

Permalink
Uploaded v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zspz committed Mar 25, 2024
1 parent 52c5207 commit 15ee9c4
Show file tree
Hide file tree
Showing 169 changed files with 24,475 additions and 31,246 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ node_modules
# Test output
lib-cov
/coverage
/test/test-apps/*/dist
/test/test-apps/*/dist
MMScreenshots/*
56 changes: 29 additions & 27 deletions START.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ cd %~dp0

:: IF script and executable exist, run the macro
if exist "submacros\natro_macro.ahk" (
if exist "submacros\AutoHotkeyU32.exe" (
if exist "submacros\AutoHotkey32.exe" (
if not [%~3]==[] (
set /a "delay=%~3" 2>nul
echo Starting Natro Macro in !delay! seconds.
<nul set /p =Press any key to skip . . .
timeout /t !delay! >nul
)
start "" "%~dp0submacros\AutoHotkeyU32.exe" "%~dp0submacros\natro_macro.ahk" %*
start "" "%~dp0submacros\AutoHotkey32.exe" "%~dp0submacros\natro_macro.ahk" %*
exit
) else (set "exe_missing=1")
)
Expand All @@ -28,10 +28,10 @@ set yellow=%\e%[93m
set reset=%\e%[0m

if "%exe_missing%" == "1" (
echo %red%Could not find submacros\AutoHotkeyU32.exe^^!%reset%
echo %red%Could not find submacros\AutoHotkey32.exe^^!%reset%
echo %red%This is most likely due to a third-party antivirus deleting the file:%reset%
echo %red% 1. Disable any third-party antivirus software ^(or add the Natro Macro folder as an exception^)%reset%
echo %red% 2. Re-extract the macro and check that AutoHotkeyU32.exe exists in 'submacros' folder%reset%
echo %red% 2. Re-extract the macro and check that AutoHotkey32.exe exists in 'submacros' folder%reset%
echo %red% 3. Run START.bat%reset%
echo:
echo %red%Note: Both Natro Macro and AutoHotkey are safe and work fine with Microsoft Defender^^!%reset%
Expand All @@ -48,30 +48,32 @@ if not [!grandparent!] == [] (
if not [!zip!] == [] (
call set str=%%zip:*.zip=%%
call set zip=%%zip:!str!=%%
echo %cyan%Looking for !zip!...%reset%
cd %USERPROFILE%
for %%a in ("Downloads","Downloads\Natro Macro","Desktop","Documents","OneDrive\Downloads","OneDrive\Downloads\Natro Macro","OneDrive\Desktop","OneDrive\Documents") do (
if exist "%%~a\!zip!" (
echo %cyan%Found in %%~a^^!%reset%
echo:

echo %purple%Extracting %USERPROFILE%\%%~a\!zip!...%reset%
for /f delims^=^ EOL^= %%g in ('cscript //nologo "%~f0?.wsf" "%USERPROFILE%\%%~a" "%USERPROFILE%\%%~a\!zip!"') do set "folder=%%g"
echo %purple%Extract complete^^!%reset%
echo:

echo %yellow%Deleting !zip!...%reset%
del /f /q "%USERPROFILE%\%%~a\!zip!" >nul
echo %yellow%Deleted successfully^^!%reset%
echo:

echo %green%Unzip complete^^! Starting Natro Macro in 10 seconds.%reset%
<nul set /p =%green%Press any key to skip . . . %reset%
timeout /t 10 >nul
start "" "%USERPROFILE%\%%~a\!folder!\submacros\AutoHotkeyU32.exe" "%USERPROFILE%\%%~a\!folder!\submacros\natro_macro.ahk"
exit
if not [!zip!] == [] (
echo %cyan%Looking for !zip!...%reset%
cd %USERPROFILE%
for %%a in ("Downloads","Downloads\Natro Macro","Desktop","Documents","OneDrive\Downloads","OneDrive\Downloads\Natro Macro","OneDrive\Desktop","OneDrive\Documents") do (
if exist "%%~a\!zip!" (
echo %cyan%Found in %%~a^^!%reset%
echo:

echo %purple%Extracting %USERPROFILE%\%%~a\!zip!...%reset%
for /f delims^=^ EOL^= %%g in ('cscript //nologo "%~f0?.wsf" "%USERPROFILE%\%%~a" "%USERPROFILE%\%%~a\!zip!"') do set "folder=%%g"
echo %purple%Extract complete^^!%reset%
echo:

echo %yellow%Deleting !zip!...%reset%
del /f /q "%USERPROFILE%\%%~a\!zip!" >nul
echo %yellow%Deleted successfully^^!%reset%
echo:

echo %green%Unzip complete^^! Starting Natro Macro in 10 seconds.%reset%
<nul set /p =%green%Press any key to skip . . . %reset%
timeout /t 10 >nul
start "" "%USERPROFILE%\%%~a\!folder!\submacros\AutoHotkey32.exe" "%USERPROFILE%\%%~a\!folder!\submacros\natro_macro.ahk"
exit
)
)
)
) else (echo %red%Error: No .zip detected, but essential files are missing^^!%reset%)
) else (echo %red%Error: Could not determine name of unextracted .zip^^!%reset%)
) else (echo %red%Error: Could not find Temp folder of unextracted .zip^^! ^(.bat has no grandparent^)%reset%)

Expand Down
19 changes: 19 additions & 0 deletions lib/DurationFromSeconds.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*****************************************************************************************
* @description: Simple GetDurationFormatEx parser
* https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getdurationformatex
* @author SP
*****************************************************************************************/
DurationFromSeconds(secs, format:="hh:mm:ss", capacity:=64)
{
dur := Buffer(capacity), DllCall("GetDurationFormatEx"
, "Ptr", 0
, "UInt", 0
, "Ptr", 0
, "Int64", secs*10000000
, "Str", format
, "Ptr", dur.Ptr
, "Int", 32)
return StrGet(dur)
}
hmsFromSeconds(secs) => DurationFromSeconds(secs, ((secs >= 3600) ? "h'h' m" : "") ((secs >= 60) ? "m'm' s" : "") "s's'")
Loading

0 comments on commit 15ee9c4

Please sign in to comment.