Skip to content

Instantly share code, notes, and snippets.

@tnhung2011
Last active May 11, 2024 03:01
Show Gist options
  • Save tnhung2011/5249855ea28e84030f095c61b007fd13 to your computer and use it in GitHub Desktop.
Save tnhung2011/5249855ea28e84030f095c61b007fd13 to your computer and use it in GitHub Desktop.
A handy program for customizing your Roblox cursor (ANSI-encoded)
@echo off
setlocal
set __p=%systemroot%\System32\WindowsPowershell\v1.0\powershell.exe
2>nul >nul %__p% /?
if not errorlevel 0 goto :eof
set stop=:eof
set internal=%~n0
set program=RoCursor
set version=0.1
set p=%1
for /f %%A in ('"prompt $H &echo on &for %%B in (1) do rem"') do set bs=%%A
if [%p%] equ [] ( goto :main
) else if [%p%] equ [help] ( goto :help
) else if [%p%] equ [/?] ( goto :help
) else if [%p%] equ [version] ( goto :version
) else if [%p%] equ [dest] ( goto :finstpath
) else if [%p%] equ [install] ( call :finstall %2 & goto :eof
)
set ts=
call :error Option %p% is unknown
goto :eof
:: ---------------------------------
:: -- CMDLINE
:: ---------------------------------
:finstpath
call :instpath
echo %instpath%\Cursors\KeyboardMouse
goto :eof
:finstall
set p=%1
rem set stop=:eof
if [%p% equ [old ( goto :install
) else if [%p% equ [new ( goto :install
) else if [%p% equ [custom ( goto :install
)
goto :eof
:help
echo.
echo %~n0 [params...]
echo A handy program for customizing your Roblox cursor
echo.
echo (none) Start the main TUI
echo. /?, help Get help for commands
rem echo -s, --sched Schedules a specific operation to run at startup
echo install Install cursor of type ^<old ^| new ^| custom^>
echo dest Show what folder do `install` copy to
echo version Show version number and quit
goto :eof
:install
set op=%p%
goto :cmdline
:version
echo %program% v%version%
goto :eof
:: ---------------------------------
:: -- BACKBONE
:: ---------------------------------
REM // start copya funcs //
:copy
copy %1 %2 >nul
if errorlevel 0 set /a inc+=1 >nul
goto :eof
:copya
echo %ts%[.] Copying files:
for %%A IN (.) DO set d=%%~sA
echo %ts%(CD'd %d%)
set d=
set inc=0
set t=.
echo %ts% %t%\ArrowCursor.png ~^> Cursors\KeyboardMouse
call :copy %t%\ArrowCursor.png Cursors\KeyboardMouse
echo %ts% %t%\ArrowFarCursor.png ~^> Cursors\KeyboardMouse
call :copy %t%\ArrowFarCursor.png Cursors\KeyboardMouse
if [%inc% EQU [2 (
set t=+
) else ( if [%inc% EQU [1 ( set t=~
) else ( set t=- )
)
echo.
echo %ts%[%t%] Successfully copied %inc% files
set inc=
goto :eof
REM // end copya funcs //
:old
pushd %instpath%\content\textures
call :copya
popd
goto :eof
:new
pushd %localappdata%\%program%
call :getpref t cache SaveCache
if %t% EQU 1 (
call :getpref t cache WhereCache
if defined t if not exist %t% ( call :error [-] File/folder not found:
echo %ts% %t%
exit )
) else (
set "t=%localappdata%\RoCursor\cache"
if not exist %t% ( call :nocache
) else ( pushd %instpath%\content\textures
call :copya
popd
)
popd
goto :eof
:nocache
pushd %Temp%\RoCursor
%__p% -Command "try { $s = ^"%ts%^"; Write-Host $s^"[.] Downloading cursors from `nhttps://setup.rbxcdn.com/version-70a2467227df4077-content-textures2.zip^"; $ProgressPreference = 'SilentlyContinue'; $z = 'textures.zip'; Invoke-WebRequest -Uri 'https://setup.rbxcdn.com/version-70a2467227df4077-content-textures2.zip' -OutFile $n; $o = New-Object -ComObject Shell.Application; $e = Join-Path (Get-Location).Path $z; $tcpy = ($o.NameSpace($e).Items() | Where-Object {$_.Name -eq 'Cursors'}).GetFolder().Items() | Where-Object {$_.Name -eq 'KeyboardMouse'}; $o.NameSpace((Join-Path %instpath% 'content\textures\Cursors')).CopyHere($tcpy, 20); switch (%t%) {0{}1{$o.NameSpace('%localappdata%\%program%').CopyHere($tcpy);}} } except { Write-Host $s'[-] Exception '$_.FullyQualifiedErrorId': '$_.Exception^"`n^ This may be triggered of allergic reactions to non-existing or tampered files/folders^" } finally { if($e){try{Remove-Item $e -Recurse}except{Write-Host $s^"[-] Error removing`n ^"$s$e^"`n^"$s' You may do a manual cleanup instead.'}} }"
popd
ren KeyboardMouse cache
goto :eof
:custom
pushd %instpath%\content\textures
if %errorlevel% NEQ 0 goto :eof
call :copya
popd
goto :eof
:: ---------------------------------
:: -- MAIN TUI
:: ---------------------------------
:main
rem https://stackoverflow.com/q/9864620
cls
echo.
echo ÉÍ %program% v%version% ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º 1. Restore the 2017 cursor º
echo º 2. Restore the 2021 cursor º
echo º 3. Use custom cursor º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
choice /c 123 /m "%bs% Pick an option: " /n
set e=%errorlevel%
set stop=end
set "ts=%bs% "
if %e% EQU 1 ( set op=old
) else ( if %e% EQU 2 ( set op=new
) else ( if %e% EQU 3 (
echo.
set /p t=%ts%"Enter a directory: "
set op=custom
) else ( goto %stop%))
)
echo.
echo.
echo %ts%---- Processing ----
:cmdline
2>nul >nul reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\roblox-player /v InstallLocation
if errorlevel 1 (
call :error No Roblox installation found (errorlevel %errorlevel%^)
goto %stop%
)
call :instpath
call :%op%
::cls
goto %stop%
:: ---------------------------------
:: -- OUTPUTS
:: ---------------------------------
:instpath
for /f "tokens=3" %%G in ('2^>nul reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\roblox-player /v InstallLocation') do set instpath=%%G
goto :eof
:normal
echo %ts%[+] %*
goto :eof
:error
echo %ts%[-] %*
goto :eof
:info
echo %ts%[.] %*
goto :eof
:end
endlocal
echo.
echo.
echo [Press any key to exit]
pause >nul
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment