0
votes

Use Case: I want the launching of an Autohotkey to be secure.

I intend to make it capable of posting passwords, but I want the launching and editing of this script to prompt for credentials. Are there any built-in options for me to consider. Alternatives for the copying and pasting of passwords will also suffice.

2

2 Answers

0
votes

You can compile the code into a password protected EXE file and run the ahk file as an AHK file.

https://autohotkey.com/board/topic/85482-password-on-exe-or-file/

0
votes

In AutoHotKey, you can easily put up a dialog box to prompt for a password when the script starts.

The following is verbatim from the reference manual:

InputBox, password, Enter Password, (your input will be hidden), hide

You can put it at the top of the script.

Here is a script similar in structure to one I am using; it binds the CtrlAltV key to activate a particular window, simulate a click and some Tab keystrokes, and then enters the password and hits Enter.

#SingleInstance Force

InputBox, password, Enter Password, (your input will be hidden), hide

^!v::
if WinExist("WINDOW TITLE HERE") {
  WinActivate
  MouseClick, left, 400, 60
  SendInput {Tab}{Tab}{Tab}
  SendRaw %password%
  Send {Enter}
}

The Inputbox is executed when you launch the script; you must type the password. The password goes into the password variable, which is then used each time you invoke the hot-key sequence.

This almost satisfies the question's requirement:

I want the launching and editing of this script to prompt for credentials.

If you want to create a two-field dialog box that prompts for multiple credential pieces, like user name and password, there are GUI functions for that; AutoHotKey supports a whole zoo of controls. Tab panels, combo boxes, multi-line edits, you name it.