Advertisement
IxCreativeXL

Item Manager (FIXED & UPDATED)

Mar 18th, 2021
1,372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.97 KB | None | 0 0
  1. @echo off
  2.  
  3. :: This is a fixed version of Item Manager. The prompts that are given a file name instead of the provided options
  4. :: used to crash Item Manager. This was fixed, and now crashing from inputing file names is pretty much non existant.
  5. :: I also made it so that the option of examining items happens when you input a file name in the :d flag.
  6.  
  7. :: If the folder that will contain all the lists doesnt exist, then it will create one for you.
  8. if not exist ItemManagerLists mkdir ItemManagerLists
  9. cd ItemManagerLists
  10. title Item Manager
  11. echo Welcome to Item Manager.
  12. set directory=nil
  13. goto c
  14.  
  15. :d
  16. set act=nul
  17. set act2=nul
  18. set itemname=nul
  19. set itemdesc=none
  20. set routing=nul
  21. set switchto=nul
  22. set filename=nul
  23. set todel=nul
  24.  
  25. :: The root prompt for each list.
  26. echo.
  27. echo Select an action (a: view items, b: manage items, c: manage lists)
  28. set /p act=[%USERNAME% - %directory%]:
  29. set act=%act: =_%
  30. if exist %act% goto examine
  31. if %act% == a goto a
  32. if %act% == b goto b
  33. if %act% == c goto c
  34. goto d
  35.  
  36. :: Echo all items in the current list.
  37. :a
  38. echo.
  39. echo Items:
  40. call dir /b
  41. goto d
  42.  
  43. :: Examine items further, like their descriptions.
  44. :examine
  45. echo.
  46. echo Description:
  47. echo.
  48. type %act%
  49. goto d
  50.  
  51.  
  52. :: Item Modification prompt, allowing you to configure the contents of the list.
  53. :b
  54. echo.
  55. echo Do you want to... (1: add/update item, 2: delete item, 3: reset list)
  56. set /p act2=[%USERNAME% - %directory%]:
  57. if exist %act2% goto d
  58. if %act2% == 1 goto ba
  59. if %act2% == 2 goto bd
  60. if %act2% == 3 goto br
  61. goto d
  62. :: Add/Update Item Prompt
  63. :ba
  64. echo.
  65. echo Input item name (space = _).
  66. set /p itemname=[%USERNAME% - %directory%]:
  67. set itemname=%itemname: =_%
  68. if exist %itemname% goto alreadyexist
  69. if %itemname% == y goto namereserved
  70. if %itemname% == n goto namereserved
  71. if %itemname% == 1 goto namereserved
  72. if %itemname% == 2 goto namereserved
  73. if %itemname% == 3 goto namereserved
  74. if %itemname% == a goto namereserved
  75. if %itemname% == b goto namereserved
  76. if %itemname% == c goto namereserved
  77. if %itemname% == d goto namereserved
  78. if %itemname% == nul goto d
  79. echo.
  80. echo Input item description.
  81. set /p itemdesc=[%USERNAME% - %directory%]:
  82. echo.
  83. if exist %itemname% goto bap
  84. :: Creating an Item.
  85. :baa
  86. call echo %itemdesc% > %itemname%
  87. echo Successfully created item %itemname%.
  88. goto d
  89. :: Appending description to an item.
  90. :bap
  91. echo Append description to %itemname%? (y/n)
  92. set /p append=[%USERNAME% - %directory%]:
  93. if not %append% == y goto d
  94. call echo %itemdesc% >> %itemname%
  95. echo Successfully appended a line to %itemname%.
  96. goto d
  97. :: Delete Item prompt
  98. :bd
  99. echo.
  100. echo Input item to delete.
  101. set /p todel=[%USERNAME% - %directory%]:
  102. set todel=%todel: =_%
  103. if not exist %todel% goto d
  104. del %todel% /s >nul 2>&1
  105. echo Deleted item: %todel%.
  106. goto d
  107. :: Reset List prompt
  108. :br
  109. echo.
  110. echo Delete all items? This cannot be reverted (y/n).
  111. set /p verf=[%USERNAME% - %directory%]:
  112. if exist %verf% goto d
  113. if not %verf% == y goto d
  114. del * /s >nul 2>&1
  115. echo Reseted the item list.
  116. goto d
  117.  
  118.  
  119.  
  120. :c
  121. set act=none
  122. set act2=none
  123. set itemname=none
  124. set itemdesc=none
  125. set routing=none
  126. set switchto=none
  127. set filename=none
  128. set todel=none
  129.  
  130. :: This is the prompt given on start. It will allow you to configure lists, and delete in bulk.
  131. echo.
  132. echo Do you want to... (1: add new list, 2: switch lists, 3: delete list)
  133. set /p routing=[%USERNAME% - %directory%]:
  134. if exist %routing% goto c
  135. if %routing% == 1 goto ca
  136. if %routing% == 2 goto cs
  137. if %routing% == 3 goto cg
  138. goto c
  139.  
  140. :: Create List prompt
  141. :ca
  142. echo.
  143. echo Input the new list name.
  144. set /p filename=[%USERNAME% - %directory%]:
  145. set filename=%filename: =_%
  146. cd ..
  147. if exist ItemManagerLists cd ItemManagerLists
  148. if exist %filename% goto direxists
  149. if %filename% == ItemManagerLists goto reserved
  150. if %filename% == 1 goto reserved
  151. if %filename% == 2 goto reserved
  152. if %filename% == 3 goto reserved
  153. mkdir %filename%
  154. set directory=%filename%
  155. cd %directory%
  156. echo Created %filename%.
  157. goto d
  158. :: Switch Lists prompt
  159. :cs
  160. echo.
  161. echo Lists:
  162. echo.
  163. cd ..
  164. if exist ItemManagerLists cd ItemManagerLists
  165. call dir /b
  166. echo.
  167. echo Input the list to configure and view from.
  168. set /p switchto=[%USERNAME% - %directory%]:
  169. set switchto=%switchto: =_%
  170. if not exist %switchto% goto c
  171. set directory=%switchto%
  172. cd %switchto%
  173. echo Switched to %switchto%.
  174. goto d
  175. :: List Delete prompt
  176. :cg
  177. echo.
  178. echo Lists:
  179. echo.
  180. cd ..
  181. if exist ItemManagerLists cd ItemManagerLists
  182. call dir /b
  183. echo.
  184. echo Input the list to delete.
  185. set /p delist=[%USERNAME% - %directory%]:
  186. set delist=%delist: =_%
  187. if not exist %delist% goto c
  188. if %delist% == %directory% set directory=nil
  189. cd %delist%
  190. del * /p
  191. cd ..
  192. rmdir %delist% /Q /S
  193. echo Deleted list %delist%.
  194. goto c
  195.  
  196. :: Below here are some error echos to tell the user if their input is invalid.
  197. :alreadyexist
  198. echo That item name is in use.
  199. goto d
  200.  
  201. :reserved
  202. echo That is a reserved name.
  203. goto c
  204.  
  205. :direxists
  206. echo That list already exists.
  207. goto c
  208.  
  209. :namereserved
  210. echo That is a reserved name.
  211. goto d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement