How to run a script as an app on an automated schedule? (Mac)

I’ve been having problems with the Server Junk Mailbox script locking up Apple Mail when used as a rule within the program so I exported it as an app through Script Editor. Works great now but I have to manually run it. How do I get it to run automatically every 30 minutes (for example)? I tried figuring this out using Automator but I don’t know what I’m doing.

You don’t have to use Automator. The script is already set up to check Mail every 5 minutes. Just save it as a Stay Open application, launch the app, and let it run. To change it from 5 minutes to 30 minutes, change:

on idle
    -- This is executed periodically when the script is run as a stay-open application.
    my filterServerJunkMailboxes()
    return 60 * 5
end idle

to:

on idle
    -- This is executed periodically when the script is run as a stay-open application.
    my filterServerJunkMailboxes()
    return 60 * 30
end idle

Fantastic! To save it as a Stay Open application, do I check the box for ‘Stay open after run handler’ when choosing ‘Export…’? If I just click save there are no options offered, it just saves.

Yes, or if you were to paste the script into a new document in Script Editor, you will be able to select that when you choose Save.