中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-15 13:15
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS批处理 & 脚本技术(批处理室) » Achieve background sound playback without any player, in one line
Printable Version  2,093 / 6
Floor1 qinchun36 Posted 2010-01-22 21:54
高级用户 Posts 400 Credits 609
src can be a network resource, loop is the number of plays, -1 means loop. Typed on mobile, not sure if there's any mistake.
Floor2 clamber Posted 2010-01-23 15:32
初级用户 Posts 39 Credits 46
Floor3 radem Posted 2010-01-23 22:09
高级用户 Posts 383 Credits 691
Not bad
But after running a few more times, the task manager adds several mshta.exe processes
Floor4 jianluck1988 Posted 2010-01-26 19:39
新手上路 Posts 2 Credits 3 From 北京
Floor5 qwd Posted 2010-01-26 20:01
初级用户 Posts 56 Credits 161
Not bad! The effect is good! It's streamlined and has a good effect!

Just don't know how to close it from which level! Can only end the process!
Was it originally running in the background? There won't be a close button! Hehe!
Floor6 nemon Posted 2010-01-26 21:35
贫困用户 Posts 3 Credits 1
There is a problem of multiple processes appearing. It's quite good. Support.


Cordless DrillsMakita Cordless DrillsBosch Cordless Drillscordless drill driver
Floor7 qinchun36 Posted 2010-01-27 10:08
高级用户 Posts 400 Credits 609
This code actually opens an HTML page (which we can't see), and there will be background sound in this page; while the mshta.exe exists when the web page is not closed, and the sound stops but the web page doesn't close automatically, so the process will remain; therefore, we can only close it manually, or because there is no event, we can only add a fixed waiting time in the code and then close it automatically. Because the wscript object in vbscript is not available in HTML, we can't use wscript.sleep for delay, so we use the setTimeout of the window object instead. Taking my song as an example, the length is 3 minutes and 06 seconds, that is 186 seconds. Assuming I want to play it twice and then end the mshta.exe process, then it needs to be closed after 372000 milliseconds, and we can wait a few seconds appropriately, so we take 375000.

It's easier to write with javascript:

If you don't know the length of the song, set the time to be longer. Generally, popular songs won't exceed 300000 ms, that is 5 minutes.

----------------------
Modified on 2010.09.03 to adapt to paths with spaces
Code effect:

Play "C:\Documents and Settings\issuser\Desktop\music\incoming\EMINEM ft.NATE DOGG - Shake That.mp3" twice in the background, but this program mshta.exe will automatically end exactly after 360000ms, that is 6 minutes.


[ Last edited by qinchun36 on 2010-9-3 at 18:39 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023