@ECHO off SETLOCAL EnableDelayedExpansion :: Folder name Localizations (Vista/Win7 don't seem to have any) :: SET locals=4 ::English SET locals0XP=Local Settings\Application Data ::Italian SET locals1XP=Impostazioni locali\Dati applicazioni ::German SET locals2XP=Lokale Einstellungen\Anwendungsdaten ::Spanish SET locals3XP=Configuraci˘n local\Datos de programa ::Windows Vista/Win7 :: if exist "%USERPROFILE%\AppData\Local\Google\Chrome\" ( SET apploc=%USERPROFILE%\AppData\Local\Google\Chrome\Application SET extloc=%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default GOTO win ) SET clocal=0 :localslp :: Windows XP :: if exist "%USERPROFILE%\!locals%clocal%XP!\Google\Chrome\" ( SET apploc=%USERPROFILE%\!locals%clocal%XP!\Google\Chrome\Application SET extloc=%USERPROFILE%\!locals%clocal%XP!\Google\Chrome\User Data\Default GOTO win ) SET /A clocal=clocal+1 if /I %clocal% LSS %locals% GOTO localslp ECHO Chrome installation not found. PAUSE GOTO end :win if "%1" == "-run" GOTO run if NOT "%1" == "-kill" GOTO main SET ocd=%cd% CD %2 DEL /F /Q %3 CD "%ocd%" :main cls ECHO What would you like to do? ECHO 1) Enable a disabled extension ECHO 2) Disable an extension ECHO 3) Uninstall an extension ECHO 4) Create new extension ECHO 5) Pack a project ECHO 6) Test a project ECHO 7) Run Chrome ECHO 8) Run Chrome with extenions and user scripts by default ECHO 9) Run Chrome without extensions and user scripts by default ECHO 10) Quit if NOT "%cd%" == "%apploc%" ( if NOT "%~0" == "%apploc%\ExtensionManager.bat" ECHO 11^) Move Extension manager to Chome folder ) SET /P choice=? if "%choice%" == "1" GOTO enable if "%choice%" == "2" GOTO disable if "%choice%" == "3" GOTO uninstall if "%choice%" == "4" GOTO new if "%choice%" == "5" GOTO pack if "%choice%" == "6" GOTO testproj if "%choice%" == "7" GOTO run if "%choice%" == "8" GOTO setreg if "%choice%" == "9" GOTO restorereg if "%choice%" == "10" GOTO end if "%choice%" == "11" GOTO move GOTO main :listext SET index=2 ECHO 1) Go back FOR /D %%v IN ("%extloc%\%arg1%\*") DO ( SET isok=1 if "%arg1%" == "Extensions" ( if EXIST "%extloc%\Disabled\%%~nv" SET isok=0 ) FOR /F "usebackq" %%a IN ("%%v\Current Version") DO ( SET cextv!index!=%%a FOR /F "usebackq delims=: tokens=1,2" %%i IN ("%%v\%%a\manifest.json") DO ( SET ik=%%i SET ik=!ik: =! SET ik=!ik:"=! SET jk=%%j SET jk=!jk:"=! SET jk=!jk:~0,-1! if "!jk:~0,1!" == " " SET jk=!jk:~1! if "!ik!" == "key" SET cextk!index!=!jk! if "!ik!" == "theme" SET cextt!index!=1 if "!ik!" == "name" ( if !isok! == 1 ECHO !index!^) !jk! SET cexta!index!=!jk! ) SET cextn!index!=%%~nv ) ) if !isok! == 1 SET /A index=!index!+1 ) SET /P choice=? if "%choice%" == "1" GOTO main if not exist "%extloc%\%arg1%\!cextn%choice%!" GOTO %arg2% GOTO %ret% :enable cls if not exist "%extloc%\Disabled" ( ECHO There are no disabled extensions. PAUSE GOTO main ) ECHO Enable which extension? SET arg1=Disabled SET arg2=enable SET ret=enable2 GOTO listext :enable2 RMDIR /S /Q "%extloc%\Extensions\!cextn%choice%!\" move /Y "%extloc%\Disabled\!cextn%choice%!" "%extloc%\Extensions" GOTO enable :disable cls if not exist "%extloc%\Extensions" ( ECHO There are no extensions, make sure you have the dev version of Chrome installed. PAUSE GOTO main ) ECHO Disable which extension? SET arg1=Extensions SET arg2=disable SET ret=disable2 GOTO listext :disable2 if NOT exist "%extloc%\Disabled" mkdir "%extloc%\Disabled" move /Y "%extloc%\Extensions\!cextn%choice%!" "%extloc%\Disabled" ::Make Chrome stop complaining mkdir "%extloc%\Extensions\!cextn%choice%!\!cextv%choice%!" ::Copy minimal parts of the manifest SET mani="%extloc%\Extensions\!cextn%choice%!\!cextv%choice%!\manifest.json" COPY "%extloc%\Disabled\!cextn%choice%!\Current Version" "%extloc%\Extensions\!cextn%choice%!\" echo {>%mani% if "!cextt%choice%!" == "1" ( echo "theme": {>>%mani% echo "images": {>>%mani% echo }>>%mani% echo },>>%mani% ) echo "name": "!cexta%choice%!",>>%mani% echo "version": "!cextv%choice%!",>>%mani% echo "key": "!cextk%choice%!">>%mani% echo }>>%mani% GOTO disable :uninstall cls if not exist "%extloc%\Extensions" ( ECHO There are no extensions, make sure you have the dev version of Chrome installed. PAUSE GOTO main ) ECHO This must be done in chrome now. START "" "%apploc%\chrome.exe" --enable-extensions --enable-user-scripts -- "chrome://extensions/" PAUSE goto main :setreg ::ECHO @ECHO off>"%apploc%\chrome.bat" ::ECHO SET hai=>>"%apploc%\chrome.bat" ::ECHO if NOT "%%~1" == "" SET hai= -- "%%~1">>"%apploc%\chrome.bat" ::ECHO START "" "%apploc%\chrome.exe" --enable-extensions%%hai%%>>"%apploc%\chrome.bat" REG ADD HKCR\ChromeHTML\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" --enable-extensions --enable-user-scripts -- \"%%1\"" /f REG ADD HKCR\http\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" --enable-extensions --enable-user-scripts -- \"%%1\"" /f REG ADD HKCR\https\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" --enable-extensions --enable-user-scripts -- \"%%1\"" /f REG ADD HKCR\ftp\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" --enable-extensions --enable-user-scripts -- \"%%1\"" /f REG ADD HKCU\Software\Clients\StartMenuInternet /ve /t REG_SZ /d "Google Chrome" /f REG ADD HKLM\Software\Clients\StartMenuInternet /ve /t REG_SZ /d "Google Chrome" /f REG ADD "HKLM\Software\Clients\StartMenuInternet\Google Chrome\shell\open\command" /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" --enable-extensions --enable-user-scripts" /f REG ADD HKCR\ChromeExt\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" --install-extension=\"%%1\" --enable-extensions --enable-user-scripts" /f PAUSE GOTO main :restorereg ::DEL "%apploc%\chrome.bat" /f REG ADD HKCR\ChromeHTML\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" -- \"%%1\"" /f REG ADD HKCR\http\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" -- \"%%1\"" /f REG ADD HKCR\https\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" -- \"%%1\"" /f REG ADD HKCR\ftp\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" -- \"%%1\"" /f REG ADD HKCU\Software\Clients\StartMenuInternet /ve /t REG_SZ /d "Google Chrome" /f REG ADD HKLM\Software\Clients\StartMenuInternet /ve /t REG_SZ /d "Google Chrome" /f REG ADD HKLM\Software\Clients\StartMenuInternet\Google Chrome\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\"" /f REG ADD HKCR\ChromeExt\shell\open\command /ve /t REG_SZ /d "\"%apploc%\chrome.exe\" --install-extension=\"%%1\"" /f PAUSE GOTO main :move COPY /B "%~0" "%apploc%\ExtensionManager.bat" START "" "%apploc%\ExtensionManager.bat" -kill "%cd%" "%~0" GOTO end :new cls if not exist "%extloc%\Projects" mkdir "%extloc%\Projects" SET i=0 SET id= SET idc= :newLP SET tmp=%RANDOM% SET /A tmp=tmp %% 15 if "%tmp%" == "10" SET tmp=A if "%tmp%" == "11" SET tmp=B if "%tmp%" == "12" SET tmp=C if "%tmp%" == "13" SET tmp=D if "%tmp%" == "14" SET tmp=E if "%tmp%" == "15" SET tmp=F SET idc=%idc%%tmp% SET /A i=i+1 if /I %i% LSS 40 GOTO newLP :: START MANIFEST :: ::Set defaults:: SET format_version=1 ::idc SET version=0.1 SET newname= SET newdesc= SET content_scripts=0 ::content_scripts[idx][m/j/c/r][idx] SET background_page= SET toolstrips=0 ::toolstrips[idx] SET permissions=0 ::permissions[idx] SET imgfold= SET colors=0 ::colors[idx]n = name (like frame) ::colors[idx][r/g/b/a] SET tints=0 ::tints[idx]n = name (like frame) ::tints[idx][r/g/b] SET propbga= ::Get input SET currentcs=0 SET currentclr=0 SET currenttnt=0 SET saved=0 SET istheme=0 :manitop cls SET echoto= SET ret=manienter GOTO maniecho :manienter SET manic= if %istheme% == 0 SET /P manic=Current CS: %currentcs%^> if %istheme% == 1 SET /P manic=Color: !colors%currentclr%n! Tint: !tints%currenttnt%n!^> SET manic=%manic%"" (SET manic=%manic:"=%) if "%manic:~0,4%" == "help" ( cls echo Manifest editor v0.4 Commands ^(indexes are 0 based^); echo fv [ver] Set the manifest format version. echo ver [ver] Set the extenion's version. echo name [name] Set the extenion's name. echo desc [description] Set the extenion's description. echo bgp [filename] Set the extenion's background page. echo ts add [filename] Add a toolstrip file. echo ts del [index] Remove a toolstrip file by index. echo perm add [url] Add a XHR cross-domain permission. echo perm del [url] Remove a XHR cross-domain permission. echo cs new [match] Add a new content_script with match. echo cs del [index] Remove an entire content_script. You will lose all data echo inside it. echo cs sel [index] Select a content_script to edit. New entries are echo automatically selected. echo cs addm [match] Add another match to a content_script. echo cs delm [index] Remove a match from a content_script. MUST have at echo least one match. echo cs addj [file] Associate a javascript file with this match. echo cs delj [index] Remove a javascript file from this match. echo cs addc [file] Associate a css file with this match. echo cs delc [index] Remove a css file from this match. echo cs ra [run] Set the run_at for this match. ^(Leave blank to remove echo it.^) echo theme Make this extensions a theme. Cannot be undone. echo images [folder] When you save, all images from the given folder echo will be added to the extension folder and the manifest ammended. echo clr add [name] Adds the color field for name. Automatically selected. echo clr del [name] Deletes the color field for name. echo clr sel [name] Select name for editing. echo clr r [red] Set the red value for the selected color. echo clr g [green] Set the green value for the selected color. echo clr b [blue] Set the blue value for the selected color. echo clr a [alpha] Set the alpha value for the selected color. ^(Leave echo blank to remove.^) echo tnt add [name] Adds the tint field for name. Automatically selected. echo tnt del [name] Deletes the tint field for name. echo tnt sel [name] Select name for editing. echo tnt r [red] Set the red value for the selected tint. echo tnt g [green] Set the green value for the selected tint. echo tnt b [blue] Set the blue value for the selected tint. echo prop bgalign [side] Set ntp_background_align property. Takes top, left, echo right, or bottom. echo save Save the current manifest. This will create all echo associated files as well. echo quit Quit without saving. PAUSE GOTO manitop ) if "%manic:~0,2%" == "fv" ( SET saved=0 SET format_version=%manic:~3% GOTO manitop ) if "%manic:~0,3%" == "ver" ( SET saved=0 SET version=%manic:~4% GOTO manitop ) if "%manic:~0,4%" == "name" ( SET saved=0 SET newname=%manic:~5% GOTO manitop ) if "%manic:~0,4%" == "desc" ( SET saved=0 SET newdesc=%manic:~5% GOTO manitop ) if "%manic:~0,3%" == "bgp" ( SET saved=0 SET tmp=%manic:~4% if NOT !tmp:~-5! == ".html" SET tmp=!tmp!.html SET background_page=!tmp! GOTO manitop ) if "%manic:~0,6%" == "ts add" ( SET saved=0 SET tmp=%manic:~7% if NOT !tmp:~-5! == ".html" SET tmp=!tmp!.html SET toolstrips%toolstrips%=!tmp! SET /A toolstrips=toolstrips+1 GOTO manitop ) if "%manic:~0,6%" == "ts del" GOTO mani_tsdel if "%manic:~0,8%" == "perm add" ( SET saved=0 SET permissions%permissions%=%manic:~9% SET /A permissions=permissions+1 GOTO manitop ) if "%manic:~0,8%" == "perm del" GOTO mani_permdel if "%manic:~0,6%" == "cs new" ( SET saved=0 SET content_scripts%content_scripts%m=1 SET content_scripts%content_scripts%m0=%manic:~7% SET content_scripts%content_scripts%j=0 SET content_scripts%content_scripts%c=0 SET content_scripts%content_scripts%r= SET currentcs=%content_scripts% SET /A content_scripts=content_scripts+1 GOTO manitop ) if "%manic:~0,6%" == "cs sel" ( if "%manic:~7%" == "" GOTO manitop if DEFINED %manic:~7% GOTO manitop SET /A tmp=%manic:~7% if NOT DEFINED content_scripts!tmp! GOTO manitop SET currentcs=!tmp! GOTO manitop ) if "%manic:~0,7%" == "cs addm" ( SET saved=0 SET content_scripts%currentcs%m!content_scripts%currentcs%m!=%manic:~8% SET /A content_scripts%currentcs%m=content_scripts%currentcs%m+1 GOTO manitop ) if "%manic:~0,7%" == "cs delm" GOTO mani_csdelm if "%manic:~0,7%" == "cs addj" ( SET saved=0 SET tmp=%manic:~8% if NOT "!tmp:~-3!" == ".js" SET tmp=!tmp!.js SET content_scripts%currentcs%j!content_scripts%currentcs%j!=!tmp! SET /A content_scripts%currentcs%j=content_scripts%currentcs%j+1 GOTO manitop ) if "%manic:~0,7%" == "cs delj" GOTO mani_csdelj if "%manic:~0,7%" == "cs addc" ( SET saved=0 SET tmp=%manic:~8% if NOT "!tmp:~-4!" == ".css" SET tmp=!tmp!.css SET content_scripts%currentcs%c!content_scripts%currentcs%c!=!tmp! SET /A content_scripts%currentcs%c=content_scripts%currentcs%c+1 GOTO manitop ) if "%manic:~0,7%" == "cs delc" GOTO mani_csdelc if "%manic:~0,5%" == "cs ra" ( SET saved=0 SET tmp=%manic:~6% if "!tmp!" == "s" SET tmp=document_start if "!tmp!" == "st" SET tmp=document_start if "!tmp!" == "start" SET tmp=document_start if "!tmp!" == "e" SET tmp=document_end if "!tmp!" == "end" SET tmp=document_end SET content_scripts%currentcs%r=!tmp! GOTO manitop ) if "%manic:~0,6%" == "cs del" GOTO mani_csdel if "%manic:~0,5%" == "theme" ( SET saved=0 SET istheme=1 SET content_scripts=0 SET background_page= SET toolstrips=0 SET permissions=0 GOTO manitop ) if %istheme% == 0 GOTO mani_csave if "%manic:~0,6%" == "images" ( SET saved=0 SET imgfold=%manic:~7% GOTO manitop ) if "%manic:~0,7%" == "clr add" ( SET saved=0 SET /A tmp=colors-1 SET colors%colors%n=%manic:~8% SET colors%colors%r=0 SET colors%colors%g=0 SET colors%colors%b=0 SET colors%colors%a= SET currentclr=%colors% SET /A colors=colors+1 GOTO manitop ) SET /A tmp=colors-1 if NOT "%manic:~0,7%" == "clr del" GOTO mani_clrsel SET saved=0 FOR /L %%i IN (0,1,%tmp%) DO if "!colors%%in!" == "%manic:~8%" SET tmp2=%%i SET colors!tmp2!n=!colors%tmp%n! SET colors!tmp2!r=!colors%tmp%r! SET colors!tmp2!g=!colors%tmp%g! SET colors!tmp2!b=!colors%tmp%b! SET colors!tmp2!a=!colors%tmp%a! SET colors%tmp%n= SET colors%tmp%r= SET colors%tmp%g= SET colors%tmp%b= SET colors%tmp%a= SET /A colors=colors-1 if /I %currentclr% GEQ !colors! SET /A currentclr=!colors!-1 GOTO manitop :mani_clrsel if NOT "%manic:~0,7%" == "clr sel" GOTO mani_clrr FOR /L %%i IN (0,1,%tmp%) DO if "!colors%%in!" == "%manic:~8%" SET currentclr=%%i GOTO manitop :mani_clrr if "%manic:~0,5%" == "clr r" ( SET saved=0 if "%manic:~6%" == "" ( SET tmp=0 ) else (SET /A tmp=%manic:~6%) if /I !tmp! GTR 255 ( echo Maximum value is 255. PAUSE GOTO manitop ) SET colors%currentclr%r=!tmp! GOTO manitop ) if "%manic:~0,5%" == "clr g" ( SET saved=0 if "%manic:~6%" == "" ( SET tmp=0 ) else (SET /A tmp=%manic:~6%) if /I !tmp! GTR 255 ( echo Maximum value is 255. PAUSE GOTO manitop ) SET colors%currentclr%g=!tmp! GOTO manitop ) if "%manic:~0,5%" == "clr b" ( SET saved=0 if "%manic:~6%" == "" ( SET tmp=0 ) else (SET /A tmp=%manic:~6%) if /I !tmp! GTR 255 ( echo Maximum value is 255. PAUSE GOTO manitop ) SET colors%currentclr%b=!tmp! GOTO manitop ) if "%manic:~0,5%" == "clr a" ( SET saved=0 if "%manic:~6%" == "" ( SET colors%currentclr%a= GOTO manitop ) SET /A tmp=%manic:~6% if /I !tmp! GTR 255 ( echo Maximum value is 255. PAUSE GOTO manitop ) SET colors%currentclr%a=!tmp! GOTO manitop ) if NOT "%manic:~0,7%" == "tnt add" GOTO mani_tntdel SET saved=0 SET /A tmp=tints-1 FOR /L %%i IN (0,1,!tmp!) DO if "!tints%%in!" == "%manic:~8%" GOTO manitop SET tints%tints%n=%manic:~8% SET tints%tints%r=0.00 SET tints%tints%g=0.00 SET tints%tints%b=0.00 SET currenttnt=%tints% SET /A tints=tints+1 GOTO manitop :mani_tntdel SET /A tmp=tints-1 if NOT "%manic:~0,7%" == "tnt del" GOTO mani_tntsel SET saved=0 FOR /L %%i IN (0,1,%tmp%) DO if "!tints%%in!" == "%manic:~8%" SET tmp2=%%i SET tints!tmp2!n=!tints%tmp%n! SET tints!tmp2!r=!tints%tmp%r! SET tints!tmp2!g=!tints%tmp%g! SET tints!tmp2!b=!tints%tmp%b! SET tints%tmp%n= SET tints%tmp%r= SET tints%tmp%g= SET tints%tmp%b= SET /A tints=tints-1 if /I %currenttnt% GEQ !tints! SET /A currenttnt=!tints!-1 GOTO manitop :mani_tntsel if NOT "%manic:~0,7%" == "tnt sel" GOTO mani_tntr FOR /L %%i IN (0,1,%tmp%) DO if "!tints%%in!" == "%manic:~8%" SET currenttnt=%%i GOTO manitop :mani_tntr if "%manic:~0,5%" == "tnt r" ( SET saved=0 if "%manic:~6%" == "" ( SET tmp=0 SET tmp2=0 ) else ( SET /A tmp=%manic:~6,1% if "%manic:~8,2%" == "" ( SET tmp2=0 ) else (SET /A tmp2=%manic:~8,2%) ) if /I !tmp!!tmp2! GTR 10 ( echo Maximum value is 1.00 PAUSE GOTO manitop ) if /I !tmp2! LSS 10 SET tmp2=!tmp2!0 SET tints%currenttnt%r=!tmp!.!tmp2! GOTO manitop ) if "%manic:~0,5%" == "tnt g" ( SET saved=0 if "%manic:~6%" == "" ( SET tmp=0 SET tmp2=0 ) else ( SET /A tmp=%manic:~6,1% if "%manic:~8,2%" == "" ( SET tmp2=0 ) else (SET /A tmp2=%manic:~8,2%) ) if /I !tmp!!tmp2! GTR 10 ( echo Maximum value is 1.00 PAUSE GOTO manitop ) if /I !tmp2! LSS 10 SET tmp2=!tmp2!0 SET tints%currenttnt%g=!tmp!.!tmp2! GOTO manitop ) if "%manic:~0,5%" == "tnt b" ( SET saved=0 if "%manic:~6%" == "" ( SET tmp=0 SET tmp2=0 ) else ( SET /A tmp=%manic:~6,1% if "%manic:~8,2%" == "" ( SET tmp2=0 ) else (SET /A tmp2=%manic:~8,2%) ) if /I !tmp!!tmp2! GTR 10 ( echo Maximum value is 1.00 PAUSE GOTO manitop ) if /I !tmp2! LSS 10 SET tmp2=!tmp2!0 SET tints%currenttnt%b=!tmp!.!tmp2! GOTO manitop ) if "%manic:~0,12%" == "prop bgalign" ( SET saved=0 SET tmp=%manic:~13% if "!tmp!" == "t" SET tmp=top if "!tmp!" == "b" SET tmp=bottom if "!tmp!" == "l" SET tmp=left if "!tmp!" == "r" SET tmp=right SET propbga=!tmp! GOTO manitop ) :mani_csave if "%manic:~0,4%" == "save" ( SET saved=1 if NOT EXIST "%extloc%\Projects\%newname%" mkdir "%extloc%\Projects\%newname%" echo %version%>"%extloc%\Projects\%newname%\Current Version" if NOT EXIST "%extloc%\Projects\%newname%\%version%" mkdir "%extloc%\Projects\%newname%\%version%" if EXIST "%extloc%\Projects\%newname%\%version%\manifest.json" DEL "%extloc%\Projects\%newname%\%version%\manifest.json" SET echoto=^>^>"%extloc%\Projects\%newname%\%version%\manifest.json" SET ret=mani_save GOTO maniecho ) if "%manic:~0,4%" == "quit" ( if %saved% == 0 ( SET /P yn=Are you sure you want to quit without saving ^(y/n^) if NOT "!yn:y=Y!" == "Y" GOTO manienter ) GOTO mani_quit ) GOTO manienter :maniecho echo {%echoto% if %istheme% == 0 echo "format_version": %format_version%,%echoto% if %istheme% == 0 echo "id": "%idc%",%echoto% echo "version": "%version%",%echoto% echo "name": "%newname%",%echoto% if %istheme% == 1 GOTO mani_theme if /I %content_scripts% GTR 0 GOTO mani_cdesc if /I %toolstrips% GTR 0 GOTO mani_cdesc if /I %permissions% GTR 0 GOTO mani_cdesc if NOT "%background_page%" == "" GOTO mani_cdesc echo "description": "%newdesc%"%echoto% GOTO mani_ret :mani_theme echo "description": "%newdesc%",%echoto% echo "theme": {%echoto% if "%imgfold%" == "" GOTO mani_thcolor echo "images": {%echoto% if NOT "%ret%" == "mani_save" ( :: Can have 66 characters total without wrapping the line.. echo // %imgfold:~0,30%...%imgfold:~-33% ) else ( ::Might be slow, but I can't think of another way. D: FOR /R "%imgfold%" %%I IN (*) DO SET tmp=%%~nI :: Copy files here so we don't have to loop again later if NOT EXIST "%extloc%\Projects\%newname%\%version%\images" mkdir "%extloc%\Projects\%newname%\%version%\images" FOR /R "%imgfold%" %%I IN (*) DO ( (COPY /Y /B "%%I" "%extloc%\Projects\%newname%\%version%\images\")>NUL if "%%~nI" == "!tmp!" ( echo "%%~nI": "images/%%~nxI"%echoto% ) else ( echo "%%~nI": "images/%%~nxI",%echoto% ) ) ) SET cma= if /I %colors% GTR 0 SET cma=, if /I %tints% GTR 0 SET cma=, if NOT "%propbga%" == "" SET cma=, echo }%cma%%echoto% :mani_thcolor if %colors% == 0 GOTO mani_thtints echo "colors": {%echoto% SET /A tmp=colors-1 FOR /L %%i IN (0,1,%tmp%) DO ( SET tmp=[!colors%%ir!,!colors%%ig!,!colors%%ib! if NOT "!colors%%ia!" == "" SET tmp=!tmp!,!colors%%ia! if %%i == %tmp% ( SET tmp=!tmp!] ) else (SET tmp=!tmp!],) echo "!colors%%in!": !tmp!%echoto% ) if /I %tints% GTR 0 SET cma=, if NOT "%propbga%" == "" SET cma=, echo }%cma%%echoto% :mani_thtints if %tints% == 0 GOTO mani_thprops echo "tints": {%echoto% SET /A tmp=tints-1 FOR /L %%i IN (0,1,%tmp%) DO ( SET tmp=[!tints%%ir!,!tints%%ig!,!tints%%ib! if %%i == %tmp% ( SET tmp=!tmp!] )else (SET tmp=!tmp!],) echo "!tints%%in!": !tmp!%echoto% ) if NOT "%propbga%" == "" SET cma=, echo }%cma%%echoto% :mani_thprops if "%propbga%" == "" GOTO mani_thret echo "properties": {%echoto% if NOT "%propbga%" == "" echo "ntp_background_alignment": "%propbga%"%echoto% :mani_thret echo }%echoto% GOTO mani_ret :mani_cdesc echo "description": "%newdesc%",%echoto% if %content_scripts% == 0 GOTO mani_bgp ::Loop through content_scripts and display all echo "content_scripts": [%echoto% SET i=0 :mani_cslp echo { // Index %i% %echoto% SET j=0 SET tmpcs= :mani_csmlp SET tmpcs=%tmpcs%"!content_scripts%i%m%j%!", SET /A j=j+1 if /I %j% LSS !content_scripts%i%m! GOTO mani_csmlp SET tmpcs=%tmpcs:~0,-1% SET cma= if NOT !content_scripts%i%j! == 0 SET cma=, if NOT !content_scripts%i%c! == 0 SET cma=, if NOT "!content_scripts%i%r!" == "" SET cma=, echo "matches": [%tmpcs%]%cma%%echoto% if !content_scripts%i%j! == 0 GOTO mani_csc SET j=0 SET tmpcs= :mani_csjlp SET tmpcs=%tmpcs%"!content_scripts%i%j%j%!", SET /A j=j+1 if /I %j% LSS !content_scripts%i%j! GOTO mani_csjlp SET tmpcs=%tmpcs:~0,-1% SET cma= if NOT !content_scripts%i%c! == 0 SET cma=, if NOT "!content_scripts%i%r!" == "" SET cma=, echo "js": [%tmpcs%]%cma%%echoto% :mani_csc if !content_scripts%i%c! == 0 GOTO mani_csr SET j=0 SET tmpcs= :mani_csclp SET tmpcs=%tmpcs%"!content_scripts%i%c%j%!", SET /A j=j+1 if /I %j% LSS !content_scripts%i%c! GOTO mani_csclp SET tmpcs=%tmpcs:~0,-1% SET cma= if NOT "!content_scripts%i%r!" == "" SET cma=, echo "css": [%tmpcs%]%cma%%echoto% :mani_csr if NOT "!content_scripts%i%r!" == "" echo "run_at": "!content_scripts%i%r!"%echoto% :mani_csel SET /A i=i+1 if /I %i% LSS %content_scripts% ( echo },%echoto% GOTO mani_cslp ) echo }%echoto% SET cma= if /I %toolstrips% GTR 0 SET cma=, if /I %permissions% GTR 0 SET cma=, if NOT "%background_page%" == "" SET cma=, echo ]%cma%%echoto% :mani_bgp SET cma= if /I %toolstrips% GTR 0 SET cma=, if /I %permissions% GTR 0 SET cma=, if NOT "%background_page%" == "" echo "background_page": "%background_page%"%cma%%echoto% if %toolstrips% == 0 GOTO mani_perm SET i=0 SET tmpts= :mani_tslp SET tmpts=%tmpts%"!toolstrips%i%!", SET /A i=i+1 if /I %i% LSS %toolstrips% GOTO mani_tslp SET tmpts=%tmpts:~0,-1% SET cma= if /I %permissions% GTR 0 SET cma=, ECHO "toolstrips": [%tmpts%]%cma%%echoto% :mani_perm if %permissions% == 0 GOTO mani_ret SET i=0 SET tmpts= :mani_permlp SET tmpts=%tmpts%"!permissions%i%!", SET /A i=i+1 if /I %i% LSS %permissions% GOTO mani_permlp SET tmpts=%tmpts:~0,-1% ECHO "permissions": [%tmpts%]%echoto% :mani_ret echo }%echoto% GOTO %ret% :mani_save ::Loop through js, css, and html files and create them. if %content_scripts% == 0 GOTO mani_svbgp SET i=0 :mani_svcslp if !content_scripts%i%j! == 0 GOTO mani_svcscss SET j=0 :mani_svcsjslp SET tmp=!content_scripts%i%j%j%! echo //Extension: %newname%; File: %tmp%>"%extloc%\Projects\%newname%\%version%\%tmp%" echo var ext_id=self.chrome.extension.id_;>>"%extloc%\Projects\%newname%\%version%\%tmp%" SET /A j=j+1 if %j% LSS !content_scripts%i%j! GOTO mani_svcsjslp :mani_svcscss if !content_scripts%i%c! == 0 GOTO mani_svcsel SET j=0 :mani_svcscsslp SET tmp=!content_scripts%i%c%j%! echo /* Extension: %newname%; File: %tmp% */>"%extloc%\Projects\%newname%\%version%\%tmp%" SET /A j=j+1 if %j% LSS !content_scripts%i%c! GOTO mani_svcscsslp :mani_svcsel SET /A i=i+1 if /I %i% LSS %content_scripts% GOTO mani_svcslp :mani_svbgp if "%background_page%" == "" GOTO mani_svts SET arg1="%extloc%\Projects\%newname%\%version%\%background_page%" SET arg2=%background_page% SET ret=mani_svts GOTO echo_html :mani_svts if %toolstrips% == 0 GOTO mani_svdone SET i=0 :mani_svtslp SET arg1="%extloc%\Projects\%newname%\%version%\!toolstrips%i%!" SET arg2=!toolstrips%i%! SET ret=mani_sctssmidlp GOTO echo_html :mani_sctssmidlp SET /A i=i+1 if %i% LSS %toolstrips% GOTO mani_svtslp :mani_svdone echo Files created. PAUSE SET echoto= GOTO manitop :mani_quit ECHO Good luck PAUSE goto main :echo_html SETLOCAL DisableDelayedExpansion ECHO ^>%arg1% ECHO ^>>%arg1% ECHO ^