Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: This is a fixed version of Item Manager. The prompts that are given a file name instead of the provided options
- :: used to crash Item Manager. This was fixed, and now crashing from inputing file names is pretty much non existant.
- :: I also made it so that the option of examining items happens when you input a file name in the :d flag.
- :: If the folder that will contain all the lists doesnt exist, then it will create one for you.
- if not exist ItemManagerLists mkdir ItemManagerLists
- cd ItemManagerLists
- title Item Manager
- echo Welcome to Item Manager.
- set directory=nil
- goto c
- :d
- set act=nul
- set act2=nul
- set itemname=nul
- set itemdesc=none
- set routing=nul
- set switchto=nul
- set filename=nul
- set todel=nul
- :: The root prompt for each list.
- echo.
- echo Select an action (a: view items, b: manage items, c: manage lists)
- set /p act=[%USERNAME% - %directory%]:
- set act=%act: =_%
- if exist %act% goto examine
- if %act% == a goto a
- if %act% == b goto b
- if %act% == c goto c
- goto d
- :: Echo all items in the current list.
- :a
- echo.
- echo Items:
- call dir /b
- goto d
- :: Examine items further, like their descriptions.
- :examine
- echo.
- echo Description:
- echo.
- type %act%
- goto d
- :: Item Modification prompt, allowing you to configure the contents of the list.
- :b
- echo.
- echo Do you want to... (1: add/update item, 2: delete item, 3: reset list)
- set /p act2=[%USERNAME% - %directory%]:
- if exist %act2% goto d
- if %act2% == 1 goto ba
- if %act2% == 2 goto bd
- if %act2% == 3 goto br
- goto d
- :: Add/Update Item Prompt
- :ba
- echo.
- echo Input item name (space = _).
- set /p itemname=[%USERNAME% - %directory%]:
- set itemname=%itemname: =_%
- if exist %itemname% goto alreadyexist
- if %itemname% == y goto namereserved
- if %itemname% == n goto namereserved
- if %itemname% == 1 goto namereserved
- if %itemname% == 2 goto namereserved
- if %itemname% == 3 goto namereserved
- if %itemname% == a goto namereserved
- if %itemname% == b goto namereserved
- if %itemname% == c goto namereserved
- if %itemname% == d goto namereserved
- if %itemname% == nul goto d
- echo.
- echo Input item description.
- set /p itemdesc=[%USERNAME% - %directory%]:
- echo.
- if exist %itemname% goto bap
- :: Creating an Item.
- :baa
- call echo %itemdesc% > %itemname%
- echo Successfully created item %itemname%.
- goto d
- :: Appending description to an item.
- :bap
- echo Append description to %itemname%? (y/n)
- set /p append=[%USERNAME% - %directory%]:
- if not %append% == y goto d
- call echo %itemdesc% >> %itemname%
- echo Successfully appended a line to %itemname%.
- goto d
- :: Delete Item prompt
- :bd
- echo.
- echo Input item to delete.
- set /p todel=[%USERNAME% - %directory%]:
- set todel=%todel: =_%
- if not exist %todel% goto d
- del %todel% /s >nul 2>&1
- echo Deleted item: %todel%.
- goto d
- :: Reset List prompt
- :br
- echo.
- echo Delete all items? This cannot be reverted (y/n).
- set /p verf=[%USERNAME% - %directory%]:
- if exist %verf% goto d
- if not %verf% == y goto d
- del * /s >nul 2>&1
- echo Reseted the item list.
- goto d
- :c
- set act=none
- set act2=none
- set itemname=none
- set itemdesc=none
- set routing=none
- set switchto=none
- set filename=none
- set todel=none
- :: This is the prompt given on start. It will allow you to configure lists, and delete in bulk.
- echo.
- echo Do you want to... (1: add new list, 2: switch lists, 3: delete list)
- set /p routing=[%USERNAME% - %directory%]:
- if exist %routing% goto c
- if %routing% == 1 goto ca
- if %routing% == 2 goto cs
- if %routing% == 3 goto cg
- goto c
- :: Create List prompt
- :ca
- echo.
- echo Input the new list name.
- set /p filename=[%USERNAME% - %directory%]:
- set filename=%filename: =_%
- cd ..
- if exist ItemManagerLists cd ItemManagerLists
- if exist %filename% goto direxists
- if %filename% == ItemManagerLists goto reserved
- if %filename% == 1 goto reserved
- if %filename% == 2 goto reserved
- if %filename% == 3 goto reserved
- mkdir %filename%
- set directory=%filename%
- cd %directory%
- echo Created %filename%.
- goto d
- :: Switch Lists prompt
- :cs
- echo.
- echo Lists:
- echo.
- cd ..
- if exist ItemManagerLists cd ItemManagerLists
- call dir /b
- echo.
- echo Input the list to configure and view from.
- set /p switchto=[%USERNAME% - %directory%]:
- set switchto=%switchto: =_%
- if not exist %switchto% goto c
- set directory=%switchto%
- cd %switchto%
- echo Switched to %switchto%.
- goto d
- :: List Delete prompt
- :cg
- echo.
- echo Lists:
- echo.
- cd ..
- if exist ItemManagerLists cd ItemManagerLists
- call dir /b
- echo.
- echo Input the list to delete.
- set /p delist=[%USERNAME% - %directory%]:
- set delist=%delist: =_%
- if not exist %delist% goto c
- if %delist% == %directory% set directory=nil
- cd %delist%
- del * /p
- cd ..
- rmdir %delist% /Q /S
- echo Deleted list %delist%.
- goto c
- :: Below here are some error echos to tell the user if their input is invalid.
- :alreadyexist
- echo That item name is in use.
- goto d
- :reserved
- echo That is a reserved name.
- goto c
- :direxists
- echo That list already exists.
- goto c
- :namereserved
- echo That is a reserved name.
- goto d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement