您可以做的是编写两个单独的脚本。一个没有分配自动热键,但被初始脚本调用。在您的情况下,您已经说过您已经有一个 tabopening 热键,所以我将使用两个脚本的一个非常基本的示例,但演示如何发送 @ 符号并从热键中调用另一个脚本。
我将使用的两个脚本是:
tabOpener.ahk,和
passwordEntry.ahk
它们会如下所示:
tabOpener.ahk
#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.
; hotkey is set as WinowsKey+t and checks if FireFox exists, if so, it makes it active, if not, it starts FireFox
~#t::
IfWinExist, ahk_class MozillaWindowClass
{ WinActivate
Send ^t
} else run firefox
;Upon opening a new tab in FireFox, the address bar has already got focus,
;so send the web address (You can use COM functions for this, and are highly
;recommended, but out of the scope of this example)
Send, hotmail.com{Enter}
;Waits until page is loaded. Again COM functions are available as they can tell
;when a page is finished loading, but that is a more involved example.
Sleep 5000
;Calls the password entry script.
Run passwordEntry.ahk
return
passwordEntry.ahk
#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.
;When using send, adding the {Raw} tag will literally interpret every
;character in the remainder of a string. For instance ^ will send ^
;instead of a Control keypress.
Send {Raw}Username@domain.tld
Send {Tab} {Raw}Password
希望这会有所帮助。此示例展示了使用 {Raw} 标签发送特殊字符 (http://www.autohotkey.com/docs/commands/Send.htm),以及使用 Run / Runwait (http://www.autohotkey.com/docs/commands/Run.htm) 从现有热键中调用单独的脚本。