cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
phodges Visitor
Visitor

AutoHotKey Script for auto-refresh in Power Bi Desktop

Hello Community,

 

I have written a script in AutoHotKey for Power Bi Desktop to auto-refresh by hiting Alt - H - R. This is a combination that does work in Power Bi Desktop when done manually. The AutoHotKey code I wrote is below. This code works within Microsoft Word (r activates the replace command) and Excel (not r, but tried it with x, which activates the Cut command), but will only open the Power Bi window and will not activate the refresh button. Does anyone have an idea as to why it will not work in Power Bi Desktop?

 

--------------------------------------------Code----------------------------------------------------------------------------

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

 

#Persistent
SetTimer, PressTheKey, 30000     ;Refresh every 30 secs (Power Bi Desktop cannot do this and this is important for                                                          ;what I am trying to do)
Return

 

PressTheKey:
if WinExist("Test File")
{
WinActivate       ;Activate the window (if it is not the current window it will reopen it and allow you to work in it)
WinMaximize     ;Maximize window
Send !hr             ;Alt h r keys
}

 

Esc::ExitApp      ;Press "Esc" key to end code
return

-----------------------------------------------------------------------------------------------------------------------------

 

P.S. If anyone knows a shortcut key for refresh in Power Bi Desktop that would be helpful too.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 38 members 978 guests
Please welcome our newest community members: