Instead of reinventing address book programs, why not take the approach of a hotkey that sits in the tray that will launch any shortcut?
I say shortcut because presumably that will allow any command line options, working directory etc., to be set without my hotkey having to worry about it.
Here's a super simple first attempt.
Default is F11 key.
First time you press the hotkey you have to select the shortcut.
You can change the hotkey via Tray Menu.
When the hotkey is quit from the tray it saves the shortcut and hotkey to .ini file.
At this point to change the shortcut you would either edit the .ini file manually
or just delete the .ini file and hit the hotkey again to select another shortcut.
For example, if I want to press F11 and have AudioGrabber pop up, I press F11 then navigate to the AudioGrabber shortcut to initialize it. After that, when the hotkey is running, every time I press F11 AudioGrabber pops up.
In your case you would navigate to your favorite address book.
Any clipboard pasting etc. should be a feature of the address book, not the launcher.
Try it and see if you like it. It's a bit crude but you should only have to initialize it once.
;
; Name: OneKey
; Author: MilesAhead
; Platform: Windows XP or later
;
; Script Function:
; A shortcut is opened when a (single) hotkey is pressed
; such as F11 etc..
;
; Menu command allows hotkey to be set by user.
;
; Note that if you try to change F11 to Alt-F11 it
; will fire the hotkey rather than change it. Until
; I learn the "ignore" setting, if there is one, the
; work-around is to set the hotkey to something that
; does not contain an active hotkey.
;
; Hotkey and shortcut is saved to ini file
; Hotkey can be specified on command line
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Menu Tray,NoStandard
Menu Tray,Add
Menu Tray,Add,About OneKey,DoAbout
Menu Tray,Add
Menu Tray,Add,Set Keyboard Hotkey,DoKeyboard
Menu Tray,Add
Menu Tray,Add,Quit,DoQuit
Menu Tray,Tip,OneKey to launch shortcut
IniFile = %A_ScriptDir%\%A_ScriptName%
IniFile := RegExReplace(IniFile,"i)ahk$","ini")
IniFile := RegExReplace(IniFile,"i)exe$","ini")
If 0 = 1
{
KHotKey = %1%
}
Else
{
KHotKey := "F11"
IniRead,KHotkey,%IniFile%,Settings,KeyboardHotkey,%KHotKey%
}
Hotkey,%KHotKey%,DoHotKey,UseErrorLevel
If ErrorLevel
{
MsgBox, 4112, OneKey, %KHotKey% is not a valid Hotkey
ExitApp
}
IniRead,shortcut,%IniFile%,Settings,Shortcut,%A_Space%
result := _EmptyWorkingSet()
return
DoHotKey:
If shortcut =
{
;MsgBox, 4112, OneKey, Shortcut not assigned!
FileSelectFile,shortcut,35,%A_StartMenuCommon%,Select Shortcut, shortcut (*.lnk)
}
If shortcut <>
{
Run,%shortcut%
}
Return
DoAbout:
FileGetVersion,filever,OneKey.exe
MyMsg =
(
OneKey v %filever% Copyright (c) 2011 www.FavesSoft.com`n
Press %KHotKey% to launch shortcut`n
)
MsgBox, 4160, About OneKey, %MyMsg%
Return
DoKeyboard:
Gui, Add, Hotkey, x6 y7 w140 h20 vHotkey,%KHotkey%
Gui, Add, Button, x156 y7 w110 h20 gGO , Set Hotkey
Gui, Show, w273 h39, Set Hotkey
Return
GO:
SaveKHotkey := KHotkey
Gui, Submit
KHotkey := Hotkey
;MsgBox, 0, , %KHotkey% is Hotkey
Gui,Destroy
Hotkey,%KHotkey%,DoHotKey,UseErrorLevel
If ErrorLevel
{
KHotkey := SaveHotkey
Hotkey,%KHotkey%,DoHotKey
}
Return
DoIniWrite:
IniWrite,%KHotKey%,%IniFile%,Settings,KeyboardHotkey
IniWrite,%shortcut%,%IniFile%,Settings,Shortcut
return
DoQuit:
GoSub,DoIniWrite
ExitApp
_EmptyWorkingSet()
{
Return DllCall("psapi.dll\EmptyWorkingSet", "UInt", -1)
}