Page 1 of 1

AutoHotKey Password

Posted: 18 May 2020, 00:17
by JustBilly123
Hi i want to make a password thing but I'm bad at autohotkey (im new to this)
i wanna make it so if at any time i input a sequence of keys a function happens (run, start, send, ect)'

i wanna use the numpad keys but if that's not possible i can always rebind them, thank you for reading and plz consider helping

Re: AutoHotKey Password

Posted: 18 May 2020, 00:29
by BNOLI

Code: Select all

Intro:
    MsgBox % "Welcome!"

Numpad1::
    Run, Notepad.exe
    Sleep, 1000
    Send, AHK rocks!
    Return
Numpad2::MsgBox % func("AHK rocks!")
Numpad3::SoundBeep
Numpad4::MouseMove, 0, 0
Numpad5::Goto, Intro

func(param) {
    Return SubString(param,1,-1) ", even more if you use its command reference!"
}
Click on the commands within this code box to get the magic of AHK! Happy scripting :)

Re: AutoHotKey Password

Posted: 18 May 2020, 00:34
by JustBilly123
Hi sorry, i dont think u understand

i meant somethign like a password

so if i do Numpad1 then Numpad2 Then numpad 3 it will start youtube.com for example
anyways thanks for taking ur time to respond

Re: AutoHotKey Password

Posted: 18 May 2020, 00:41
by Hellbent
Perhaps something along these lines.

Code: Select all

::@Youtube::
	Run, www.Youtube.com
	return
Hotstrings:
https://www.autohotkey.com/docs/Hotstrings.htm

Re: AutoHotKey Password

Posted: 18 May 2020, 00:46
by JustBilly123
Hellbent wrote:
18 May 2020, 00:41
Perhaps something along these lines.

Code: Select all

::@Youtube::
	Run, www.Youtube.com
	return
Hotstrings:
https://www.autohotkey.com/docs/Hotstrings.htm
Hi that doesn't seem to work

Re: AutoHotKey Password

Posted: 18 May 2020, 00:51
by Hellbent
Works fine for me.

Have you tried typing @Youtube and then pressing space or enter?

Re: AutoHotKey Password

Posted: 18 May 2020, 00:52
by JustBilly123
Hellbent wrote:
18 May 2020, 00:51
Works fine for me.

Have you tried typing @Youtube and then pressing space or enter?
oh nevermind it worked, but is there a way i can do it with numpad keys?

Re: AutoHotKey Password

Posted: 18 May 2020, 01:00
by BNOLI
Yes, there is. I provided you some sample code. Simply put some own effort into it. Happy scripting :)

Re: AutoHotKey Password

Posted: 18 May 2020, 01:02
by Hellbent

Code: Select all

Numpad1 & Numpad2::
	Run, www.Youtube.Com
	return

Re: AutoHotKey Password

Posted: 18 May 2020, 01:49
by Hellbent
I don't know how much you plan on doing with it, but here is a little idea for grouping your functions so that you don't have a million key combos.

This of course can be replaced with something more like a tree menu or w/e the hell you call it.

Code: Select all

#SingleInstance, Force
List1 := "www.youtube.com|https://www.autohotkey.com/boards/viewtopic.php?f=76&t=76071|https://www.autohotkey.com/boards/viewforum.php?f=76"
List2 := "Blah Blah Blah 1|More Blah Blah|Some Other Blah Blah"
return

Numpad1 & Numpad2::
	Gui,1: New, +AlwaysOnTop
	Gui,1:Add,ListBox,xm ym w300 r15 vSelectedItem1 , % List1
	Gui,1:Add,Button,xm y+10 w300 r1 gItemSelectRun, Go
	Gui,1:Show,,Run It
	return

ItemSelectRun:
	GuiControlGet,SelectedItem1
	Gui,1:Destroy
	Try{
		run, % SelectedItem1
	}catch{
		msgbox, Failed to run
	}
	return

GuiClose:
	Gui,1:Destroy
	return

Numpad2 & Numpad3::
	Gui,2: New, +AlwaysOnTop
	Gui,2:Add,ListBox,xm ym w300 r15 vSelectedItem2 , % List2
	Gui,2:Add,Button,xm y+10 w300 r1 gItemSelectClip, Go
	Gui,2:Show,,Clip It
	return
	
ItemSelectClip:
	GuiControlGet,SelectedItem2
	Gui,2:Destroy
	ClipBoard := SelectedItem2
	SoundBeep, 500
	return
	
2GuiClose:
	Gui,2:Destroy
	return	

Re: AutoHotKey Password

Posted: 18 May 2020, 10:51
by SKAN
My noobish code works in AHK 32 Unicode :dance:
Caution: 14 year old code: https://autohotkey.com/board/topic/11138-crazy-scripting-secret-numeric-labels/

Press * (numpad mult) for half-a-second to trigger UI
Passwords:
1111 will start Notepad.exe
12345 will start Calc.exe

Re: AutoHotKey Password

Posted: 18 May 2020, 10:59
by BoBo
SKAN wrote:
18 May 2020, 10:51
My noobish code works in AHK 32 Unicode :dance:
Caution: 14 year old code: https://autohotkey.com/board/topic/11138-crazy-scripting-secret-numeric-labels/

Press * (numpad mult) for half-a-second to trigger UI
Passwords:
1111 will start Notepad.exe
12345 will start Calc.exe
Well, it's SKAN-code. Wouldn't have expected something different :mrgreen: :thumbup: :lol:

Re: AutoHotKey Password

Posted: 24 May 2020, 08:26
by SKAN
JustBilly123 wrote:plz consider helping
I want to... Let me know if you want a rewrite of my script per your needs.
Script won't be that complicated if the latest InputHook() is used.

Re: AutoHotKey Password

Posted: 24 May 2020, 09:09
by dmg
This is probably far more complicated than you are looking for, but I wrote an app in AutoHotkey years ago that does this:
https://www.portablefreeware.com/index.php?id=2265

You set trigger codes and when you type them into a small prompt the app can execute programs, open files, load websites etc.

Re: AutoHotKey Password

Posted: 24 May 2020, 09:41
by BNOLI
@dmg Very nice option. Thx for sharing it :)