Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Setup program for notepad v1.0.0
- -- You don't need to run this file more than once unless
- -- you want to reset notepad
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- -- Download all the required files from pastebin
- local function install()
- term.clear()
- term.setCursorPos(1, 1)
- print("Welcome to notepad setup! Press ENTER to install notepad or Q to quit.")
- while true do
- local event, key = os.pullEvent("key")
- if event == "key" and keys.getName(key) == "enter" then
- if fs.find("notepad.settings") then
- fs.delete("notepad.settings")
- end
- print("Downloading required APIs...")
- sleep(0.3)
- shell.run("pastebin get V33yuuVi button.lua")
- sleep(0.25)
- shell.run("pastebin get VwX6sfh9 text.lua")
- sleep(0.25)
- shell.run("pastebin get tcCFbCKC notepadsettings.lua")
- sleep(0.25)
- print("Done!")
- sleep(0.5)
- print("Downloading program files...")
- sleep(0.3)
- shell.run("pastebin get ApnY4GZt notepad.lua")
- sleep(0.25)
- shell.run("pastebin get TmjSVSRZ memos.lua")
- sleep(0.25)
- shell.run("pastebin get 1yQRqBVa settingsapp.lua")
- sleep(0.25)
- shell.run("pastebin get VsEazWKR startup.lua")
- sleep(0.25)
- print("Done!")
- sleep(0.5)
- print()
- term.setTextColor(colors.lightBlue)
- print("Installation completed succesfully! Press any key to reboot the computer.")
- while true do
- local event = os.pullEvent("key")
- if event == "key" then
- os.reboot()
- end
- end
- elseif event == "key" and keys.getName(key) == "q" then
- os.reboot()
- end
- end
- end
- -- Delete files if they already exist
- local function deleteFiles()
- if fs.exists("notepad.lua") then
- fs.delete("notepad.lua")
- end
- if fs.exists("startup.lua") then
- fs.delete("startup.lua")
- end
- if fs.exists("memos.lua") then
- fs.delete("memos.lua")
- end
- if fs.exists("notepadsettings.lua") then
- fs.delete("notepadsettings.lua")
- end
- if fs.exists("settingsapp.lua") then
- fs.delete("settingsapp.lua")
- end
- if fs.exists("button.lua") then
- fs.delete("button.lua")
- end
- if fs.exists("text.lua") then
- fs.delete("text.lua")
- end
- if fs.exists("notepad.settings") then
- fs.delete("notepad.settings")
- end
- end
- -- Reinstall the program if it's already installed
- local function reInstall()
- term.clear()
- term.setCursorPos(1, 1)
- print("Installation detected! Do you want to reinstall notepad?")
- term.setTextColor(colors.orange)
- print("WARNING! All settings will be resetted!")
- term.setTextColor(colors.white)
- print("Press ENTER to continue or Q to quit.")
- while true do
- local event, key = os.pullEvent("key")
- if event == "key" and keys.getName(key) == "enter" then
- deleteFiles()
- install()
- elseif event == "key" and keys.getName(key) == "q" then
- os.reboot()
- end
- end
- end
- -- Check if the program is already installed
- local function isAlreadyInstalled()
- if fs.exists("notepad.lua") or
- fs.exists("settingsapp.lua") or
- fs.exists("notepadsettings.lua") then
- return true
- end
- return false
- end
- -- Check if this is a pocket computer
- if not pocket then
- term.setCursorPos(1, 1)
- term.setTextColor(colors.orange)
- print("Notepad is not compatible with this computer! It can only be installed in pocket computers!")
- return
- end
- if isAlreadyInstalled() then
- reInstall()
- else
- install()
- end
Advertisement
Add Comment
Please, Sign In to add comment