Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 使用ahk关闭visual studio中的弹出对话框_Visual Studio_Autohotkey - Fatal编程技术网

Visual studio 使用ahk关闭visual studio中的弹出对话框

Visual studio 使用ahk关闭visual studio中的弹出对话框,visual-studio,autohotkey,Visual Studio,Autohotkey,我重新映射了几个键,效果很好;但是,我很难摆脱visual studio中的弹出对话框: 以下是我尝试过的: WinWaitActive, Microsoft Visual Studio If WinActive("Microsoft Visual Studio") { WinGetText, HayStack Needle = "A network-related or instance-specific error" IfInString, Haystack, %Needle%

我重新映射了几个键,效果很好;但是,我很难摆脱visual studio中的弹出对话框:

以下是我尝试过的:

WinWaitActive, Microsoft Visual Studio
If WinActive("Microsoft Visual Studio")
{
  WinGetText, HayStack
  Needle = "A network-related or instance-specific error"
  IfInString, Haystack, %Needle%
  {
      MsgBox, The string was found.
      return
  }
  else
      Sleep, 1
}
return
然而,我没有得到任何回应

整个脚本(包括一些关键重映射)如下所示:

SetTitleMatchMode 2
!z::Send, !{F4}
!x::Send, !fc
!c::Send, 23481241240910324
^d::Send {End}{Shift Down}{Up}{End}{Shift Up}{Backspace}
!a::
If WinActive("Microsoft Visual Studio")
{

}
else
{
  Send !{F4}n
}
return
WinWaitActive, Microsoft Visual Studio
If WinActive("Microsoft Visual Studio")
{
  WinGetText, HayStack
  Needle = "A network-related or instance-specific error"
  IfInString, Haystack, %Needle%
  {
      MsgBox, The string was found.
      return
  }
  else
      Sleep, 1
}
return
我做错了什么?如何摆脱这种对话?

我做错了什么?

  • Needle=“与网络相关或特定于实例的错误”
    -字符串分配与AHK中的工作方式不同。您可以使用
    针:=“网络…”
    针=网络…”

  • 你的ALT+A热键有什么意义?如果窗口弹出,为什么不直接按回车键

  • 因此,当弹出窗口未处于活动状态时关闭窗口

  • 返回

    此关键字之后的所有内容都不会执行。您的脚本永远不会到达Microsoft Visual Studio的WinWaitActive

顺便说一句,酷名兄弟

我做错了什么?

  • Needle=“与网络相关或特定于实例的错误”
    -字符串分配与AHK中的工作方式不同。您可以使用
    针:=“网络…”
    针=网络…”

  • 你的ALT+A热键有什么意义?如果窗口弹出,为什么不直接按回车键

  • 因此,当弹出窗口未处于活动状态时关闭窗口

  • 返回

    此关键字之后的所有内容都不会执行。您的脚本永远不会到达Microsoft Visual Studio的WinWaitActive


顺便说一句,酷名兄弟

请确保使用Windows spy实用程序从自动热键安装文件夹中获取窗口标题和文本。
有几种方法可以关闭窗口,有时你必须更用力一点。您甚至可能需要以管理员权限运行脚本。您也不需要定义一个热键,必须按下该热键才能摆脱窗口。您可以完全自动化整个过程。尝试一下:

#Persistent ;Ensure the script doesn't exit immediately
If not A_IsAdmin ;force the script to run as admin
{
    Run *RunAs "%A_ScriptFullPath%"
    ExitApp
}

;Enter the correct win title and a correct substring of the win text and maybe also the ClassNN of the button whoch closes it
windowTitle = Microsoft Visual Studio
windowText = A network-related or instance-specific error
closeButton = Button1

;Call CloseWindow periodically passing the contents of above variables as arguments:
CloseWindowWithBoundArgument := Func("CloseWindow").bind(windowTitle, windowText, closeButton)
SetTimer, %CloseWindowWithBoundArgument%

;Wait for a window to exist, then close it:
CloseWindow(winTitle,winText,buttonClassNN) {
    WinWait, %winTitle%, %winText% ;wait until the window exists
    ;There are multiple methods to close a window:

    ;Close window method 1 (similar to pressing alt+F4)
    PostMessage, 0x112, 0xF060,,, %winTitle%, %winText%

    ;Close window method 2 (sends a WM_CLOSE message; somewhat forcefully)
    WinClose, %winTitle%, %winText%

    ;Close window method 3 (forcefully closing a window using server different methods internally)
    WinKill, %winTitle%, %winText%

    ;Close window method 4 (clicking a button to close the window)
    ControlClick, %buttonClassNN%, %winTitle%, %winText%
}

确保使用window spy实用程序从autohotkey安装文件夹中获取窗口标题和文本。
有几种方法可以关闭窗口,有时你必须更用力一点。您甚至可能需要以管理员权限运行脚本。您也不需要定义一个热键,必须按下该热键才能摆脱窗口。您可以完全自动化整个过程。尝试一下:

#Persistent ;Ensure the script doesn't exit immediately
If not A_IsAdmin ;force the script to run as admin
{
    Run *RunAs "%A_ScriptFullPath%"
    ExitApp
}

;Enter the correct win title and a correct substring of the win text and maybe also the ClassNN of the button whoch closes it
windowTitle = Microsoft Visual Studio
windowText = A network-related or instance-specific error
closeButton = Button1

;Call CloseWindow periodically passing the contents of above variables as arguments:
CloseWindowWithBoundArgument := Func("CloseWindow").bind(windowTitle, windowText, closeButton)
SetTimer, %CloseWindowWithBoundArgument%

;Wait for a window to exist, then close it:
CloseWindow(winTitle,winText,buttonClassNN) {
    WinWait, %winTitle%, %winText% ;wait until the window exists
    ;There are multiple methods to close a window:

    ;Close window method 1 (similar to pressing alt+F4)
    PostMessage, 0x112, 0xF060,,, %winTitle%, %winText%

    ;Close window method 2 (sends a WM_CLOSE message; somewhat forcefully)
    WinClose, %winTitle%, %winText%

    ;Close window method 3 (forcefully closing a window using server different methods internally)
    WinKill, %winTitle%, %winText%

    ;Close window method 4 (clicking a button to close the window)
    ControlClick, %buttonClassNN%, %winTitle%, %winText%
}

你想完成什么?为什么你不能简单的点击OK来解决问题呢?你想完成什么?为什么您不能简单地单击“确定”并解决问题?谢谢!这是我到目前为止得到的,我已经将它包装在一个循环中,但它似乎根本没有响应。你的想法是什么?我非常感谢你的帮助!祝你有一个愉快的一周如果winactive()紧接着
winwaitactive
,你不需要
,因为后者意味着former@PleaseStopUpvotingMe我还是不明白
Send的意思!{F4}n
但是-代码在我看来没问题,我不知道什么不适合它。干杯你应该在你的代码中放置
msgbox
es,找出发生了什么和什么不起作用。谢谢!这是我到目前为止得到的,我已经将它包装在一个循环中,但它似乎根本没有响应。你的想法是什么?我非常感谢你的帮助!祝你有一个愉快的一周如果winactive()
紧接着
winwaitactive
,你不需要
,因为后者意味着former@PleaseStopUpvotingMe我还是不明白
Send的意思!{F4}n
但是-代码在我看来没问题,我不知道什么不适合它。干杯你应该把
msgbox
es放在你的代码里,找出发生了什么和什么不起作用。