Advertisement
FoddEx

GTA V Self Radio Adder 1.8.1

Sep 19th, 2015
1,071
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Echo off
  2. setlocal enabledelayedexpansion
  3. mode con cols=20 lines=1
  4.  
  5. ::  * * * * * * * * * * * * * *  ::
  6. ::  *   Add  to Self  Radio   *  ::
  7. ::  *        1.8.1 BETA       *  ::
  8. ::  *           By            *  ::
  9. ::  *   RainBawZ / kukpappa   *  ::
  10. ::  *        aka. Tam         *  ::
  11. ::  *                         *  ::
  12. ::  *        DISCORD:         *  ::
  13. ::  *      @Inwayn#1590       *  ::
  14. ::  *                         *  ::
  15. ::  *       SocialClub:       *  ::
  16. ::  *        kukpappa         *  ::
  17. ::  *                         *  ::
  18. ::  *         Steam:          *  ::
  19. ::  *      /id/kukpappa       *  ::
  20. ::  * * * * * * * * * * * * * *  ::
  21.  
  22.  
  23. ::  - - - - - - - - - - - - - - - - - -  ::
  24. ::         EXPERIMENTAL UPDATES          ::
  25. ::             0 = DISABLED              ::
  26. ::             1 = ENABLED               ::
  27. ::                                       ::
  28.      SET ENABLE_EXPERIMENTAL_UPDATES=0
  29. ::                                       ::
  30. ::  - - - - - - - - - - - - - - - - - -  ::
  31.  
  32. set version=1.8.2
  33. set subver=%~z0
  34. set numset=1234567890
  35. set sID=!random!!random!
  36. set debug=0
  37. set UIinit=0
  38. color F0
  39. title Add To Self Radio v!version! BETA !subver!
  40. REM -----> Get current code page
  41. for /f "tokens=4" %%A in ('chcp') do (
  42.     set forcedCodePage=%%A
  43. )
  44. REM -----> Determine which code page to use
  45. if "%~1"=="_LAUNCHPARAMETER" (
  46.     if /i not "%~2"=="DEBUG" (
  47.         set preferredCodePage=%~2
  48.         chcp %~2 > nul
  49.         shift /1
  50.         shift /1
  51.     ) else (
  52.         @Echo on
  53.         prompt A2SR_DEBUG$G$G$S
  54.         set debug=1
  55.         mode con cols=120 lines=33
  56.         shift /1
  57.         shift /1
  58.     )
  59. ) else (
  60.     for /f "skip=2 tokens=2,*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "CodePage" 2^>nul') do (
  61.         if not !errorlevel!==1 (
  62.             if not "!preferredCodePage!"=="" (
  63.                 set preferredCodePage=%%B
  64.                 chcp %%B > nul
  65.             ) else (
  66.                 set preferredCodePage=!forcedCodePage!
  67.             )
  68.         ) else (
  69.             if "!preferredCodePage!"=="" (
  70.                 set preferredCodePage=!forcedCodePage!
  71.             )
  72.         )
  73.     )
  74. )
  75. REM -----> Prepare required paths
  76. for /f "skip=2 tokens=2,*" %%A in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal" 2^>nul') do (
  77.     set userDir=%%B
  78. )
  79. set musicDir=Rockstar Games\GTA V\User Music
  80.  
  81. :: REMOVE 'REM' FROM LINE BELOW TO DISABLE MUSIC DIRECTORY CHECKING. (ONLY FOR TESTING PURPOSES. DO NOT USE UNLESS YOU KNOW WHAT YOU'RE DOING.)
  82. REM GOTO :SKIP_MUSICDIR_CHECK
  83.  
  84. REM -----> Check if the usermusic directory is correct
  85. if not exist "!userDir!\!musicDir!" (
  86.     Echo x=msgbox^("Unable to find the music directory." ^& vbcrlf ^& "Assumed path: !userDir!\!musicDir!" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  87.     start "" "%temp%\a2sr_!sID!msg.vbs"
  88.     endlocal
  89.     exit /b 1
  90. )
  91. :SKIP_MUSICDIR_CHECK
  92. cd /d "%~dp0"
  93. for /f "tokens=1,2 delims=#" %%A in ('"prompt #$H#$E# & echo on & for %%B in (1) do rem"') do (
  94.     set "DEL=%%A"
  95. )
  96. reg query "HKCU\Software\FoddEx\Add to Self Radio" >nul 2>&1
  97. if !errorlevel!==0 (
  98.     for /f "skip=2 tokens=2*" %%A in ('reg query "HKCU\Software\FoddEx\Add to Self Radio" /v "Version" 2^>nul') do (
  99.         for /f "tokens=1,2,3,4 delims=." %%C in ("%%B") do (
  100.             for /f "tokens=1,2,3,4 delims=." %%G in ("!version!.%~z0") do (
  101.                 if %%C LSS %%G (
  102.                     Echo x=msgbox^("Detected an older version."^& vbcrlf ^&"Please uninstall it before installing this one.",48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  103.                     start "" "%temp%\a2sr_!sID!msg.vbs"
  104.                     endlocal
  105.                     exit /b 1
  106.                 )
  107.                 if %%D LSS %%H (
  108.                     Echo x=msgbox^("Detected an older version."^& vbcrlf ^&"Please uninstall it before installing this one.",48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  109.                     start "" "%temp%\a2sr_!sID!msg.vbs"
  110.                     endlocal
  111.                     exit /b 1
  112.                 )
  113.                 if %%E LSS %%I (
  114.                     Echo x=msgbox^("Detected an older version."^& vbcrlf ^&"Please uninstall it before installing this one.",48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  115.                     start "" "%temp%\a2sr_!sID!msg.vbs"
  116.                     endlocal
  117.                     exit /b 1
  118.                 )
  119.             )
  120.         )
  121.     )
  122.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Version" /d "!version!.%~z0" >>"%temp%\stderr.txt" 2>&1
  123. )
  124. REM -----> Query the registry for the default .mp3 player
  125. for /f "skip=2 tokens=3*" %%A in ('reg query HKCR\.mp3 /ve 2^>nul') do (
  126.     set val=%%A
  127.     REM -----> Check if Add to Self Radio is already installed
  128.     reg query "HKCR\!val!\shell\Add to Self Radio\command" /ve > nul 2>&1
  129.     if !errorlevel!==1 (
  130.         if !UIinit!==0 call :UI_initialize 120 34 150 34
  131.         set action=_
  132.         if !debug!==0 cls
  133.         Echo.
  134.         Echo   NOTE: If you've previously used an older version of
  135.         Echo         this software, you should run the uninstaller
  136.         Echo         from that version before continuing.
  137.         Echo.
  138.         Echo   Would you like to add a shortcut to the Context Menu?
  139.         Echo.
  140.         set /p action="Y/N >> "
  141.         if !action!==_ (
  142.             goto :end
  143.         )
  144.         if /i !action!==y (
  145.             REM chcp !forcedCodePage! > nul
  146.             REM -----> Check for older versions
  147.             reg query "HKCU\Software\FoddEx\Add to Self Radio" > nul 2>&1
  148.             if !errorlevel!==0 (
  149.                 Echo x=msgbox^("Detected an older version."^& vbcrlf ^&"Please uninstall it before installing this one.",48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  150.                 start "" "%temp%\a2sr_!sID!msg.vbs"
  151.                 endlocal
  152.                 exit /b 1
  153.             )
  154.             REM -----> Add registry keys
  155.             reg add "HKCR\!val!\shell\Add to Self Radio\command" /ve /d "\"%~f0\" \"%%1\"" >>"%temp%\stderr.txt" 2>&1
  156.             reg add "HKCR\AppXqj98qxeaynz6dv4459ayz6bnqxbyaqcs\shell\Add to Self Radio\command" /ve /d "\"%~f0\" \"%%1\"" >>"%temp%\stderr.txt" 2>&1
  157.             if !errorlevel!==1 (
  158.                 Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  159.                 start "" "%temp%\a2sr_!sID!msg.vbs"
  160.                 endlocal
  161.                 exit /b 1
  162.             )
  163.             reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Playlists" /d "Default" >>"%temp%\stderr.txt" 2>&1
  164.             reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "ActivePlaylist" /d "Default" >>"%temp%\stderr.txt" 2>&1
  165.             call :setup.defaultPlaylist
  166.             reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "CodePage" /d "!preferredCodePage!" >>"%temp%\stderr.txt" 2>&1
  167.             reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Version" /d "!version!.%~z0" >>"%temp%\stderr.txt" 2>&1
  168.             reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "1Timenotif" /d "0" >> "%temp%\stderr.txt" 2>&1
  169.             reg add "HKCU\Software\FoddEx\Add to Self Radio\Restore" /f >>"%temp%\stderr.txt" 2>&1
  170.             set ret=1
  171.             REM -----> Create uninstallation script
  172.             call :writeUninstall
  173.             (
  174.                 Echo.
  175.                 Echo Windows Registry Editor Version 5.00
  176.                 Echo [-HKEY_CLASSES_ROOT\!val!\shell\Add to Self Radio]
  177.                 Echo [-HKEY_CLASSES_ROOT\AppXqj98qxeaynz6dv4459ayz6bnqxbyaqcs\shell\Add to Self Radio]
  178.                 Echo [-HKEY_CURRENT_USER\Software\FoddEx\Add to Self Radio]
  179.             )>>Uninstall.bat
  180.             RUNDLL32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
  181.             echo x=msgbox^("Added registry entry"^& vbcrlf ^&"You can now right click on any .mp3 file and choose"^& vbcrlf ^&"Add to Self Radio"^&vbcrlf^&vbcrlf^&"Please run the program to complete setup." ,64, "Success"^)>"%temp%\a2sr_!sID!msg.vbs"
  182.             start "" "%temp%\a2sr_!sID!msg.vbs"
  183.             goto :end
  184.         ) else (
  185.             Echo x=msgbox^("Keys not added. Choose 'Y'." ,48, "Warning"^)>"%temp%\a2sr_!sID!msg.vbs"
  186.             start "" "%temp%\a2sr_!sID!msg.vbs"
  187.             goto :end
  188.         )
  189.     )
  190.     REM -----> Set default code page (CURRENTLY DISABLED. REMOVE 'REM ----->' TO ENABLE)
  191.     REM -----> chcp !forcedCodePage! > nul
  192.     REM -----> Read the data in the Add to Self Radio command key
  193.     for /f "skip=2 tokens=3*" %%B in ('reg query "HKCR\!val!\shell\Add to Self Radio\command" /ve 2^>nul') do (
  194.         if not "%~1"=="" (
  195.             goto :cnt
  196.         )
  197.         set regPath=%%~B
  198.         REM -----> Check if the path is unchanged
  199.         if not "!regPath!"=="%~f0" (
  200.             if !UIinit!==0 call :UI_initialize 120 34 150 34
  201.             set action=_
  202.             if !debug!==0 cls
  203.             Echo.
  204.             Echo   Detected changes in program path.
  205.             Echo.
  206.             Echo   NOTE: If you've previously used an older version of
  207.             Echo         this software, you should close this program
  208.             Echo         and run the uninstaller from that version
  209.             Echo         before continuing.
  210.             Echo.
  211.             Echo   Refresh registry entry?
  212.             set /p action="  Y/N >> "
  213.             if !action!==_ (
  214.                 goto :end
  215.             )
  216.             if /i !action!==y (
  217.                 REM -----> Renew the registry entry
  218.                 reg add "HKCR\!val!\shell\Add to Self Radio\command" /f /ve /d "\"%~f0\" \"%%1\"" >>"%temp%\stderr.txt" 2>&1
  219.                 reg add "HKCR\AppXqj98qxeaynz6dv4459ayz6bnqxbyaqcs\shell\Add to Self Radio\command" /ve /d "\"%~f0\" \"%%1\"" >>"%temp%\stderr.txt" 2>&1
  220.                 if !errorlevel!==1 (
  221.                     Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  222.                     start "" "%temp%\a2sr_!sID!msg.vbs"
  223.                     endlocal
  224.                     exit /b 1
  225.                 )
  226.                 reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "CodePage" /d "!preferredCodePage!"
  227.                 reg query "HKCU\Software\FoddEx\Add to Self Radio" /v "Playlists" > nul
  228.                 if !errorlevel!==1 (
  229.                     REM -----> Create new uninstallation script
  230.                     call :writeUninstall
  231.                     (
  232.                         Echo.
  233.                         Echo Windows Registry Editor Version 5.00
  234.                         Echo [-HKEY_CLASSES_ROOT\!val!\shell\Add to Self Radio]
  235.                         Echo [-HKEY_CLASSES_ROOT\AppXqj98qxeaynz6dv4459ayz6bnqxbyaqcs\shell\Add to Self Radio]
  236.                         Echo [-HKEY_CURRENT_USER\Software\FoddEx\Add to Self Radio]
  237.                     )>>Uninstall.bat
  238.                     RUNDLL32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True
  239.                     echo x=msgbox^("Updated registry entry" ,64, "Success"^)>"%temp%\a2sr_!sID!msg.vbs"
  240.                     start "" "%temp%\a2sr_!sID!msg.vbs"
  241.                     endlocal
  242.                     exit /b 0
  243.                 )
  244.             ) else (
  245.                 goto :end
  246.             )
  247.         ) else (
  248.             call :expUpdate
  249.         )
  250.     )
  251.     REM -----> Look for MODE value
  252.     reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "Mode" >nul 2>&1
  253.     if !errorlevel!==1 (
  254.         if !UIinit!==0 call :UI_initialize 120 34 150 34
  255.         if !debug!==0 cls
  256.         Echo.
  257.         Echo   NOTE: If you've previously used an older version of
  258.         Echo         this software, you should close the program
  259.         Echo         and run the uninstaller from the older version
  260.         Echo.
  261.         Echo.
  262.         Echo   No mode is specified. Add mode now?
  263.         Echo.
  264.         set add=0
  265.         set /p add="  Y/N>> "
  266.         if /i !add!==N (
  267.             goto end
  268.         )
  269.         if /i !add!==Y (
  270.             goto menu
  271.         ) else (
  272.             goto end
  273.         )
  274.         goto end
  275.     )
  276. )
  277. REM -----> Go to menu if no file to process is specified
  278. :cnt
  279. if "%~1"=="" (
  280.     goto menu
  281. )
  282. for /f "skip=2 tokens=3*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "Mode" 2^>nul') do (
  283.     if "%%A"=="SHORTCUT" (
  284.         goto :shortcut
  285.     )
  286.     if "%%A"=="COPY" (
  287.         goto :copy
  288.     )
  289.     if "%%A"=="MOVE" (
  290.         goto :move
  291.     )
  292.     Echo x=msgbox^("The registry query for MODE returned an invalid value."^& vbcrlf ^&"Please launch the program and change the Mode setting."^& vbcrlf ^&"Information:"^& vbcrlf ^&"VALUEDATA:%%A" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  293.     start "" "%temp%\a2sr_!sID!msg.vbs"
  294.     endlocal
  295.     exit /b 1
  296. )
  297. :: ---------------------------------------------------------------------------------------
  298.  
  299. :: ----------------------------------------------------------------------- ADD-SUBROUTINES
  300. :copy
  301. chcp !preferredCodePage! > nul
  302. REM -----> Check if the file is an mp3 file
  303. if /i not "%~x1"==".mp3" (
  304.     Echo x=msgbox^("Couldn't add %~nx1"^& vbcrlf ^&"The file has an incorrect extension (%~x1)" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  305.     "%temp%\a2sr_!sID!msg.vbs"
  306.     call :onetimenotif
  307.     endlocal
  308.     exit /b 1
  309. )
  310. title Add to Self Radio v!version! BETA !subver! - Adding %~nx1...
  311. REM -----> Check if the file already exists
  312. if exist "!userDir!\!musicDIR!\%~nx1" (
  313.     Echo x=msgbox^("A file called %~nx1 already exists." ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  314.     "%temp%\a2sr_!sID!msg.vbs"
  315.     call :onetimenotif
  316.     endlocal
  317.     exit /b 1
  318. )
  319. REM -----> Copy the file
  320. xcopy "%~1" "!userDir!\!musicDir!" > nul
  321. REM -----> Check if the file was copied
  322. if not exist "!userDir!\!musicDir!\%~nx1" (
  323.     Echo x=msgbox^("Failed to add %~nx1"^& vbcrlf ^&"If this issue persists, you can post this information at the mod page:"^& vbcrlf ^&"FILE:%~1\\PATH:!userDir!\!musicDir!" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  324.     "%temp%\a2sr_!sID!msg.vbs"
  325.     call :onetimenotif
  326.     endlocal
  327.     exit /b 1
  328. )
  329. REM -----> Display success message
  330. echo x=msgbox^("%~1 has been added." ,64, "Success"^)>"%temp%\a2sr_!sID!msg.vbs"
  331. "%temp%\a2sr_!sID!msg.vbs"
  332. call :onetimenotif
  333. goto :end
  334. :shortcut
  335. chcp !preferredCodePage! > nul
  336. REM -----> Check if the file is an mp3 file
  337. if /i not "%~x1"==".mp3" (
  338.     Echo x=msgbox^("Couldn't add %~nx1"^& vbcrlf ^&"The file has an incorrect extension (%~x1)" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  339.     "%temp%\a2sr_!sID!msg.vbs"
  340.     call :onetimenotif
  341.     endlocal
  342.     exit /b 1
  343. )
  344. title Add to Self Radio v!version! BETA !subver! - Adding %~nx1...
  345. REM -----> Check if the link already exists
  346. if exist "!userDir!\!musicDir!\%~n1.lnk" (
  347.     Echo x=msgbox^("A shortcut called %~n1.lnk already exists." ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  348.     "%temp%\a2sr_!sID!msg.vbs"
  349.     call :onetimenotif
  350.     endlocal
  351.     exit /b 1
  352. )
  353. REM -----> Create VBSscript file for shortcut creation.
  354. set SCRIPT="%TEMP%\SelfRadioShortcut.vbs"
  355. (
  356.     echo Set oWS = WScript.CreateObject^("WScript.Shell"^)
  357.     echo sLinkFile = "!userDir!\!musicDir!\%~n1.lnk"
  358.     echo Set oLink = oWS.CreateShortcut^(sLinkFile^)
  359.     echo oLink.TargetPath = "%~f1"
  360.     echo oLink.Save
  361. )>!SCRIPT!
  362. REM -----> Run the script file
  363. cscript /nologo !SCRIPT!
  364. del /q !SCRIPT! > nul
  365. if not exist "!userDir!\!musicDir!\%~n1.lnk" (
  366.     Echo x=msgbox^("Failed to add a shortcut for %~nx1"^& vbcrlf ^&"If this issue persists, you can post this information at the mod page:"^& vbcrlf ^&"FILE:%~f1\\PATH:!userDir!\!musicDir!" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  367.     "%temp%\a2sr_!sID!msg.vbs"
  368.     call :onetimenotif
  369.     endlocal
  370.     exit /b 1
  371. )
  372. REM -----> Display success message
  373. echo x=msgbox^("A shortcut to %~nx1 has been added." ,64, "Success"^)>"%temp%\a2sr_!sID!msg.vbs"
  374. "%temp%\a2sr_!sID!msg.vbs"
  375. call :onetimenotif
  376. goto :end
  377. :move
  378. chcp !preferredCodePage! > nul
  379. REM -----> Check if the file is an mp3 file
  380. if /i not "%~x1"==".mp3" (
  381.     Echo x=msgbox^("Couldn't add %~nx1"^& vbcrlf ^&"The file has an incorrect extension (%~x1)" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  382.     "%temp%\a2sr_!sID!msg.vbs"
  383.     call :onetimenotif
  384.     endlocal
  385.     exit /b 1
  386. )
  387. title Add to Self Radio v!version! BETA !subver! - Adding %~nx1...
  388. REM -----> Check if the file already exists
  389. if exist "!userDir!\!musicDIR!\%~nx1" (
  390.     Echo x=msgbox^("A file called %~nx1 already exists." ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  391.     "%temp%\a2sr_!sID!msg.vbs"
  392.     call :onetimenotif
  393.     endlocal
  394.     exit /b 1
  395. )
  396. REM -----> Move the file
  397. move "%~1" "!userDir!\!musicDir!" > nul
  398. REM -----> Check if the file was Moved
  399. if not exist "!userDir!\!musicDir!\%~nx1" (
  400.     Echo x=msgbox^("Failed to add %~nx1"^& vbcrlf ^&"If this issue persists, you can post this information at the mod page:"^& vbcrlf ^&"FILE:%~1\\PATH:!userDir!\!musicDir!" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  401.     "%temp%\a2sr_!sID!msg.vbs"
  402.     call :onetimenotif
  403.     endlocal
  404.     exit /b 1
  405. )
  406. REM -----> Display success message
  407. set "regFilename=%~n1"
  408. set regFilename=!regFilename: =_!
  409. reg add "HKCU\Software\FoddEx\Add to Self Radio\restore" /v "!regFilename!" /d "\"%~f1\"" >>"%temp%\stderr.txt" 2>&1
  410. echo x=msgbox^("%~1 has been added." ,64, "Success"^)>"%temp%\a2sr_!sID!msg.vbs"
  411. "%temp%\a2sr_!sID!msg.vbs"
  412. call :onetimenotif
  413. goto :end
  414. :: ----------------------------------------------------------------------------------------------------
  415.  
  416. :: ----------------------------------------------------------------------- UI INITALIZATION SUBROUTINES
  417. :UI_getBufferSize
  418. if !debug!==0 cls
  419. call :colortext CF "                                                   Initializing UI...                                                   " n
  420. for /f "skip=4 tokens=2 delims=:" %%A in ('mode con') do (
  421.     set horizontalBufferSize=%%A
  422.     set horizontalBufferSize=!horizontalBufferSize: =!
  423.     for /l %%B in (1,1,%%A) do (
  424.         set /a DEBUG_UIbufferCount+=1
  425.         set "UI_clearline= !UI_clearline!"
  426.         set UI_dashline=-!UI_dashline!
  427.         set UI_usline=_!UI_usline!
  428.     )
  429.     goto :eof
  430. )
  431. :UI_initialize
  432. if !debug!==1 goto :eof
  433. <nul > X set /p ".=."
  434. mode con cols=%~1 lines=%~2
  435. call :UI_getBufferSize
  436. powershell -command "&{$H=get-host;$W=$H.ui.rawui;$B=$W.buffersize;$B.width=%~3;$B.height=%~4;$W.buffersize=$B;}"
  437. set UIinit=1
  438. goto :eof
  439. :: ----------------------------------------------------------------------------
  440.  
  441. :: ----------------------------------------------------------------------- MENU
  442. :menu
  443. if !UIinit!==0 call :UI_initialize 120 34 150 34
  444. REM -----> Read settings from registry
  445. for /f "skip=2 tokens=3*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "Mode" 2^>nul') do (
  446.     set currMode=%%A
  447. )
  448. if "!currMode!"=="" (
  449.     set currMode=UNDEFINED
  450. )
  451. for /f "skip=2 tokens=3*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "Ignore" 2^>nul') do (
  452.     set currIgnore=%%A
  453. )
  454. for /f "skip=2 tokens=3*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "CodePage" 2^>nul') do (
  455.     set preferredCodePage=%%A
  456. )
  457. for /f "skip=2 tokens=2*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "ActivePlaylist" 2^>nul') do (
  458.     set activePlaylist=%%~B
  459. )
  460. if !ENABLE_EXPERIMENTAL_UPDATES!==1 (
  461.     set expUd=^(EXP. UPDATES ENABLED^)
  462. ) else (
  463.     set expUd=
  464. )
  465. if "!currIgnore!"=="" (
  466.     set currIgnore=UNDEFINED
  467. )
  468. if !currIgnore!==0 (
  469.     set currIgnore=FALSE
  470. )
  471. if !currIgnore!==1 (
  472.     set currIgnore=TRUE
  473. )
  474. if !debug!==0 cls
  475. color 70
  476. Echo   Settings can be changed at any time by running the program.
  477. call :colortext 72 "!UI_clearline!" n
  478. call :colortext 27 "  Current mode:        !currMode!                                                                                                       " n
  479. call :colortext 27 "  Ignore updates?:     !currIgnore!                                                                                                       " n
  480. call :colortext 27 "  Preferred code page: !preferredCodePage!                                                                                                       " n
  481. call :colortext 27 "  Active playlist:     !activePlaylist!                                                                                                " n
  482. call :colortext 27 "________________________________________________________________________________________________________________________" n
  483. call :colortext 8F "!UI_clearline!" n
  484. call :colortext 8F "  Mode settings                                                                                                          " n
  485. call :colortext 8F "!UI_clearline!" n
  486. call :colortext 1F "  1 --> Change mode                                                                                                      " n
  487. call :colortext 80 "________________________________________________________________________________________________________________________" n
  488. call :colortext 8F "!UI_clearline!" n
  489. call :colortext 8F "  Update settings  !expUd!                                                                                                        " n
  490. call :colortext 8F "!UI_clearline!" n
  491. call :colortext 1F "  2 --> Change update settings                                                                                             " n
  492. if not defined ret (
  493.     call :colortext 80 "________________________________________________________________________________________________________________________" n
  494.     call :colortext 8F "!UI_clearline!" n
  495.     call :colortext 8F "  Code page settings                                                                                                       " n
  496.     call :colortext 8F "!UI_clearline!" n
  497.     call :colortext 1F "  3 --> Change preferred code page                                                                                                       " n
  498.     call :colortext 80 "________________________________________________________________________________________________________________________" n
  499.     call :colortext 8F "!UI_clearline!" n
  500.     call :colortext 8F "  Playlist settings                                                                                                       " n
  501.     call :colortext 8F "!UI_clearline!" n
  502.     call :colortext 1F "  4 --> Enter the playlist menu                                                                                                       " n
  503.     call :colortext 80 "________________________________________________________________________________________________________________________" n
  504.     call :colortext 8F "!UI_clearline!" n
  505.     call :colortext 8F "  File restoration                                                                                                        " n
  506.     call :colortext 8F "!UI_clearline!" n
  507.     call :colortext 1F "  5 --> Restore moved songs                                                                                               " n
  508.     call :colortext 8F "!UI_clearline!" n
  509.     rem call :colortext 8F "!UI_clearline!" n
  510. )
  511. choice /c 123450 /n > nul 2>&1
  512. if %errorlevel%==1 (
  513.     goto :menu.toggleModes
  514. )
  515. if %errorlevel%==2 (
  516.     goto :menu.updates
  517. )
  518. if %errorlevel%==3 (
  519.     goto :menu.codepage
  520. )
  521. if %errorlevel%==4 (
  522.     call :playlist
  523.     goto :menu
  524. )
  525. if %errorlevel%==5 (
  526.     goto menu.restore
  527. )
  528. goto :menu
  529. :menu.toggleModes
  530. if !currMode!==UNDEFINED (
  531.     set mode=COPY
  532.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Mode" /d "!mode!" >>"%temp%\stderr.txt" 2>&1
  533.     if !errorlevel!==1 (
  534.         Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  535.         start "" "%temp%\a2sr_!sID!msg.vbs"
  536.         endlocal
  537.         exit /b 1
  538.     )
  539. )
  540. if !currMode!==COPY (
  541.     set mode=SHORTCUT
  542.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Mode" /d "!mode!" >>"%temp%\stderr.txt" 2>&1
  543.     if !errorlevel!==1 (
  544.         Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  545.         start "" "%temp%\a2sr_!sID!msg.vbs"
  546.         endlocal
  547.         exit /b 1
  548.     )
  549. )
  550. if !currMode!==SHORTCUT (
  551.     set mode=MOVE
  552.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Mode" /d "!mode!" >>"%temp%\stderr.txt" 2>&1
  553.     if !errorlevel!==1 (
  554.         Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  555.         start "" "%temp%\a2sr_!sID!msg.vbs"
  556.         endlocal
  557.         exit /b 1
  558.     )
  559. )
  560. if !currMode!==MOVE (
  561.     set mode=COPY
  562.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Mode" /d "!mode!" >>"%temp%\stderr.txt" 2>&1
  563.     if !errorlevel!==1 (
  564.         Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  565.         start "" "%temp%\a2sr_!sID!msg.vbs"
  566.         endlocal
  567.         exit /b 1
  568.     )
  569. )
  570. goto :menu
  571. :menu.updates
  572. if !currIgnore!==UNDEFINED (
  573.     set ignore=0
  574.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Ignore" /d "!ignore!" >>"%temp%\stderr.txt" 2>&1
  575.     if !errorlevel!==1 (
  576.         Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  577.         start "" "%temp%\a2sr_!sID!msg.vbs"
  578.         endlocal
  579.         exit /b 1
  580.     )
  581. )
  582. if !currIgnore!==FALSE (
  583.     set ignore=1
  584.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Ignore" /d "!ignore!" >>"%temp%\stderr.txt" 2>&1
  585.     if !errorlevel!==1 (
  586.         Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  587.         start "" "%temp%\a2sr_!sID!msg.vbs"
  588.         endlocal
  589.         exit /b 1
  590.     )
  591. )
  592. if !currIgnore!==TRUE (
  593.     set ignore=0
  594.     reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Ignore" /d "!ignore!" >>"%temp%\stderr.txt" 2>&1
  595.     if !errorlevel!==1 (
  596.         Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  597.         start "" "%temp%\a2sr_!sID!msg.vbs"
  598.         endlocal
  599.         exit /b 1
  600.     )
  601. )
  602. goto :menu
  603. :menu.codepage
  604. set /p newCodePage="New code page: "
  605. set preferredCodePage=!newCodePage!
  606. reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "CodePage" /d "!newCodePage!" >>"%temp%\stderr.txt" 2>&1
  607. if !errorlevel!==1 (
  608.     Echo x=msgbox^("An error occurred. Try running as administrator."^& vbcrlf ^&" "^& vbcrlf ^&"Information:"^& vbcrlf ^&"Access denied" ,48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  609.     start "" "%temp%\a2sr_!sID!msg.vbs"
  610.     endlocal
  611.     exit /b 1
  612. )
  613. goto :menu
  614. :playlist
  615. set playlist_cho=_
  616. if !debug!==0 cls
  617. ::call :colortext 33 "!UI_clearline!" & echo.
  618. ::call :colortext 3F "Playlist settings!UI_text_playlistSettings_suffix!" & echo.
  619. call :colortext 3F "  Playlist settings                                                                                                     " n
  620. call :colortext FC "________________________________________________________________________________________________________________________" n
  621. Echo.
  622. Echo   Active playlist: !activePlaylist!
  623. Echo.
  624. Echo   Available playlists:
  625. Echo.
  626. set _itemIndex=5
  627. for /f "skip=2 tokens=2*" %%A in ('reg query "HKCU\Software\FoddEx\Add to Self Radio" /v Playlists 2^>nul') do (
  628.     for %%C in (%%B) do (
  629.         if "%%~C"=="!activePlaylist!" (
  630.             call :colortext F2 "      !_itemIndex! --> %%~C     (ACTIVE)" n
  631.         ) else (
  632.             call :colortext F8 "      !_itemIndex! --> %%~C" n
  633.         )
  634.         set /a _itemIndex+=1
  635.     )
  636. )
  637. Echo.
  638. Echo   0 --^> Return
  639. Echo   1 --^> Create playlist
  640. Echo   2 --^> Edit playlist
  641. Echo   3 --^> Delete playlist
  642. Echo.
  643. set /p playlist_cho="  >> "
  644. if !playlist_cho!==0 (
  645.     goto :eof
  646. )
  647. if !playlist_cho!==1 (
  648.     goto playlist.create
  649. )
  650. if !playlist_cho!==2 (
  651.     goto playlist.edit
  652. )
  653. if !playlist_cho!==3 (
  654.     goto playlist.delete
  655. ) else (
  656.     goto playlist.change
  657. )
  658. goto playlist
  659. :playlist.change
  660. Echo.
  661. set enablePlaylist=!playlist_cho!
  662. set _itemIndexCounter=5
  663. for /f "skip=2 tokens=2*" %%A in ('reg query "HKCU\Software\FoddEx\Add to Self Radio" /v Playlists 2^>nul') do (
  664.     for %%C in (%%B) do (
  665.         if !_itemIndexCounter!==!enablePlaylist! (
  666.             set activePlaylist=%%~C
  667.             reg add "HKCU\Software\FoddEx\Add To Self Radio" /f /v "ActivePlaylist" /d "\"!activePlaylist!\"" > nul
  668.             goto playlist.change.break
  669.         ) else (
  670.             set /a _itemIndexCounter+=1
  671.         )
  672.     )
  673. )
  674. :playlist.change.break
  675. goto playlist
  676. :playlist.create
  677. set /p playlist_newPlaylist="  New playlist: "
  678. for /f "skip=2 tokens=2*" %%A in ('reg query "HKCU\Software\FoddEx\Add to Self Radio" /v Playlists 2^>nul') do (
  679.     set playlist_allPlaylists=\"!playList_newPlayList!\",%%B
  680. )
  681. reg add "HKCU\Software\FoddEx\Add to Self Radio" /f /v "Playlists" /d "!playList_allPlaylists!"
  682. set playList_allPlaylists=
  683. goto playlist
  684. :playlist.edit
  685. Echo.
  686. Echo   Enter song name:
  687. set /p playlist.edit_songName=">> "
  688. goto playlist
  689. :playlist.delete
  690. goto playlist
  691. :playlist.change.break
  692. goto playlist
  693. :setup.defaultPlaylist
  694. for /f "tokens=*" %%A in ('dir /B /S /A:-D "!userDir!\!musicDir!\*.mp3"') do (
  695.     set setup.defaultPlaylist_songPath=%%A
  696.     set setup.defaultPlaylist_song=!setup.defaultPlaylist_songPath:%userDir%\%musicDir%\=!
  697.     set setup.defaultPlaylist=\"!setup.defaultPlaylist_song!\",!setup.defaultPlaylist!
  698. )
  699. reg add "HKCU\Software\FoddEx\Add to Self Radio\Playlists" /f /v "Default" /d "!setup.defaultPlaylist!" > nul
  700. goto :eof
  701. :menu.restore
  702. cls
  703. set index=1
  704. for /f "skip=2 tokens=1,2,*" %%A in ('reg query "HKCU\Software\FoddEx\Add to Self Radio\Restore"') do (
  705.     if not "%%~nxC"=="" (
  706.         Echo !index! --^> %%~nxC
  707.         set "regindex!index!=%%A"
  708.         set "restoreIndex!index!=%%~C"
  709.         set /a index+=1
  710.     )
  711. )
  712. set /p select="Song number [0 to return]: "
  713. if "!select!"=="0" (
  714.     goto :menu
  715. )
  716. if "!restoreIndex%select%!"=="" (
  717.     Echo x=msgbox^("No file to restore was specified.",48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  718.     start "" "%temp%\a2sr_!sID!msg.vbs"
  719. ) else (
  720.     call :menu.restore1 "!restoreIndex%select%!"
  721. )
  722. goto :menu.restore
  723. :menu.restore1
  724. set restorefile=%~nx1
  725. set restorepath=%~dp1
  726. if not exist "!userDir!\!musicDir!\!restorefile!" (
  727.     Echo x=msgbox^("Couldn't find file '!restorefile!'",48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  728.     start "" "%temp%\a2sr_!sID!msg.vbs"
  729. ) else (
  730.     move "!userDir!\!musicDir!\!restorefile!" "!restorepath!"
  731.     if not exist "!restorepath!\!restorefile!" (
  732.         Echo x=msgbox^("Failed to restore file '!restorefile!'",48, "Error"^)>"%temp%\a2sr_!sID!msg.vbs"
  733.         start "" "%temp%\a2sr_!sID!msg.vbs"
  734.     ) else (
  735.         Echo x=msgbox^("File '!restorefile!' has been restored to its original location." ^& vbcrlf ^& "^(!restorepath!^)",64, "Success"^)>"%temp%\a2sr_!sID!msg.vbs"
  736.         start "" "%temp%\a2sr_!sID!msg.vbs"
  737.         reg delete "HKCU\Software\FoddEx\Add to Self Radio\Restore" /f /v "!regindex%select%!" > nul 2>&1
  738.     )
  739. )
  740. goto :eof
  741. :expUpdate
  742. chcp !forcedCodePage! > nul
  743. REM -----> Check if updates should be ignored or not
  744. if not !ENABLE_EXPERIMENTAL_UPDATES!==1 goto :checkUpdate
  745. for /f "skip=2 tokens=3*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "Ignore" 2^>nul') do (
  746.     set ignoreUpdates=%%A
  747. )
  748. if !ignoreUpdates!==0 (
  749.     if !UIinit!==0 call :UI_initialize 120 34 150 34
  750.     cls
  751.     Echo.
  752.     Echo Looking for updates...
  753.     REM -----> Check internet connection
  754.     ping google.com -n 1 -w 1000 > nul
  755.     if !errorlevel!==1 (
  756.         goto end0
  757.     )
  758.     REM -----> Download version info
  759.     powershell -Command "& {Invoke-WebRequest "http://wearegoth.altervista.org/kaspercoding/a2sr/Expversion.txt" -OutFile "%temp%\a2srEVersion.txt";}">nul
  760.     for /f "tokens=1-4 delims=." %%A in (%temp%\a2srEVersion.txt) do (
  761.         set newVersion=%%A.%%B.%%C
  762.         set newSubver=%%D
  763.         REM -----> Match downloaded version info with local version info
  764.         for /f "tokens=1-3 delims=." %%E in ("!version!") do (
  765.             if %%A GTR %%E (
  766.                 goto expUpdate1
  767.             ) else (
  768.                 if %%B GTR %%F (
  769.                     goto expUpdate1
  770.                 ) else (
  771.                     if %%C GTR %%G (
  772.                         goto expUpdate1
  773.                     ) else (
  774.                         if %%D GTR !subver! (
  775.                             goto :expUpdate1
  776.                         )
  777.                     )
  778.                 )
  779.             )
  780.             goto :checkUpdate
  781.         )
  782.     )
  783. )
  784. goto :eof
  785. :expUpdate1
  786. REM -----> Download patch notes and parse into a VBScript message
  787. powershell -Command "& {Invoke-WebRequest "http://wearegoth.altervista.org/kaspercoding/a2sr/Expnotes.txt" -OutFile "%temp%\a2srENotes.txt";}">nul
  788. set vbMessage=x=msgbox^("An experimental update is available."^& vbcrlf ^&" "^& vbcrlf ^&"Your version: v!version!, BETA !subver!"^& vbcrlf ^&"New version: v!newVersion!, BETA !newSubver!"^& vbcrlf ^&" "^& vbcrlf ^&"Key features:"
  789. for /f "tokens=*" %%A in (%temp%\a2srENotes.txt) do (
  790.     set input=%%A
  791.     set input=!input:"='!
  792.     set vbMessage=!vbMessage!^& vbcrlf ^&" "^& vbcrlf ^&"%%A"
  793. )
  794. set vbMessage=!vbMessage!^& vbcrlf ^& vbcrlf ^&"Click 'Yes' to start the download",vbYesNo + vbInformation,"Add to Self Radio"^)
  795. REM -----> Create VBScript notification
  796. (
  797.     echo Set objShell = CreateObject^("Wscript.Shell"^)
  798.     echo !vbMessage!
  799.     echo If x = vbYes Then
  800.     echo     objShell.Run^("http://wearegoth.altervista.org/kaspercoding/a2sr/SelfRadioAdd.exp.bat"^)
  801.     echo Else
  802.     echo     Wscript.Quit
  803.     echo End If
  804. )>"%temp%\a2sr_!sID!msg.vbs"
  805. start "" "%temp%\a2sr_!sID!msg.vbs"
  806. goto :checkUpdate
  807. :end
  808. goto expUpdate
  809. :checkUpdate
  810. chcp !forcedCodePage! > nul
  811. REM -----> Check if updates should be ignored or not
  812. for /f "skip=2 tokens=3*" %%A in ('reg query "HKCU\Software\FoddEx\Add To Self Radio" /v "Ignore" 2^>nul') do (
  813.     set ignoreUpdates=%%A
  814. )
  815. if not "!ignoreUpdates!"=="1" (
  816.     if not !ENABLE_EXPERIMENTAL_UPDATES!==1 (
  817.         if !UIinit!==0 call :UI_initialize 120 34 150 34
  818.         cls
  819.         Echo.
  820.         Echo Looking for updates...
  821.     )
  822.     REM -----> Check internet connection
  823.     ping google.com -n 1 -w 1000 > nul
  824.     if !errorlevel!==1 (
  825.         goto end0
  826.     )
  827.     REM -----> Download version info
  828.     powershell -Command "& {Invoke-WebRequest "http://wearegoth.altervista.org/kaspercoding/a2sr/version.txt" -OutFile "%temp%\a2srVersion.txt";}">nul
  829.     for /f "tokens=1-3 delims=." %%A in (%temp%\a2srVersion.txt) do (
  830.         set newVersion=%%A.%%B.%%C
  831.         REM -----> Match downloaded version info with local version info
  832.         for /f "tokens=1-3 delims=." %%D in ("!version!") do (
  833.             if %%A GTR %%D (
  834.                 goto :checkUpdate1
  835.             ) else (
  836.                 if %%B GTR %%E (
  837.                     goto :checkUpdate1
  838.                 ) else (
  839.                     if %%C GTR %%E (
  840.                         goto checkUpdate1
  841.                     )
  842.                 )
  843.             )
  844.             goto :eof
  845.         )
  846.     )
  847. )
  848. goto :eof
  849. :checkUpdate1
  850. REM -----> Download patch notes and parse into a VBScript message
  851. powershell -Command "& {Invoke-WebRequest "http://wearegoth.altervista.org/kaspercoding/a2sr/notes.txt" -OutFile "%temp%\a2srNotes.txt";}">nul
  852. set vbMessage=x=msgbox^("An update is available."^& vbcrlf ^&" "^& vbcrlf ^&"Your version: v!version!"^& vbcrlf ^&"New version: v!newVersion!"^& vbcrlf ^&" "^& vbcrlf ^&"Key features:" ^& vbcrlf
  853. for /f "tokens=*" %%A in (%temp%\a2srNotes.txt) do (
  854.     set input=%%A
  855.     set input=!input:"='!
  856.     set vbMessage=!vbMessage!^& vbcrlf ^& vbcrlf ^&"!input!"
  857. )
  858. set vbMessage=!vbMessage!^& vbcrlf ^&" "^& vbcrlf ^&"Click 'Yes' to go to the GTA5-Mods.com download page",vbYesNo + vbInformation,"Add to Self Radio"^)
  859. REM -----> Create VBScript notification
  860. (
  861.     echo Set objShell = CreateObject^("Wscript.Shell"^)
  862.     echo !vbMessage!
  863.     echo If x = vbYes Then
  864.     echo     objShell.Run^("https://www.gta5-mods.com/tools/add-to-self-radio"^)
  865.     echo Else
  866.     echo     Wscript.Quit
  867.     echo End If
  868. )>"%temp%\a2sr_!sID!msg.vbs"
  869. start "" "%temp%\a2sr_!sID!msg.vbs"
  870. goto :eof
  871. :end0
  872. REM -----> Delete temporary files generated by the program
  873. del /q "%temp%\a2srNotes.txt" 2> nul
  874. del /q "%temp%\a2srVersion.txt" 2> nul
  875. del /q "%temp%\a2sr_!sID!msg.vbs" 2> nul
  876. del /q X 2> nul
  877. REM -----> Line below commented out for debugging purposes. Remove  "::" to enable deletion of error log (Will add an option in the settings in a future update)
  878. REM -----> del /q "%temp%\stderr.txt" > nul
  879. REM -----> Exit
  880. endlocal
  881. exit
  882. :writeUninstall
  883. (
  884.     echo @Echo off
  885.     echo cd /d "%%~dp0"
  886.     echo title  
  887.     echo color F0
  888.     echo :main
  889.     echo Echo    This will uninstall the selected components of Add to Self Radio.
  890.     echo Echo    Components may be selected after continuing.
  891.     echo Echo.
  892.     echo Echo    Your Self Radio music will not be affected.
  893.     echo Echo.
  894.     echo Echo    Continue? ^^^(Y/N^^^)
  895.     echo choice /c yn /n
  896.     echo if %%errorlevel%%==1 ^(
  897.     echo     goto :uninstall
  898.     echo ^) else ^(
  899.     echo     goto exit
  900.     echo ^)
  901.     echo :uninstall
  902.     echo echo.
  903.     echo Echo.
  904.     echo Echo    1 -^^^> Uninstall registry entries ^^^(For installing a new version^^^)
  905.     echo Echo    2 -^^^> Uninstall everything ^^^(All related files + registry entries^^^)
  906.     echo choice /c 12 /n
  907.     echo if %%errorlevel%%==1 ^(
  908.     echo    set uninstall=0
  909.     echo ^)
  910.     echo if %%errorlevel%%==2 ^(
  911.     echo    set uninstall=1
  912.     echo ^)
  913.     echo Echo    Extracting A2SR registry info...
  914.     echo for /f "eol=; skip=58 tokens=*" %%%%A in ^(%%~f0^) do ^(
  915.     echo     Echo %%%%A^>^>a2srUninstall.reg
  916.     echo     Echo        %%%%A
  917.     echo ^)
  918.     echo Echo.
  919.     echo Echo    Uninstalling registry entries...
  920.     echo a2srUninstall.reg
  921.     echo Echo   Deleting files...
  922.     echo Echo       FILE: a2srUninstall.reg
  923.     echo del /q a2srUninstall.reg
  924.     echo if %%uninstall%%==1 ^(
  925.     echo    Echo       DIR:  Tools
  926.     echo    rmdir /s /q Tools
  927.     echo    Echo       FILE: Readme.txt
  928.     echo    del /q Readme.txt
  929.     echo    Echo       FILE: SelfRadioAdd.bat
  930.     echo    del /q SelfRadioAdd.bat
  931.     echo    if exist X ^(
  932.     echo        Echo       FILE: X
  933.     echo        del /q X
  934.     echo    ^)
  935.     echo ^)
  936.     echo Echo    Uninstallation completed.
  937.     echo Echo    Press any key to exit uninstaller...
  938.     echo Echo    ^^^(The uninstaller will delete itself upon exit^^^)
  939.     echo pause ^> nul
  940.     echo cmd /c "timeout /t 1 /nobreak & del /q Uninstall.bat"
  941.     echo exit
  942.     echo.
  943.     echo ; REGISTRY ENTRIES
  944. )>Uninstall.bat
  945. goto :eof
  946. :onetimenotif
  947. for /f "skip=2 tokens=2*" %%A in ('reg query "HKCU\Software\FoddEx\Add to Self Radio" /v "1Timenotif" 2^>nul') do (
  948.     if "%%B"=="0" (
  949.         set vbMessage="Your feedback is very valuable to the further developent" ^& vbcrlf ^& "of this program." ^& vbcrlf  ^& "Would you like to leave a comment/rating on gta5-mods.com?" ^& vbcrlf ^& vbcrlf ^&"(This message will only appear once)" ^& vbcrlf,vbYesNo + vbQuestion,"A2SR -- First time notification"
  950.         (
  951.             echo Set objShell = CreateObject^("Wscript.Shell"^)
  952.             echo X=MsgBox^(!vbMessage!^)
  953.             echo objShell.RegWrite "HKCU\Software\FoddEx\Add to Self Radio\1Timenotif", "1", "REG_SZ"
  954.             echo If x = vbYes Then
  955.             echo     objShell.Run^("https://www.gta5-mods.com/tools/add-to-self-radio"^)
  956.             echo Else
  957.             echo     Wscript.Quit
  958.             echo End If
  959.         )>"%temp%\a2sr_1timemsg.vbs"
  960.         start "" "%temp%\a2sr_1timemsg.vbs"
  961.     )
  962. )
  963. goto :eof
  964. :colortext
  965. set "param=^%~2" !
  966. set "param=!param:"=\"!"
  967. findstr /p /A:%1 "." "!param!\..\X" nul
  968. <nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%"
  969. if /i "%~3"=="n" echo.
  970. goto :eof
  971. :strlen
  972. setlocal
  973. set input=%1
  974. set input=%input:"=%
  975. set "myString=%input%
  976. call :_strlen result myString
  977. set strlen_length=!result!
  978. goto :eof
  979. :_strlen
  980. (  
  981.     setlocal EnableDelayedExpansion
  982.     set "s=!%~2!#"
  983.     set "len=0"
  984.     for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
  985.         if "!s:~%%P,1!" NEQ "" (
  986.             set /a "len+=%%P"
  987.             set "s=!s:~%%P!"
  988.         )
  989.     )
  990. )
  991. (
  992.     endlocal
  993.     set "%~1=%len%"
  994.     exit /b
  995. )
Advertisement
RAW Paste Data Copied
Advertisement