It's happened to all of us. You open up a background script, then make changes while you try and debug it. And then you accidentally refresh the page and lose the entire thing..
Sometimes this means losing an hour or more of time. Luckily, there's a way to go find that script you were writing!
Navigate to the Script Execution Histories table by entering "sys_script_execution_history.list" in your Application Navigator and then clicking enter.
Depending on how big of an instance you're working in, you'll need to apply filters to the list in order to locate your script.
The quickest way is to enter part of your script using the * wildcard in the 'Script' column. The caveat here is obviously that you may not remember a part of your script. In that case, just filter the 'Executed by' column to yourself and then find the script in that list.
Once you've located your script, there's nothing left to do. Load it back up into a background script, or use it for whatever else you needed.