自动启动 Windows 录音机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/165987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Automatically starting Windows Sound Recorder
提问by crystalattice
My division has been tasked with recording the morning presentation audio for future use, using the built-in Windows Sound Recorder. Because of human nature, we don't always remember to start it on time.
我的部门的任务是使用内置的 Windows 录音机录制早上的演示音频以备将来使用。由于人性的原因,我们并不总是记得按时开始。
Windows doesn't have a built-in equivalent to the Unix cronfunction. Besides installing a new software program (which will take time, possibly cost money, and require IA certification), is there an easy way to automate the recording?
Windows 没有与 Unix cron函数等效的内置函数。除了安装新的软件程序(这需要时间,可能需要花钱,并且需要 IA 认证)之外,还有没有一种简单的方法可以实现自动录制?
I'm not adverse to writing a simple Python script for it, but I haven't programmed for Windows before; I don't know the APIs or anything required for this type of program.
我并不反对为它编写一个简单的 Python 脚本,但我之前没有为 Windows 编写过程序;我不知道此类程序所需的 API 或任何内容。
EditThanks for the responses. I feel like an imbecile. I don't normally use Windows computers so I wasn't aware that Windows had the Task Scheduler.
编辑感谢您的答复。我觉得自己是个白痴。我通常不使用 Windows 计算机,所以我不知道 Windows 有任务计划程序。
However, when I tested it with the recorder program, all it did was open the program; it didn't actually start recording. How do I get it to actually start recording when it is opened?
然而,当我用记录器程序测试它时,它所做的只是打开程序;它实际上并没有开始录制。如何让它在打开时真正开始录制?
回答by Craig Norton
set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep(100)
WshShell.Run "%SystemRoot%\system32\sndrec32.exe"
WScript.Sleep(100)
WshShell.AppActivate "Sound - Sound Recorder"
WScript.Sleep(100)
WshShell.SendKeys " "
WScript.Sleep(100)
Save the above text as RunSoundRecorder.vbs. This will start the sound record application and start it recording. Just point the task scheduler at this file.
将上述文本另存为 RunSoundRecorder.vbs。这将启动录音应用程序并开始录音。只需将任务调度程序指向此文件即可。
Incase you want to make changes:
The third line is the exe to run
The fifth line is the what is in the application title bar.
如果您要进行更改:
第三行是要运行的 exe
第五行是应用程序标题栏中的内容。
回答by Brad Gilbert
Use AutoIt3
使用AutoIt3
Run ( @SystemDir + "\sndrec32.exe", "workingdir" )
Sleep(5000) ;five seconds
WinActivate( "Sound - Sound Recorder" )
Sleep(100)
Send( " " )
Note: I have not tested this, because I don't use Windows very often anymore.
注意:我没有测试过这个,因为我不再经常使用 Windows。
Definitely worth checking out if you want to automate any Win32 Gui. It actually seems like it has received even more features since I last used it.
如果您想自动化任何 Win32 Gui,绝对值得一试。自从我上次使用它以来,它实际上似乎获得了更多功能。
Features: ( taken from www.autoitscript.com/autoit3/)
特点:(取自www.autoitscript.com/autoit3/)
- Easy to learn BASIC-like syntax
- Simulate keystrokes and mouse movements
- Manipulate windows and processes
- Interact with all standard windows controls
- Scripts can be compiled into standalone executables
- Create Graphical User Interfaces (GUIs)
- COM support
- Regular expressions
- Directly call external DLL and Windows API functions
- Scriptable RunAs functions
- Detailed helpfile and large community-based support forums
- Compatible with Windows 95 / 98 / ME / NT4 / 2000 / XP / 2003 / Vista / 2008
- Unicode and x64 support
- Digitally signed for peace of mind
- Works with Windows Vista's User Account Control (UAC)
- 易于学习的类似 BASIC 的语法
- 模拟击键和鼠标移动
- 操作窗口和进程
- 与所有标准窗口控件交互
- 脚本可以编译成独立的可执行文件
- 创建图形用户界面 (GUI)
- COM 支持
- 常用表达
- 直接调用外部DLL和Windows API函数
- 可编写脚本的 RunAs 函数
- 详细的帮助文件和基于社区的大型支持论坛
- 兼容 Windows 95 / 98 / ME / NT4 / 2000 / XP / 2003 / Vista / 2008
- Unicode 和 x64 支持
- 数字签名让您安心
- 适用于 Windows Vista 的用户帐户控制 (UAC)
回答by prakash
There is no command line parameter to start in recording mode. You have to Start recording manually!
在录制模式下没有要启动的命令行参数。您必须手动开始录制!
回答by Treb
Start-Programs-Accessories-System Tools-Scheduled Tasks
开始-程序-附件-系统工具-计划任务