_moelle

installbat

Oct 7th, 2024
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.51 KB | None | 0 0
  1. can you improve this script?
  2.  
  3. @echo off
  4. setlocal enabledelayedexpansion
  5.  
  6. for /f "delims=: tokens=*" %%A in ('findstr /b ::: "%~f0"') do @echo(%%A
  7.  
  8. echo.
  9. echo.
  10. echo INSTALL SCRIPT: MOELLES MOJO / GG TEMPLATE ADDON FOR ADOBE AFTER EFFECTS
  11. :::
  12. :::
  13. ::: @@@@@@@%
  14. ::: =@@* @@@ .@@@@@@@=
  15. ::: *@@@@- @@ %@@@. @@@
  16. ::: @@@@. +@@@: . @@ @@-
  17. ::: +@@ @@@@@@@@@ @@ @@
  18. ::: =@= #@ -@@@ -*%*: @
  19. ::: *@ @+ @@@@@@%#%@@@@ @@@@@@@.
  20. ::: @@@@@@@@@@@- @* @= *@@@: =@@=
  21. ::: @@@# *@@@ *@ #@ =# :@.
  22. ::: @@. :@@@@ @@ @@@@@@@@@@@@ +@
  23. ::: @@ %# @@. @@@ @@@@@
  24. ::: @@ :@@@@@@@@- @@ %@@ @@+
  25. ::: @@ .@@. @@@@@@@@@@% -@@ #@*
  26. ::: @@ @@: @@@. @@@@@ @@
  27. ::: @@ @# @@ .@@ @@
  28. ::: .@@ +@ @@ %@ @@
  29. ::: @@ .@+ @@ :@@. :@@
  30. ::: @@@* =@ @ @@@ @@: .@@
  31. ::: .@@@@@@@@@@ @@@# #@ @@@ @@@
  32. ::: #@@@@@@@@@ @@@@@@@# @@@@- *@@@@
  33. ::: :+:@@ @@@@@@@%
  34. ::: @@# @@*
  35. ::: @@@@@@@
  36. :::
  37. :::
  38. echo.
  39. echo.
  40. echo # FIRST STEP: INSTALL MOJO SCRIPT
  41. timeout /t 3 > nul
  42.  
  43.  
  44. :: Set the paths for AE template
  45. set "aeSourceFolder=%~dp0_BOILERPLATES"
  46. set "fontSourceFolder=%~dp0_FONTS"
  47. set "aeDestinationFolder=C:\data_driven_ae_template-1"
  48. set "footagePath=C:\data_driven_ae_template-1\(Footage)\Footage"
  49. set "assetsPath=C:\data_driven_ae_template-1\_assets"
  50. set "aeFileName=___boilerplate_24.aep"
  51. set "fullAeSourcePath=%aeSourceFolder%\%aeFileName%"
  52. set "fullAeDestinationPath=%aeDestinationFolder%\%aeFileName%"
  53. set "aeFootageFolder=(Footage)"
  54. set "aeAssetsFolder=_assets"
  55. set "fullAeFootageSource=%aeSourceFolder%\%aeFootageFolder%"
  56. set "fullAeFootageDestination=%aeDestinationFolder%\%aeFootageFolder%"
  57. set "fullAeAssetsSource=%aeSourceFolder%\%aeAssetsFolder%"
  58. set "fullAeAssetsDestination=%aeDestinationFolder%\%aeAssetsFolder%"
  59. set "fullFontsSource=%fontSourceFolder%"
  60. set "fullFontsDestination=%aeDestinationFolder%\_FONTS"
  61.  
  62. set "presetPath23=%USERPROFILE%\Documents\Adobe\After Effects 2023\User Presets\mojo"
  63. set "presetPath24=%USERPROFILE%\Documents\Adobe\After Effects 2024\User Presets\mojo"
  64.  
  65. if exist "%presetPath23%" (
  66. rmdir /s /q "%presetPath23%"
  67. echo Preset Folder 23 removed successfully.
  68. )
  69.  
  70. if exist "%presetPath24%" (
  71. rmdir /s /q "%presetPath24%"
  72. echo Preset Folder 24 removed successfully.
  73. )
  74.  
  75. :: DELETE OLD FOOTAGES AND ASSETS
  76. rd /s /q "%footagePath%"
  77. rd /s /q "%assetsPath%"
  78.  
  79. :: DELETE OLD FONTS
  80. if exist "%fullFontsDestination%" (
  81. rmdir /s /q "%fullFontsDestination%"
  82. timeout /t 2 > nul
  83. )
  84.  
  85. :: Check if the destination folder for AE exists, create it if not
  86. if not exist "%aeDestinationFolder%" (
  87. mkdir "%aeDestinationFolder%"
  88. )
  89. :: Copy the AE file with silent overwrite
  90. copy /y "%fullAeSourcePath%" "%fullAeDestinationPath%" >nul
  91.  
  92. :: Copy the "(Footage)" folder and its contents for AE with quiet mode using robocopy
  93. robocopy "%fullAeFootageSource%" "%fullAeFootageDestination%" /s /e /np /njh /njs /ndl /nc /ns /nc /ndl /np /nfl /ndl /mt:8 >nul
  94. robocopy "%fullAeAssetsSource%" "%fullAeAssetsDestination%" /s /e /np /njh /njs /ndl /nc /ns /nc /ndl /np /nfl /ndl /mt:8 >nul
  95. :: Copy the "_FONTS" folder and its contents for AE with quiet mode using robocopy
  96. robocopy "%fullFontsSource%" "%fullFontsDestination%" /s /e /np /njh /njs /ndl /nc /ns /nc /ndl /np /nfl /ndl /mt:8 >nul
  97.  
  98. :: Set the paths for ScriptUI Panel
  99. set "scriptSearchDir=%APPDATA%\Adobe\After Effects"
  100. set "scriptTargetFolder=Scripts\ScriptUI Panels"
  101. set "scriptSearchString=moelles_mojo"
  102. set "scriptSourceFile=moelles_mojo.jsxbin"
  103. set "scriptSourceFolder=_scripts"
  104. set "imgSourceFolder=_img"
  105. set "rootFolder=%~dp0"
  106. :: Assuming the script is one level above the "_BUILDS" folder
  107. set "buildsFolder=%~dp0_BUILDS"
  108. set "delfolder=%APPDATA%\Adobe\After Effects\Scripts"
  109.  
  110. set "BASE_PATH=%APPDATA%\Adobe\After Effects"
  111. set "FOLDER_STRUCTURE1=22.6.5\Scripts\ScriptUI Panels"
  112. set "FOLDER_STRUCTURE2=23.0\Scripts\ScriptUI Panels"
  113. set "FOLDER_STRUCTURE3=23.1\Scripts\ScriptUI Panels"
  114. set "FOLDER_STRUCTURE4=23.2\Scripts\ScriptUI Panels"
  115. set "FOLDER_STRUCTURE5=23.3\Scripts\ScriptUI Panels"
  116. set "FOLDER_STRUCTURE6=23.4\Scripts\ScriptUI Panels"
  117. set "FOLDER_STRUCTURE7=23.5\Scripts\ScriptUI Panels"
  118. set "FOLDER_STRUCTURE8=23.6\Scripts\ScriptUI Panels"
  119. set "FOLDER_STRUCTURE9=23.6.6\Scripts\ScriptUI Panels"
  120. set "FOLDER_STRUCTURE10=24.0\Scripts\ScriptUI Panels"
  121. set "FOLDER_STRUCTURE11=24.1\Scripts\ScriptUI Panels"
  122. set "FOLDER_STRUCTURE12=24.2\Scripts\ScriptUI Panels"
  123. set "FOLDER_STRUCTURE13=24.3\Scripts\ScriptUI Panels"
  124. set "FOLDER_STRUCTURE14=24.4\Scripts\ScriptUI Panels"
  125. set "FOLDER_STRUCTURE15=24.4.1\Scripts\ScriptUI Panels"
  126. set "FOLDER_STRUCTURE16=24.5\Scripts\ScriptUI Panels"
  127. set "FOLDER_STRUCTURE17=24.6\Scripts\ScriptUI Panels"
  128. set "FOLDER_STRUCTURE18=24.7\Scripts\ScriptUI Panels"
  129. set "FOLDER_STRUCTURE19=24.8\Scripts\ScriptUI Panels"
  130. set "FOLDER_STRUCTURE20=24.9\Scripts\ScriptUI Panels"
  131.  
  132. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE1%\_scripts"
  133. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE2%\_scripts"
  134. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE3%\_scripts"
  135. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE4%\_scripts"
  136. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE5%\_scripts"
  137. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE6%\_scripts"
  138. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE7%\_scripts"
  139. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE8%\_scripts"
  140. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE9%\_scripts"
  141. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE10%\_scripts"
  142. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE11%\_scripts"
  143. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE12%\_scripts"
  144. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE13%\_scripts"
  145. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE14%\_scripts"
  146. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE15%\_scripts"
  147. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE16%\_scripts"
  148. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE17%\_scripts"
  149. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE18%\_scripts"
  150. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE19%\_scripts"
  151. rd /s /q "%BASE_PATH%\%FOLDER_STRUCTURE20%\_scripts"
  152.  
  153. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE1%" 2>nul
  154. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE2%" 2>nul
  155. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE3%" 2>nul
  156. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE4%" 2>nul
  157. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE5%" 2>nul
  158. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE6%" 2>nul
  159. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE7%" 2>nul
  160. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE8%" 2>nul
  161. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE9%" 2>nul
  162. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE10%" 2>nul
  163. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE11%" 2>nul
  164. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE12%" 2>nul
  165. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE13%" 2>nul
  166. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE14%" 2>nul
  167. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE15%" 2>nul
  168. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE16%" 2>nul
  169. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE17%" 2>nul
  170. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE18%" 2>nul
  171. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE19%" 2>nul
  172. mkdir "%BASE_PATH%\%FOLDER_STRUCTURE20%" 2>nul
  173.  
  174. :: Check if the target folder exists, create it if needed
  175. if not exist "%scriptSearchDir%\%scriptTargetFolder%" (
  176. mkdir "%scriptSearchDir%\%scriptTargetFolder%"
  177. )
  178.  
  179. for /d %%i in ("%scriptSearchDir%\*") do (
  180. if exist "%%i\%scriptTargetFolder%" (
  181.  
  182. :: Delete files containing the search string
  183. for %%f in ("%%i\%scriptTargetFolder%\*%scriptSearchString%*") do (
  184. del "%%f"
  185. )
  186.  
  187. :: Copy the specified file to the Script UI Path
  188. if exist "%buildsFolder%\%scriptSourceFile%" (
  189. copy /Y "%buildsFolder%\%scriptSourceFile%" "%%i\%scriptTargetFolder%" >nul
  190. )
  191.  
  192. :: Copy the specified folder and its contents to the Script UI Path
  193. if exist "%buildsFolder%\%scriptSourceFolder%" (
  194. xcopy /E /I /Y "%buildsFolder%\%scriptSourceFolder%" "%%i\%scriptTargetFolder%\%scriptSourceFolder%" >nul
  195. )
  196.  
  197. :: Copy the specified folder and its contents to the Script UI Path
  198. if exist "%buildsFolder%\%imgSourceFolder%" (
  199. xcopy /E /I /Y "%buildsFolder%\%imgSourceFolder%" "%%i\%scriptTargetFolder%\%imgSourceFolder%" >nul
  200. )
  201. )
  202. )
  203. rd /s /q "%delfolder%"
  204. :: FONT INSTALL
  205. echo.
  206. echo.
  207. echo AE script INSTALLATION COMPLETE.
  208. echo.
  209. echo.
  210. echo.
  211. echo.
  212. echo # NEXT STEP: INSTALLING FONTS
  213. echo.
  214. echo Press any key within 5 seconds to start the fonts setup...
  215. timeout /t 5 /nobreak > nul
  216. if errorlevel 1 (
  217. @echo off
  218. ::PowerShell -NoProfile -File "%fullFontsDestination%\install_fonts.ps1" -Debug
  219. cscript "%fontSourceFolder%\InstallFont.vbs"
  220. echo.
  221. echo.
  222. echo FONT INSTALLATION COMPLETE.
  223. echo.
  224. echo.
  225. ) else (
  226. echo.
  227. echo FONT SETUP SKIPPED.
  228. echo.
  229. echo.
  230. )
  231. echo.
  232. echo.
  233. echo # NEXT STEP: DOWNLOAD AND INSTALL FFMPEG
  234. timeout /t 3 > nul
  235. setlocal
  236.  
  237. :: Define the target directory
  238. set "target_dir=C:\ffmpeg"
  239.  
  240. :: Check if the target directory already exists
  241. if exist "%target_dir%" (
  242. echo.
  243. echo FFmpeg is already installed at %target_dir%.
  244. echo.
  245. echo Aborting download process.
  246. echo.
  247. echo.
  248. echo.
  249. echo # FINAL STEP: OPEN TEMPLATE LOCATION
  250. echo.
  251. echo Press any key within 5 seconds to open the folder...
  252. timeout /t 5 /nobreak > nul
  253. if errorlevel 1 (
  254. echo Opening folder...
  255. explorer "C:\data_driven_ae_template-1"
  256. ) else (
  257. echo No key pressed, exiting.
  258. )
  259. exit /b 0
  260. )
  261.  
  262. :: Define the URL and temporary paths
  263. set "ffmpeg_url=https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip"
  264. set "zip_path=%TEMP%\ffmpeg.zip"
  265. set "extract_path=%TEMP%\ffmpeg"
  266.  
  267. :: Download FFmpeg using curl
  268. echo Downloading FFmpeg...
  269. curl -L -o "%zip_path%" "%ffmpeg_url%"
  270. if %ERRORLEVEL% neq 0 (
  271. echo Failed to download FFmpeg. Exiting...
  272. exit /b 1
  273. )
  274.  
  275. :: Extract the downloaded zip file (requires PowerShell for this)
  276. echo Extracting FFmpeg...
  277. powershell -command "Expand-Archive -Force -Path '%zip_path%' -DestinationPath '%extract_path%'"
  278. if %ERRORLEVEL% neq 0 (
  279. echo Failed to extract FFmpeg. Exiting...
  280. exit /b 1
  281. )
  282.  
  283. :: Move the extracted FFmpeg folder to C:\
  284. echo Moving FFmpeg to C:\
  285. move /Y "%extract_path%\ffmpeg-*" "%target_dir%"
  286. if %ERRORLEVEL% neq 0 (
  287. echo Failed to move FFmpeg. Exiting...
  288. exit /b 1
  289. )
  290.  
  291. :: Clean up the temp files
  292. echo Cleaning up...
  293. del /Q "%zip_path%"
  294. rmdir /S /Q "%extract_path%"
  295.  
  296. echo.
  297. echo.
  298. echo FFMPEG INSTALLATION COMPLETE.
  299. echo.
  300. echo.
  301. echo.
  302. echo # FINAL STEP: OPEN TEMPLATE LOCATION
  303. echo.
  304. echo Press any key within 5 seconds to open the folder...
  305. timeout /t 5 /nobreak > nul
  306. if errorlevel 1 (
  307. echo Opening folder...
  308. explorer "C:\data_driven_ae_template-1"
  309. ) else (
  310. echo No key pressed, exiting.
  311. )
  312. exit /b 0
  313. endlocal
Advertisement
Add Comment
Please, Sign In to add comment