We help IT Professionals succeed at work.

Trigger windows sound from AS/400 program

611 Views
Last Modified: 2013-12-06
Greetings,
I am trying to figure out if there is a way for an RPG or ILE program to trigger the playing of a sound file.
The "Beep" that we could do, is not sufficent in this case.  
I want to have a .wav file, that is stored on the PC played.

Any ideas?
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Gary Patterson, CISSPExpert for hire: IBM i, AIX, Linux, Windows, DB2, Performance, Security. EDI
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I thought about that as well..  so I made me a little VB.net console application.   It works just fine when I call it from the windows command line..
It "Opens" when I call it using the RUNRMTCMD from the AS/400   but the sound does not play.
here is the code...  Any Ideas?   I have also tried changing the WAITTIME(*NOMAX) and it didnt help.

JGPCPGM:    PGM                                                                                          
             DCL        VAR(&STRING     ) TYPE(*CHAR) LEN(200)                                            
             CHGVAR     VAR(&STRING) VALUE('"C:\PlaySound\PlaySound.exe"')                                
             RUNRMTCMD  CMD(&STRING) RMTLOCNAME('172.16.104.80' *IP) RMTUSER(*NONE) WAITTIME(*NOWAIT)    
EOJ:                                                                                                      
             ENDPGM                                                                                      

Author

Commented:
I have the RUNRMTCMD working for another program I made.  So I know that the "Incoming Remote Command" option is correct.

Author

Commented:
I added a 1/2 a second delay in the windows program.  Once I did that, everything worked fine.
Gary Patterson, CISSPExpert for hire: IBM i, AIX, Linux, Windows, DB2, Performance, Security. EDI
CERTIFIED EXPERT

Commented:
Incoming remote command is going to spawn your program in another session, which may cause a problem for applications that need to interact with the user's session (including sound, I'm guessing).  You may be able to cure this by making sure the service is configured to interact with the desktop:

http://www.mcpressonline.com/programming/rpg/calling-a-pc-application-from-rpg-part-iii.html

Otherwise, you can try this instead.  STRPCCMD uses a different approach to start a PC command, and may not work through all emulators, though it should work fine with Client Access.

STRPCO
STRPCCMD

Another alternative, since you clearly know VB, is to write a little VB program that runs in the users session that uses the CA data queue APIs to watch an AS/400 data queue.  Entries placed on the data queue on the AS/400 can be used to trigger various programs in the user's session (or could even contain a command string itself).

- Gary Patterson

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.