首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在特定程序中使用热键而不推送热键

在特定程序中使用热键而不推送热键
EN

Stack Overflow用户
提问于 2017-05-26 12:36:58
回答 1查看 202关注 0票数 0

我想打开一个软件,即OBS(开放广播软件)使用批处理文件,然后自动开始录音,不受我的干扰。我为录制设置的热键是pgup,但我不想按它,我希望批处理文件自动发送信号,即按下pgup键并开始录制。如何使用批处理文件进行此操作?

这是我用来启动它的代码。

代码语言:javascript
复制
@ECHO OFF
start /d "D:\OBS Studio\obs-studio\bin\64bit" obs64.exe

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-05-26 14:34:58

当您可以使用直接从AHK内部启动它时,您为什么要通过cmd来传递它?

代码语言:javascript
复制
; Checks to see if you're running the script as admin
if not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
   ExitApp
}

; The key you use to start/stop recording
startRec    := "PGUP"

; Path to your OBS exe
obsPath := "C:\Program Files (x86)\obs-studio\bin\64bit\obs64.exe"
; Splits path up int dir and file name.
SplitPath, obsPath, obsFileName, obsDir

; Closes any previously opened OBS instances
while WinExist("ahk_exe " obsFileName)
    WinClose, % "ahk_exe " obsFileName

; Run OBS
Run, % obsPath, % obsDir

; Waits until the OBS window has come up
while !WinExist("ahk_exe " obsFileName)
    Sleep, 1000

; Minimized OBS
WinMinimize, % "ahk_exe " obsFileName
Sleep, 1000

; Sends key to program to start recording
ControlSend, % "Qt5QWindowIcon2", {%startRec%}, % "ahk_exe " obsFileName

; Run your game here.

ExitApp
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44201817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档