如何制作不同的检查开关。在这段代码中,我想让开关立即检查wintitle变量和winclass变量,查看行开关(wintitle _维斯温类)--这是一个示例:
WinGetTitle, wintitle, A
WinGetClass, winclass, A
Switch (wintitle || winclass) ;;<<<<< Look at this row, How to set -
{ ;; - multiple variations for check ??
我想把窗口标题传递给我用AutoHotKey编写的函数,窗口标题WinTitle是一个字符串吗?我有4个窗口标题,我需要将它们传递给相同的函数。
Extract(my_window_title) {
; Wake and select the correct window to be in focus
WinWait, my_window_title,
IfWinNotActive, my_window_title, , WinActivate, my_window_title,
WinWaitActive, my_window_title,
; ... do a bunch of thi
我使用自动热键将文本字符串插入到文本文件中。如何将路径和文件名存储在新变量中?
假设我使用此代码插入日期/时间戳:
::iii:: ; insert a date time stamp
send, ID%A_YYYY%.%A_MM%.%A_DD%.%A_Hour%.%A_Min%.%A_Sec%
return
如何修改代码以存储正在标记的文件的路径和名称?
像这样吗?:
::iii:: ; insert a date time stamp
send, ID%A_YYYY%.%A_MM%.%A_DD%.%A_Hour%.%A_Min%.%A_Sec%
path = <code for
我有一个脚本,它或多或少地在工作。
我启动了一个程序然后按了一些键。
取决于几个因素,该程序显示两个屏幕之一。如果屏幕是1号,那么它应该只运行到最后(标题: 10-2013 2013.06.17 )。屏幕x)。如果屏幕是2号,那么它应该按另一个键,然后运行到末尾(标题: 10-2013 2013.06.17 )。屏幕y)。
屏幕标题不是简单的标题,但它们取决于某些输入,下面是我尝试的内容:
SetTitleMatchMode 2
; Wait for any of the two screens
WinWait,%5%-%1% - %2% - Screen
; If it is the se
下面的代码应该在按^a时激活文档A,在按^b时激活文档B。这两个文件都已存在并已打开。有时两者都起作用,有时一个起作用而另一个不起作用,有时两者都不起作用。错误消息显示为“错误的文件名”。在文件名中添加或删除.docx不起作用。在重新启动计算机后,脚本的第一次执行往往是正常的。
操作系统: Windows 10。
^a::
wrdApp := ComObjActive("Word.Application") ; Activate MS Word object
wrdApp.Documents("DocumentA").Activate
wrdApp.Visibl
我有一个窗口,由AutoHotkey创建,上面有一个按钮和一个编辑控件。我要做的是在单击按钮后将输入焦点带回到Edit控件。通过WinSpy (非常感谢Robert ),我有以下关于编辑控件的信息。
Handle : 0x00330786 (changes every time I start the application)
Control ID : 4
Class : Edit
Window Title : some window title
Parent Window Class : AutoHotkeyGUI
下面是我在脚本中使用的语句。
ControlFocus, MyEdit, s
当我用数字替换这些时,脚本工作得很好。但是为了简化操作,我想在脚本顶部定义一对变量(SetWidth和SetHeight),并根据需要自始至终调用它们。除了,由于某种原因,当我试图打电话给他们,它似乎没有正确的工作。
#NoTrayIcon
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recom
我有这样的自动热键脚本:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Run file.exe # takes ~30