~~Title: Close ~~ The **Close** command can be used to: * Close Listers (either the current Lister or all) * Collapse all open Listers to tabs in a single Lister * Exit Directory Opus altogether * Shutdown or restart the system immediately * Schedule a system shutdown for some time in the future * Automatically shutdown the system when all file operations are complete **Command Arguments:** $$ Argument $$ Type $$ Possible values $$ Description $$ (#)//no argument// $$ - $$ - $$ Closes the active Lister. If the active Lister was the only one and the **Shutdown Directory Opus when the last Lister closes** option on the **[[:preferences:preferences_categories:launching_opus|Launching Opus / Startup]]** Preferences page is turned on, this will also exit the program. ``Close`` This command is asynchronous. The Lister may not have closed yet when it completes. It should generally be the last command a button runs, as any later commands may fail to run if the window they are associated with has closed. $$ ALLLISTERS $$ /O $$ //(no value)// $$ Closes all currently open Listers. The program will also exit if the **Shutdown Directory Opus when the last Lister closes** option is turned on. Add the **CURRENTDESKTOP** argument to only close the ones on the current virtual desktop. ``Close ALLLISTERS`` This command is asynchronous. The Listers may not have closed yet when it completes. It should generally be the last command a button runs, as any later commands may fail to run if the window they are associated with has closed. $$ $$ $$ **collapse** $$ Collapses all open Listers to tabs in a single Lister. All Listers except the active one will be closed, and tabs will be opened in the remaining Lister for every Lister that closed. ``Close ALLLISTERS=collapse`` $$ $$ $$ **unique** $$ Combine **unique** with **collapse** to prevent duplicate tabs for paths which are already open in the lister. Has no effect unless **collapse** is also specified. At most one tab for each path will be opened in the left or right of the lister, with all other listers closing at the end as usual. Note that if the lister you are collapsing things into already has multiple tabs for the same folder, they will be left as-is, but no additional tabs will open for it. ``Close ALLLISTERS=collapse,unique`` $$ ALLOTHERLISTERS $$ /S $$ //(no value)// $$ Closes all open Listers **except** the active Lister. Add the **CURRENTDESKTOP** argument to only close the ones on the current virtual desktop. ``Close ALLOTHERLISTERS`` This command is asynchronous. The Listers may not have closed yet when it completes. $$ ALLVIEWERS $$ /S $$ //(no value)// $$ Closes any open [[:additional_functionality:viewing_images|standalone viewer]] windows. Add the **CURRENTDESKTOP** argument to only close the ones on the current virtual desktop. ``Close ALLVIEWERS CURRENTDESKTOP`` This command is asynchronous. The viewers may not have closed yet when it completes. If run from a button or hotkey inside the viewer, it should be the last line, as subsequent lines may not execute if the window they are associated with closes first. $$ AT $$ /K $$ //// $$ In conjunction with the **SYSTEM** argument this schedules an automatic shutdown of your system at a given time. The time to shutdown is given as a 24 hour time in HH:MM:SS format. If the time you specify is earlier than the current time of day, it will be taken to refer to the next day. When the time you specify is reached, a ten second countdown timer is displayed before the system it shutdown. ``Close SYSTEM=shutdown AT 04:00:00`` $$ AUTOLISTER $$ /O $$ //(no value)// $$ In conjunction with the **[[prefs|Prefs RESTORE]]** command, this argument sets a global flag that specifies that when Opus restarts, it should use "auto-Lister" semantics (which basically means that when Opus restarts, it will open a Lister by default). ``Close AUTOLISTER`` $$ $$ $$ **no** $$ Disables "auto-Lister" semantics when Opus restarts. ``Close AUTOLISTER=no`` $$ CANCEL $$ /S $$ //(no value)// $$ If you have previously scheduled a system shutdown with the **Close SYSTEM** and** AT** or **IN** arguments, this argument will cancel it. ``Close CANCEL`` $$ CURRENTDESKTOP $$ /S $$ //(no value)// $$ When combined with **ALLLISTERS**, **ALLOTHERLISTERS**, or **ALLVIEWERS**, the **CURRENTDESKTOP** switch will make the command only close those windows which are on the currently active virtual desktop. (Virtual desktops are a feature of Windows 10 and above, so this argument has no effect on earlier versions.) ``Close ALLLISTERS=collapse CURRENTDESKTOP`` $$ IN $$ /K $$ //// $$ Schedules an automatic shutdown in a certain amount of time (contrast with **AT**, which lets you specify an absolute time of day). The time is specified in HH:MM:SS format (or MM:SS or just SS). When the time you specify is reached, a ten second countdown timer is displayed before the system it shutdown. ``Close SYSTEM=force,poweroff IN 60:00`` $$ NOSCRIPT $$ /S $$ //(no value)// $$ Closes the Lister without triggering the **[[..:..:scripting_reference:scripting_events:oncloselister|OnCloseLister]]** script events that any [[:scripting:script_add-ins|script add-ins]] may have provided. You would probably want to use this if running the **Close** command from within an **OnCloseLister** event (to, e.g. close other Listers automatically in response to the user closing one). ``Close NOSCRIPT`` $$ PROGRAM $$ /O $$ //(no value)// $$ Exits Directory Opus immediately. ``Close PROGRAM`` $$ $$ $$ **confirm** $$ Exits Directory Opus after displaying a confirmation dialog. ``Close PROGRAM=confirm`` $$ $$ $$ **onlast** $$ Close the program only if this is the last remaining Lister, otherwise just close the Lister. This command lets you create a unified close/quit command. ``Close PROGRAM=onlast`` $$ QUIET $$ /S $$ //(no value)// $$ Suppresses the confirmation dialog normally displayed when shutting the system down with the **Close SYSTEM** command. The system will immediately shutdown - there will be no chance to cancel. You can also use this in conjunction with the scheduled shutdown arguments **AT** and **IN**. ``Close SYSTEM=shutdown QUIET`` $$ RESTART $$ /O $$ //(no value)// $$ Shuts Opus down and restarts it. Use `Close SYSTEM=restart` to restart the computer. ``Close RESTART`` $$ $$ $$ **confirm** $$ Displays a confirmation dialog before restarting the program. ``Close RESTART=confirm`` $$ SYSTEM $$ /O $$ //(no value)// $$ Ends your Windows session and logs you off. A ten second countdown dialog will be displayed giving you a chance to cancel (unless you also use the **QUIET** argument). ``Close SYSTEM`` $$ $$ $$ **restart** $$ Restarts (reboots) the system. Use `Close RESTART` to restart Opus itself. ``Close SYSTEM=restart QUIET`` $$ $$ $$ **shutdown** $$ This shuts the system down (depending on your hardware, this may also power off the computer; or it may display the //"Your computer is now safe to be shutdown"// screen). ``Close SYSTEM=shutdown`` $$ $$ $$ **poweroff** $$ This shuts the system down and powers off the computer. ``Close SYSTEM=poweroff`` $$ $$ $$ **sleep** $$ Puts the system to sleep. ``Close SYSTEM=sleep`` $$ $$ $$ **suspend** $$ Suspends the system (S4 hibernation). ``Close SYSTEM=suspend`` $$ $$ $$ **stay** $$ Stay running. If not specified, Directory Opus will exit at the same time Windows shuts down. Combine with **sleep** or **suspend** to make Windows sleep or hibernate without exiting Opus. ``Close SYSTEM=sleep,stay`` $$ $$ $$ **force** $$ Use this in addition to the other options to force the system to shutdown even if some programs are not responding. Normally the system will wait for all running programs to exit before shutting down. If you use this option the system will shutdown immediately and you may potentially lose unsaved data if some programs are currently busy. ``Close SYSTEM=shutdown,force AT 03:30:00 QUIET`` $$ $$ $$ **forceifhung** $$ This is the same as the **force** option, but only if there actually are any non-responding programs. Otherwise the shutdown proceeds as normal. ``Close SYSTEM=restart,forceifhung`` $$ $$ $$ **switch** $$ If fast user-switching is enabled, this command will let you switch users. (This cannot be scheduled via the **AT** argument.) ``Close SYSTEM=switch`` $$ $$ $$ **unattended** $$ System restart or shutdown will be done in a way which avoids additional confirmation dialogs when running via Remote Desktop or Terminal Services. The dialogs this avoids come from Windows itself; Opus will still show its own confirmation dialogs unless you also use the **QUIET** argument. If any applications, for any logged-in users, have unsaved work then system dialogs may still be generated unless you also use **force** or **forceifhung** (there is no distinction between the two when combined with **unattended**). ``Close SYSTEM=shutdown,force,unattended QUIET`` $$ TOGGLE $$ /S $$ //(no value)// $$ Use this argument in conjunction with the scheduled-shutdown options to toggle the scheduled shutdown on or off. If used in a toolbar or menu it causes the button to appear checked whenever a shutdown is scheduled, and unchecked if not (providing a visual indication of the current state of the shutdown scheduler). ``Close SYSTEM=poweroff,force WHENFINISHED QUIET TOGGLE`` $$ WHENFINISHED $$ /S $$ //(no value)// $$ Schedules an automatic shutdown when all outstanding file operations have completed. For example, when you are downloading a large amount of data via FTP, you could use this to have the computer automatically shutdown when the download is complete. Note that if there are currently no executing functions, the shutdown will be triggered immediately! ``Close SYSTEM=shutdown WHENFINISHED``