Exit editor from within code

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1024
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Exit editor from within code

Post by Grovkillen » Mon Oct 02, 2023 6:34 am

If you want to close the editor after the script ends (for whatever reason) you can do this using PyExec:

Code: Select all

PyExec>import sys%CRLF%sys.exit(),,
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Exit editor from within code

Post by JRL » Fri Oct 06, 2023 4:03 pm

When I tried this it not only closed the editor it closed Macro Scheduler. Perhaps you are running and editing your scripts from Windows File Explorer?

Not that it's a bad thing. A method to close Macro Scheduler from a running script has been requested before.

viewtopic.php?f=2&t=2190&hilit=close+macro+scheduler

User avatar
Grovkillen
Automation Wizard
Posts: 1024
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Exit editor from within code

Post by Grovkillen » Sat Oct 07, 2023 5:11 am

Yes I'm not using the MS "launcher".
Let>ME=%Script%

Running: 15.0.24
version history

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts