["12. Example Implementation One Instance Launching"] # Example Implementation One Instance Launching This is an example extract from the NotepadA for one instance launching under the floatWindow environment. ``` ao_module_setWindowTitle("NotepadA Initializing..."); **var** instances = ao_module_getProcessID("NotepadA"); **var** filepath = {filepath to be opened}; **var** filename = {display filename}; remove(instances,ao_module_windowID); *//Remove the hidden newWindow window that is used to launch Float Windows from FloatWindow.php* **if** (instances.includes("newWindow")){ remove(instances,"newWindow"); } *//Check if there are instances already initialized* **if** (instances.length == 0){ *//Open a new float window for the file* console.log("[NotepadA] Opening " + filepath + " in a new floatWindow"); window.location.href = "index.php?filename=" + filename + "&filepath=" + filepath; }**else** **if** (instances.length > 0){ *//Open the new page in the first instances in list* **var** targetWindow = instances[0]; console.log("[NotepadA] Opening " + filepath + " in floatWindow " + targetWindow); parent.crossFrameFunctionCall(targetWindow,"newEditor('" + filepath + "');"); *//The newEditor is a function in the main window that used to open a new file.* ao_module_close(); } **function** **remove**(array, element) { **const** index = array.indexOf(element); array.splice(index, 1); } ```