-
Notifications
You must be signed in to change notification settings - Fork 0
/
RSATokenAutomation.ahk
51 lines (44 loc) · 1.68 KB
/
RSATokenAutomation.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
;; RSA Token Automation.ahk
;; # autohotkey.exe
;; # Ref: http://www.autohotkey.com/board/topic/59612-simple-debug-console-output/
DebugMessage(str)
{
global h_stdout
DebugConsoleInitialize() ; start console window if not yet started
str .= "`n" ; add line feed
DllCall("WriteFile", "uint", h_Stdout, "uint", &str, "uint", StrLen(str), "uint*", BytesWritten, "uint", NULL) ; write into the console
WinSet, Bottom,, ahk_id %h_stout% ; keep console on bottom
}
DebugConsoleInitialize()
{
global h_Stdout ; Handle for console
static is_open = 0 ; toogle whether opened before
if (is_open = 1) ; yes, so don't open again
return
is_open := 1
; two calls to open, no error check (it's debug, so you know what you are doing)
DllCall("AttachConsole", int, -1, int)
DllCall("AllocConsole", int)
dllcall("SetConsoleTitle", "str","Paddy Debug Console") ; Set the name. Example. Probably could use a_scriptname here
h_Stdout := DllCall("GetStdHandle", "int", -11) ; get the handle
WinSet, Bottom,, ahk_id %h_stout% ; make sure it's on the bottom
WinActivate,Lightroom ; Application specific; I need to make sure this application is running in the foreground. YMMV
return
}
;; RSA
Run, "C:\Program Files (x86)\RSA SecurID Software Token\SecurID.exe"
WinWait, ComcastVPN - RSA SecurID Token,
IfWinNotActive, ComcastVPN - RSA SecurID Token, , WinActivate, ComcastVPN - RSA SecurID Token,
WinWaitActive, ComcastVPN - RSA SecurID Token,
;; 2222 is the PIN Code
Send, 2222
Sleep, 100
Send, {ENTER}
Sleep, 100
;;Send, {CTRLDOWN}c{CTRLUP}
Send, ^c
Sleep, 100
X := clipboard
DebugMessage(X)
Send, {ALTDOWN}{F4}{ALTUP}
return