I would like to be able to sleep while Models are running for much of the night in ArcGIS for Desktop .

I would like to have ArcGIS for Desktop play a sound when it finishes, to awaken me.

Is this possible?

  • 3
    I would like it to email me so maybe the answer could include both (Pour a beer would be nice as well). Great Q. Commented Jun 26, 2014 at 21:56
  • 1
    Chr(7) BEL plays a speaker sound... however if you are interested in just a little python I could help. Can't help with the beer though. Commented Jun 26, 2014 at 21:57
  • 1
    Ah! An email would work, I can make my email program sound off.
    – Aaron
    Commented Jun 26, 2014 at 22:38
  • 5
    I envisage a Rube Goldberg (sp?) like solution would be most appropriate. As the model completes a mechanical computer arm hits trap door that releases a ball that eventually drops a wet towel on your face or similar. Commented Jun 27, 2014 at 2:11

2 Answers 2


I really like Aarons answer, but something more simple and local:

subprocess.Popen([r"C:\Program Files (x86)\Windows Media Player\wmplayer.exe",r"C:\Users\Public\Music\Sample Music\Maid with the Flaxen Hair.mp3"])

using the subprocess module cause windows media player to open a file..

import subprocess

wmPlay = r"C:\Program Files (x86)\Windows Media Player\wmplayer.exe"
PlayFile= r"C:\Users\Public\Music\Sample Music\Maid with the Flaxen Hair.mp3"

Of course the sample music is more likely to put you to sleep so something more like my alarm clock tone might be more suitable.

But of course that's so simple you could do both, just tack that onto the end of Aarons' code.

  • 1
    Excellent idea! This could also be easily incorporated as a script tool.
    – Aaron
    Commented Jun 26, 2014 at 22:29
  • 2
    Love this script idea. I'd suggest an mp3 like the National Geographic theme music, or Where in the World is Carmen Sandiego, but that might be a little too geeky of me...
    – Erica
    Commented Jun 27, 2014 at 11:53
  • Everybody's musical taste is different. I chose a song that was loud and annoying as that's more likely to get attention. Flight of the Valkyries would be an excellent choice if you were unlikely to sleep though it. If you were really keen you could put in a parameter of the file to be played and get it reporting back with short tones at critical points as proof of life Commented Jun 28, 2014 at 4:07
  • and again, I pre-empted your answer with a 1998 AML which makes an annoying beep ;) Commented Jul 1, 2014 at 23:45
  • Ha ha @StephenLead, in ArcInfo just about everything made an annoying beep. You could walk away and make a coffee and know your process was still going just by the chain of beeps. This of course assumes your system speaker is installed. Commented Jul 1, 2014 at 23:47

How about e-mailing yourself when the model is finished? Make sure to set your phone to give you a tone when you receive the e-mail sent via the attached Python script. This is designed to be run as a script tool in ModelBuilder. If you are not familiar working with script tools, follow these instructions. Please not that this is configured to work with gmail. The tool is designed to work as follows (note the precondition attaching the bufferedPoints variable and the sendEmail script tool):

enter image description here

import smtplib, os, arcpy
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders

# Fill in the necessary blanks here
gmail_user = sys.argv[1]
gmail_pwd = sys.argv[2]

# The parameters
to = sys.argv[3]
subject = sys.argv[4]
text = sys.argv[5]

def mail(to, subject, text):
    msg = MIMEMultipart()

    msg['From'] = gmail_user
    msg['To'] = to
    msg['Subject'] = subject

    # Attaches a text message to the e-mail

    mailServer =smtplib.SMTP("smtp.gmail.com", 587)
    mailServer.login(gmail_user, gmail_pwd)
    mailServer.sendmail(gmail_user, to, msg.as_string())

mail(to, subject, text)

Instructions for creating the script tool:

Create the script

  1. Open IDLE > File > New Window
  2. Copy and paste script on this post to the new window
  3. Save as > "SendEmail.py"

Create the script tool

  1. Right-click on a folder > New > Toolbox (This is where the script tool will be located)
  2. Right-click toolbox > Add > Script...
  3. Fill in Name, Lable, Description and check "Store relative path...."
  4. Hit Next
  5. Add the script you created "SendEmail.py"
  6. Hit Next
  7. Fill in the parameters exactly as in attached figure.
  8. Hit Finish
  9. Locate new tool in tool box and use as you would any other tool in ModelBuilder

enter image description here

  • 1
    @ Michael Miles-Stimson Funny coincidence, there are not too many Aaron's anymore. This script tool works directly through the e-mail service and is independent of outlook. However, if Outlook can read you e-mail and your phone can notify you when you get a e-mail via Outlook, it should work just fine.
    – Aaron
    Commented Jun 26, 2014 at 22:11
  • 1
    I work with an Aaron, he's cool too. I was referring to outgoing email, essentially I would be emailing myself.. message from me to me sent from work computer and read/notify on home computer on VPN. Outlook can be configured to play a sound when an email comes in. Commented Jun 26, 2014 at 22:16
  • 1
    OK. This is very promising! I dont quite understand where to put my actual email address. Do i substitute it for the phrase "gmail_user"? or is that the variable? What are the "sys.argv[#]" things? Is that where I put my information?
    – Aaron
    Commented Jun 26, 2014 at 22:46
  • 1
    @Aaron sys.argv is the list containing the arguments passed to the Python script from the command line. It is the equivalent of using arcpy.GetParameterAsText(i)
    – om_henners
    Commented Jun 27, 2014 at 0:04
  • 3
    If it helps anyone, I've put up an example gist that shows how to use @Aaron 's answer as a wrapper to notify on success or failure of a script.
    – om_henners
    Commented Jun 27, 2014 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.