Some modification based on your ogirinal one
1) Unify the subroutine send key label (%A_GuiControl%) instead
2) wait left-click to trigger (KeyWait, Lbutton, D T3)
=> don't have to wait for full 3 seconds
3) Click tray icon to show/hide the GUI
4) GUI always on top
Code:
Menu, Tray, NoStandard
Menu, Tray, Add, Auto Fill, TrayClick
Menu, Tray, Add,
Menu, Tray, Standard
Menu, Tray, Default, Auto Fill
Menu, Tray, Click, 1
Gui, Add, Button, x2 y2 w100 h20 gH_Button, first name
Gui, Add, Button, x2 y22 w100 h20 gH_Button, last name
Gui, Add, Button, x2 y42 w100 h20 gH_Button, address 1
Gui, Add, Button, x2 y62 w100 h20 gH_Button, address 2
Gui, Add, Button, x2 y82 w100 h20 gH_Button, city
Gui, Add, Button, x2 y102 w100 h20 gH_Button, state
Gui, Add, Button, x2 y122 w100 h20 gH_Button, zip
Gui, Add, Button, x2 y142 w100 h20 gH_Button, phone
Gui, Add, Button, x2 y162 w100 h20 gH_Button, @email.com
Gui, Add, Button, x2 y182 w100 h20 gG1Button, pwd
Gui, +AlwaysOnTop
Gui, Show, x1160 y89 h206 w117, New GUI Window
Return
GuiSize:
If A_EventInfo <> 1 ; Minimized
Return
GuiClose:
Gui, cancel ; hide the window
return
H_Button:
Sleep,200
KeyWait, Lbutton, D T3
Sleep,200
if !ErrorLevel
Send, %A_GuiControl%
Return
;-----------------
G1Button:
Sleep,200
KeyWait, Lbutton, D T3
Sleep,200
if !ErrorLevel
Send, password
Return
TrayClick:
GuiControlGet, isVisible, Visible, pwd
if isVisible
Gui, Cancel
else
Gui, Show
return