Skip to content

Instantly share code, notes, and snippets.

@tdalon
tdalon / Jira.pq
Last active October 6, 2020 16:37
PowerBi / PowerQuery Jira Template
let
// Get total
Source = Json.Document(Web.Contents(JiraRootUrl&"/rest/api/2/search?jql=filter="&JiraFilterId&"&maxResults=1&fields=["&JiraFields&"]")),
total = Source[total],
GetChunk = (previousTable, maxResults as number) as table =>
let
startAt = if previousTable = null then 0 else Table.RowCount(previousTable) + 1,
maxRes = if (maxRows - startAt < maxResults) then maxRows - startAt else maxResults,
MergedTable = if (startAt > total) or ((maxRows>0) and (startAt > maxRows)) then previousTable else
@tdalon
tdalon / CopyToTasksCalendar.bas
Last active October 12, 2020 06:58
Copy Outlook Email to Tasks Calendar
' https://tdalon.blogspot.com/2020/10/outlook-email-to-tasks-calendar.html
Public Sub CopyToTasksCalendar()
' Calls GetCurrentItem
Dim objAppt As Outlook.AppointmentItem
Dim Item As Object ' works with any outlook item
' OPTIONS
Dim bAskAttach As Boolean
bAskAttach = False ' Change to True if you want to be asked to attach. Preferred: False and keep link
@tdalon
tdalon / Jira_Export_Filter.bas
Last active April 30, 2021 03:38
Export Jira Filter to an Excel Table
Public Function GetPassword() As String
' Get password from file stored in user profile as Proof of concept. Do not do in your work organization (Password shall be encrypted)
File = Environ("userprofile") & "\password.txt"
'Read output tmp File
Set FSO = CreateObject("Scripting.FileSystemObject")
Set ts = FSO.OpenTextFile(File, 1)
Password = ts.ReadLine
ts.Close
Password = Trim(Password)
GetPassword = Password
@tdalon
tdalon / Teams_GetMainWindow.ahk
Last active October 13, 2023 12:18
AutoHotkey Script to Get Main Microsoft Teams Window
Teams_GetMainWindow(){
; See implementation explanations here: https://tdalon.blogspot.com/get-teams-window-ahk
; Syntax: hWnd := Teams_GetMainWindow()
WinGet, WinCount, Count, ahk_exe Teams.exe
If (WinCount = 0)
GoTo, StartTeams
If (WinCount = 1) {
@tdalon
tdalon / Workspace.ahk
Created January 27, 2021 12:48
AutoHotkey script to manage application workspaces
; Source: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=17228
#SingleInstance,Force
global settings:=new xml("Workspace")
if(FileExist("workspaces.ico"))
Menu,Tray,Icon,Workspaces.ico
Gui()
return
show:
WinShow,% hwnd([1])
return
@tdalon
tdalon / NotifyTrayClick.ahk
Created February 1, 2021 21:40
NotifyTrayClick AutoHotkey function to customize tray icon click actions
NotifyTrayClick(P*) { ; v0.41 by SKAN on D39E/D39N @ tiny.cc/notifytrayclick
Static Msg, Fun:="NotifyTrayClick", NM:=OnMessage(0x404,Func(Fun),-1), Chk,T:=-250,Clk:=1
If ( (NM := Format(Fun . "_{:03X}", Msg := P[2])) && P.Count()<4 )
Return ( T := Max(-5000, 0-(P[1] ? Abs(P[1]) : 250)) )
Critical
If ( ( Msg<0x201 || Msg>0x209 ) || ( IsFunc(NM) || Islabel(NM) )=0 )
Return
Chk := (Fun . "_" . (Msg<=0x203 ? "203" : Msg<=0x206 ? "206" : Msg<=0x209 ? "209" : ""))
SetTimer, %NM%, % (Msg==0x203 || Msg==0x206 || Msg==0x209)
? (-1, Clk:=2) : ( Clk=2 ? ("Off", Clk:=1) : ( IsFunc(Chk) || IsLabel(Chk) ? T : -1) )
@tdalon
tdalon / Gmail Compose.ahk
Created February 3, 2021 13:16
AutoHotkey script to compose a Gmail email in a popped out window.
#SingleInstance force
SetTitleMatchMode, 2
ComposeTitle = Compose Mail -
If WinExist(ComposeTitle . " ahk_exe chrome.exe") {
WinActivate
return
}
; Loop on all Chrome Windows
@tdalon
tdalon / Gist New.ahk
Last active February 8, 2021 09:33
AutoHotkey script to create a Gist
; See related blog post https://tdalon.blogspot.com/2021/02/ahk-create-gist.html
#Include <Jxon>
#SingleInstance force
Token := PowerTools_GetSetting("GitHubToken")
If (Token="")
return
WinGetTitle, Title , A ;Get active window title
RegExMatch(Title,"(.*\\)?([^\\]*)\.([^\s]*)",filename) ;Try to isolate the file name from Window title with RegEx
@tdalon
tdalon / Teams_GetMeetingWindow.ahk
Created February 16, 2021 07:49
Get Teams Meeting Window
Teams_GetMeetingWindow(){
; See implementation explanations here: https://tdalon.blogspot.com/get-teams-window-ahk
WinGet, Win, List, ahk_exe Teams.exe
TeamsMainWinId := Teams_GetMainWindow()
TeamsMeetingWinId := PowerTools_RegRead("TeamsMeetingWinId")
WinCount := 0
Select := 0
Loop %Win% {
WinId := Win%A_Index%
@tdalon
tdalon / Teams_MuteApp.ahk
Created February 19, 2021 14:26
AutoHotkey function to mute Teams desktop client including Speaker/ Audio input using NirSoft SoundVolumeView
Teams_MuteApp(sCmd:= ""){
Switch sCmd
{
Case "s","sw","switch":
sCmd = /Switch
Case "on","1":
sCmd = /Mute
Case "off","0":
sCmd = /Unmute
Default :