R 可以导致文件被另一个程序打开吗?
这是一个有点奇怪的问题,但我想这里的人可能会感兴趣。
R 是否有可能导致文件在另一个程序中打开?例如,您可以编写一个命令行来使音乐文件开始播放吗?潜在的应用是,模型运行完毕后,音乐将开始播放,提醒您模型已完成。
This is a bit of a strange question, but I thought people here might be interested.
Is it possible to have R cause a file to be opened in another program? For example, could you write a command line that would cause a music file to start playing? The potential application would be that after a model is finished running, music would start to play, alerting you to the model's completion.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
除了
system
之外,在Windows上至少您可以使用shell.exec
,它将使用Windows文件关联中指定的应用程序打开文件。例如,shell.exec("file.txt")
将在您喜欢的文本编辑器中打开一个文本文件,shell.exec("file.mp3")
将启动媒体播放器等In addition to
system
, on Windows at least you can useshell.exec
which will open the file using the application specified in the Windows file associations. For example,shell.exec("file.txt")
will open a text file in your favourite text editor,shell.exec("file.mp3")
will launch a media player, etc.有 音频包 允许播放波形文件:
There is audio package which allow to play wave files:
您可以通过调用 system()< /a> 函数。
You can do this by calling the system() function.