InterviewSolution
| 1. |
Solve : VBS Pause/Resume music WMPlayer.OCX? |
|
Answer» hey, I know how to play music in VBS like so: You want two scripts to control the same object instance (WMP)? I think you would have to create an out-of-process COM object. Don't know if this would work, but it sure sounds promising.what I'm doing is programming MS-DOS Batch and occasionally using vbs files to do things batch can't so the second option isn't going to work, I'm not very familiar with vbs and don't know what an out of process COM object is, its rather hard to get batch to communicate with the vbs maybe an option would be to create a text DOCUMENT with the value of the time the music was at then kill the process and then RESTART the process later with the music starting at that point in timeI don't think this is going to happen. Giving focus to Win7 WMP from an external script for some reason does not work. I could only give focus from within the script that launched WMP. That would eliminate having seperate scripts for pause and resume. The Script Component also fizzled out. I could get the music to play but could not pause/resume it. The WMP object and the script run asynchronous, which explains the while/wend loop in your script and the sleep in my script. VBScript is single threaded, so interrupting the loop might not be possible. My suggestion is to manually start the music, and use CTL-P to toggle between pause and resume. Make sure the WMP window has focus when using CTL-P. To add insult to injury, I found that giving focus to WMP on WinXP works just fine. alright thanks for trying though |
|