BookmarkSubscribeRSS Feed
ScottBass
Rhodochrosite | Level 12

@ChrisHemedinger 

 

tl;dr: 

Before I reinvent the wheel, has anyone created an EG custom task that plays a sound on the local machine (where EG is running)?

 

Details:

If you Google "SAS Enterprise Guide play sound when program finishes", you'll see this has been requested often.  Perhaps one day it will make it into the product.  (I'm running EG 7.15).

 

Note this handy little option in SQL Server Management Studio:

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

2020-04-01_17-26-05.jpg

 
 
 
 
 

I got this working today but the approach is klunky.  With little explanation:

 

* two examples ;
filename cmd pipe "\\UNC\path\to\PsExec\reachable\from\SASApp\Server\SysinternalsSuite\PsExec.exe -i \\MYLOCALMACHINE powershell.exe -command ""& {[system.console]::Beep(1000,3000)}"" ";
filename cmd pipe "\\UNC\path\to\PsExec\reachable\from\SASApp\Server\SysinternalsSuite\PsExec.exe -i \\MYLOCALMACHINE powershell.exe -command ""& {([System.Media.SystemSounds]::Asterisk).Play()}"" ";
data _null_;
   infile cmd;
   input;
*   putlog _infile_;
run;

* Or... ;
%let cmd=\\UNC\path\to\PsExec\reachable\from\SASApp\Server\SysinternalsSuite\PsExec.exe -i \\MYLOCALMACHINE powershell.exe -command ""& {([System.Media.SystemSounds]::Asterisk).Play()}"" ;
%let cmd=\\UNC\path\to\PsExec\reachable\from\SASApp\Server\SysinternalsSuite\PsExec.exe -i \\MYLOCALMACHINE powershell.exe -command ""& {([System.Media.SystemSounds]::Beep).Play()}"" ;
systask command "&cmd" wait cleanup;

 

 

But there are all sorts of reasons why this might not work in your environment:  requires Enable-PSRemote in Powershell, requires Windows Remote Management (WS-Management) service to be running on your local machine, requires ALLOWXCMD, requires a Windows SAS server, etc.

 

It occurred to me that if I had a simple EG custom task that played a sound (and the above is a good head start), I could just drop that task into my process flow and link it to whatever long running program(s) for which I want an audible alert once finished.  I often move on to other tasks when I have a long running program, and lose valuable time by not promptly returning to EG once it has finished.

 

If this hasn't been created before, can someone post the custom task shell code for a custom task that has no interface, just calls some .Net code?  I'm busy and don't have time ATM to hit the docs.

 

Thanks...

 


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
5 REPLIES 5
ChrisHemedinger
Community Manager

This System Command custom task (GitHub) could be used as-is to run a command to play sound, or adapted for the specific "play a sound" action.

 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
ScottBass
Rhodochrosite | Level 12

Thanks @ChrisHemedinger esp for the pointer to the GitHub source code.

 

I'll use this as-is for now.  When I get more time, I'd like to create just a simple beep task.

 

Can you tell me the bare minimum code sections I would need to execute embedded C# code without any user interface?

 

For example, I assume I can delete:

 

using System.Windows.Forms;
using System.Xml;		    // for XMLTextWriter and XMLTextReader
using System.IO;		    // for StreamReader and StreamWriter

and all the code sections that call these methods?

 

P.S.:  I've got your book but it's at the office and we're all in lock down 😒

 

 

 


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
TomKari
Onyx | Level 15

Another approach if your SAS is on Windows. I've never heard of this routine!!

 

data _null_;
   call sound(523,2000);
run;

I was googling...here's where I found it!

 

Tom

 

https://support.sas.com/resources/papers/proceedings/proceedings/sugi29/048-29.pdf 

ScottBass
Rhodochrosite | Level 12

@TomKari wrote:

Another approach if your SAS is on Windows. I've never heard of this routine!!

 

data _null_;
   call sound(523,2000);
run;

I was googling...here's where I found it!

 

Tom

 

https://support.sas.com/resources/papers/proceedings/proceedings/sugi29/048-29.pdf 


Hi Tom,

 

This only "works" for DMS.  I say "works" because it probably works for EG too, playing the sound on the machine in a server room in a galaxy far, far away.  If that server has a sound card.  And is not on mute.

 

😁


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
TomKari
Onyx | Level 15

Yes, good point.

 

I use EG with a local server instance, so I sometimes forget to separate the functions. Also, I was so surpised that there is a "sound" routine that all other thoughts were scattered to the winds. Who the heck put THAT in SAS?

 

I must admit, I am amused by the thought of a server in a computer room starting to play tunes...maybe use a grid, and have it switch from server to server, so the server room staff can't chase it down?

 

Tom

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1960 views
  • 3 likes
  • 3 in conversation