In Microsoft Teams you can organize your Contacts a bit in a flat structure. But still, it takes quite a few clicks to call or chat with a favorite contact. Wouldn't it be cool if you could do such from a launcher bar? I present here a solution for it.
Screencast
Usage
From any selection where emails can be parsed, even multiple selections you can create favorites using one of the 3 ways described below:
People Connector PowerTool
Select something containing email addresses (e.g. also in Outlook Addressees Fields To, CC), run the People Connector with Double Tap Shift and select the menu entry "Add to Teams Favorites" (accelerator key f)
Teams Shortcuts PowerTool
In the Teams Shortcuts System Tray Icon menu, there is an entry named "Add to Teams Favorites (Contacts)
Teamsy Launcher
From Teamsy Launcher the keywords to add a favorite based on emails selected is e2f (email to favorites or p2f (people to favorites)
Launcher integration
To get the favorites displayed in your application launcher e.g. Executor, you need to add the folder where they are located to be scanned / indexed.
You need both file types: .lnk (for Call) and .url (for Chat)
Technical/ Implementation Notes
Call shortcut
A command to place a call looks like this: Run "%TeamsExe% callto:%sEmail%"
based on the callto: protocol. Normally the callto protocol shall be assigned to the Teams application but in some cases your IT might not have it configured properly.
The script creates a .vbs file and then a shortcut to the vbs file with a nice Teams.exe icon.
A VBS script runs without lefting over any command window, contrary to a .bat file for example.
Chat shortcut
A chat shortcut is based on following deep link: https://teams.microsoft.com/l/chat/0/0?users=%sEmail%
The protocol is changed to msteams:// to open the link directly in the desktop client.
AutoHotkey Code
You can find the main AutoHotkey code implementing this functionality in ahk/Lib/Teams.ahk -> Teams_Emails2Favs (function)
Below an extract of the code (might not be the latest version)
Teams_Emails2Favs(sEmailList:= ""){
; Calls: Email2TeamsFavs
If (sEmailList ="") {
sSelection := People_GetSelection()
If (sSelection = "") {
TrayTipAutoHide("Teams: Email to Fav!","Nothing selected!")
return
}
sEmailList := People_GetEmailList(sSelection)
If (sEmailList = "") {
TrayTipAutoHide("Teams: Email to Fav!","No email could be found from Selection!")
return
}
}
RegRead, FavsDir, HKEY_CURRENT_USER\Software\PowerTools, TeamsFavsDir
If ErrorLevel {
FavDirs := Teams_FavsSetDir()
If FavDirs = ""
return
}
FileSelectFolder, FavsDir , *%FavsDir%, ,Select folder to store your Teams Contact Shortcuts:
If ErrorLevel
return
Loop, parse, sEmailList, ";"
{
Email2TeamsFavs(A_LoopField,FavsDir)
}
Run %FavsDir% ; open Favorites directory
} ; eofun
; ----------------------------------------------------------------------
Email2TeamsFavs(sEmail,FavsDir){
; Calls: Teams_Link2Fav
; Get Firstname
sName := RegExReplace(sEmail,"\..*" ,"")
StringUpper, sName, sName , T
; 1. Create Chat Shortcut
sUrl = https://teams.microsoft.com/l/chat/0/0?users=%sEmail%
Teams_Link2Fav(sUrl,FavsDir,"Chat " + sName)
; 2. Create Call shortcut
sFile := FavsDir . "\Call " . sName . ".vbs"
; write code
TeamsExe := Teams_GetExe()
sText = CreateObject("Wscript.Shell").Run "%TeamsExe% callto:%sEmail%"
; Create empty File
FileDelete %sFile%
FileAppend , %sText%, %sFile%
; create shortcut
sLnk := RegExReplace(sFile,"\..*",".lnk")
FileCreateShortcut, %sFile%, %sLnk%,,,, %TeamsExe%
} ; eofun
No comments:
Post a Comment