@kerfun I got a solution that does what I wanted to do. I have my power off script now that looks like this:
var now = state.time var timeOut = 60 M98 P"0:/macros/YesNoInput.g" H"Shutdown Requested" S"Start the shutdown procedure?" T{var.timeOut} var startShutdown = true if state.time - var.now >= {var.timeOut} set var.startShutdown = true elif input == null set var.startShutdown = false if var.startShutdown == true echo "shutdown started" M18 ; Turn off motors M568 H1 R41 S0 ; Set hotend standby to 41 and active to 0 M568 H1 A1 ; Set hotend to standby temp M140 S0 ; Set bed to 0 M116 H1 ; Wait for hotend to reach 41 degrees (This is the lowest you can wait for a temp) M568 H1 A2 ; Set hotend back to active M42 P0 S1 ; Turn bed ps off M42 P1 S1 ; Turn main ps offAnd then I have my YesNoInput.g file that looks like this:
M291 R{param.H} P{param.S} K{"Yes",} S4 F"Yes" T{param.T} J1When the print is done I have the slicer always call the shutdown macro. When the shutdown macro runs it will ask the user if they want the printer to power down (in case they want to keep printing). If the user presses "Yes" the printer will start the shutoff procedure (the shutdown procedure usually takes pretty long because I want to wait for the hotend to cool off). If the user doesn't press any buttons on the message the printer will shut off. If the user presses "cancel" before the 60 seconds, the printer will stay on.