【问题标题】:Can I use InputBox to input a Hotkey?我可以使用 InputBox 输入热键吗?
【发布时间】:2012-12-17 05:03:50
【问题描述】:

我想使用 InputBox 输入随后用于激活热键的键 虽然我可以使用下面的脚本输入数据,但我不知道是否可以将其用作热键

InputBox, UserID, UserID, Enter your UserID,,150, 120
If ErrorLevel
    Exit
InputBox, password, Password, Enter your Password, HIDE, 150, 120 
If ErrorLevel
    Exit
Prompt := "Create your shortcut using any`ncombination of keys including `n^ for Ctrl`n# for Windows`n! for Alt`nin combination with another key."
InputBox, Shortcut, Shortcut, %Prompt%,,220, 220
If ErrorLevel
    Exit
else
MsgBox, %UserID%, %Password%, %Shortcut%
Exit

%Shortcut%::
MsgBox, It worked.

可能很容易做到,但我看不到。有可能吗?谢谢。

【问题讨论】:

    标签: hotkeys autohotkey inputbox


    【解决方案1】:

    我就是这样解决的。可能不理想,但对我有用。

    !Esc::
    SplashTextOn, 250,200,Power Options,1 = Arentheem Ouders`n`r2 = Arentheem Brian`n`rS = Sleep`n`rR = Reboot`n`rP = Power down`n`rW = Wait`n`rEsc = keep working`n`rL = Loop`n`rD = Display Off`n`rC = Compress MP3's and sleep`n`rB = Back-up and sleep`n`r`n`rPC will automatically go to sleep after 10 seconds if no key is pressed!
    SetTimer, GoToSleep, Off
    Input, CI_KeyVar, I L1 T10
    SplashTextOff
    if ErrorLevel = Timeout
    {
        GoSub, NetBackup
        return
    }
    if (CI_KeyVar = "c")
    {
    
      ;SplashTextOn, 250,30,Shift+Esc = Finish Options,Sleep = default
      run "C:\Program Files (x86)\AutoHotkey\AutoHotkey.exe" "C:\Users\Robert\AppData\Roaming\Microsoft\Windows\Start Menu\Lemon Juice\Compress.ahk"
      SetTimer, MySplashTexOff, -60000 ; Remove splashText after 1 minute -60000 = run timer once
      Return
    }
    if (CI_KeyVar = "d")
    {
      SetTimer MonitorOff, 1000 ; Turn the monitor off
      Return
    }
    
    if (CI_KeyVar = "l")
    {
      GoSub, MyScreenLoop
      Return
    }
    if (CI_KeyVar = "1")
    {
      Sleep, 500
      Send, {Esc}
      Sleep, 100
      Send, ABC{TAB}XYZ{Enter}
      Return
    }
    if (CI_KeyVar = "2")
    {
      Sleep, 500
      Send, {Esc}  
      Sleep, 100
      Send, XYZ{TAB}ABC{Enter}
      Return
    }
    
    if (CI_KeyVar = "q")
    {
      Return
    }
    if (CI_KeyVar = "s")
    {
      DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
      Return
    }
    if (CI_KeyVar = "b")
    {
      GoSub, NetBackup
      Return
    }
    if (CI_KeyVar = "r")
    {
      run, Shutdown.exe /r /t 1 ; Reboot PC
      Return
    }
    if (CI_KeyVar = "p")
    {
      run, Shutdown.exe /s /t 0 ; Shutdown PC
      Return
    }
    if (CI_KeyVar = "w")
    {
    SleepTime+=1
    inputbox, Sleeptime, Minutes,,,400,110,,,,,%Sleeptime%
    Sleeptimer+=%Sleeptime%
    MySleeptimer:=Sleeptimer * 60000 ; 60`000 = 1 minute
    if MySleeptimer = 0
    {
      Return
    }
    TrayTip, Count Down,`n`nSleeping in %Sleeptimer% minutes`n`nPress Alt + Esc to cancel,10,1
    SetTimer, GoToSleep, %Mysleeptimer%
    }
    Return
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-05
      • 2011-01-05
      • 1970-01-01
      • 2011-10-30
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多