private static ResourceFile createNewScript(String scriptName, String extension,
			ResourceFile parentDirctory, List<ResourceFile> scriptDirectories) throws IOException {
		String baseName = scriptName;
		String className = baseName + extension;

		// we want to pick a name that is unique in *any* of the script directories
		int counter = 1;
		boolean exists = findScriptFileInPaths(scriptDirectories, className) != null;
		while (exists) {
			baseName = scriptName + counter++;
			className = baseName + extension;
			exists = findScriptFileInPaths(scriptDirectories, className) != null;
			if (counter > 1000) {
				throw new IOException(
					"Unable to create new script file, temporary files exceeded.");
			}
		}

		return new ResourceFile(parentDirctory, className);
	}
Creates a new script with a unique name using the specified provider in the 
specified directory.
@param provider   the Ghidra script provider
@param parentDirectory  the directory where the new script will be created.
@param scriptDirectories The list of directories containing scripts (used to find a 
       unique name).
@return the newly created script file
@throws IOException if an i/o error occurs
Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScriptUtil.java