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?
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" subprocess.Popen([wmPlay,PlayFile])
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.
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):
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 gmail_pwd = sys.argv # The parameters to = sys.argv subject = sys.argv text = sys.argv 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 msg.attach(MIMEText(text)) mailServer =smtplib.SMTP("smtp.gmail.com", 587) mailServer.ehlo() mailServer.starttls() mailServer.ehlo() mailServer.login(gmail_user, gmail_pwd) mailServer.sendmail(gmail_user, to, msg.as_string()) mailServer.close() mail(to, subject, text)
Instructions for creating the script tool:
Create the script
Create the script tool