You are here

Useful ahk Script

1 post / 0 new
Nathan9222's picture
Last seen: 2 years 7 months ago
Joined: 2007-12-06 22:35
Useful ahk Script

Yo I was messing around with autohotkey earlier and I came up with this small script for those of you who want to put a file in an ahk script and type a password of your choice to extract it. This could be useful when sending files to friends over email or whatever, and for an added security measure you could also actually encrypt it. So here it is and there is also misleading text saying it will delete the file if password is typed wrong but all it will do is move it to the Temp directory and rename the file.

InputBox, Password, Enter Password, Please Enter the correct password for the file to be extracted (Note: Typing nothing and hitting OK will close the app. Getting the password wrong will delete the script), HIDE,,,,,,,
If Password =
If Password =(Put your password here)
FileInstall, (Full Path to file,including file name and extension), %A_ScriptDir%\(Folder or name of the file you want it to be renamed/moved to.), 0
MsgBox, Wrong Password Entered!
IfMsgBox, OK
FileMove, %A_ScriptDir%\Test.exe, %A_Temp%\$~al3f.tmp, 1

Hope the above makes sense, Also I hope this is helpful or useful to some, and I know school will be starting up pretty soon so you might be able to use this for your usb to keep files somewhat safe from somebody who might steal your usb. But remember to put a password other than your school ID! Smile
Note:Please note that the source directory of your file and your files name should follow this guideline for it to extract properly,

The name of the file to be added to the compiled EXE. The file is assumed to be in (or relative to) the script's own directory if an absolute path isn't specified.

The file name must not contain double quotes, variable references (e.g. %A_ProgramFiles%), or wildcards. In addition, any special characters such as literal percent signs and commas must be escaped (just like in the parameters of all other commands). Finally, this parameter must be listed to the right of the FileInstall command (that is, not on a continuation line beneath it).

The above was taken from here