Microsoft Teams Logo

Publish content to your screens directly from Microsoft Teams

Learn More ScreenCloud Banner Arrow
ScreenCloud Close Icon
Login
Free Trial
EnterprisePricingCustomers
Free TrialSign in

On Screen

What is Screencloud Icon
What is Screencloud
ScreenCloud Content Management Icon
Content Management
ScreenCloud Dashboards Icon
Dashboards
ScreenCloud Integrations Icon
Apps & Integrations

Manage

ScreenCloud OS Icon
ScreenCloud OS
ScreenCloud Hardware Icon
Hardware
ScreenCloud Security Icon
Security
Resources
>

Create Keyboard Shortcuts That Work Even When An App Isn’t Open

With AutoHotKey, you can automate app interactions, send text commands, and even interact with webhooks.

ScreenCloud Post Image

Almost every modern web app comes with dozens of integrations. Send web form responses to a spreadsheet to create a DIY CRM. Connect a company calendar to a database to welcome office visitors with digital signage. You’re almost always one or two integrations away from building a no-code app. 

But automation is nothing new. Before Zapier, Make, and Power Automate, the best way to automatically run through a handful of steps was with locally installed software. That’s still the best way to automate desktop tasks that you start with a click or keyboard shortcut. 

There are a few macro tools for Windows, but few can compete with AutoHotKey. Its relatively easy scripting language means you can, for example, create a keyboard shortcut that sends text from your clipboard to a webhook endpoint that will update a DIY dashboard.

Why use AutoHotKey and not a cloud-based connector?

AutoHotKey is a macro tool that lets you create keyboard shortcuts that kick off any number of keystrokes or mouse movements. While that sounds pretty basic, the implications are incredible.

As a simple example, you could set up a ‘script’ that watches your keystrokes for a predetermined phrase like ‘mynatm’. Any time you typed that series of letters, AutoHotKey would automatically replace it with your name, address, and telephone number. Countless browser extensions and apps like Text Expander do this. AutoHotKey is almost always better because it’s totally free, it’s capable of far more than this basic example, and creating scripts takes a matter of minutes once you know what you’re doing.

So it’s not that AutoHotKey is better than Zapier and Power Automate. There are some things that AutoHotKey can do that API-based automation platforms cannot do, and vice versa. If you want to manually kick off an automation with a keyboard shortcut, use AutoHotKey. Whereas automations that should happen automatically, any time someone sends you something or app data is updated, are better for API automation. When deciding which route is best, consider the following:

  • Cost - Browser-based automation tools, like all web apps, need to generate revenue. Keeping Zapier running requires a ton of computing power and staff. AutoHotKey, on the other hand, is 100% free and open-source.
  • Best starting point - It’s not always intuitive connecting one API to another, which often feels like a more restrictive type of automation and less room to play around. With AutoHotKey, you can automate virtually anything that you would do with your keyboard and mouse. 
  • Flexibility - With its own scripting language, AutoHotKey falls squarely on the low-code side of the low-code vs no-code debate. No-code solutions are great but can be hard to troubleshoot and sometimes short on features. AutoHotKey scripts may be closer to BASIC than Python, but in some ways, they’re more flexible than something like Softr or Bubble.

That’s all well and good, but how does any of this apply to cloud-based digital signage use cases? Well, you could create a keyboard shortcut that opens your web browser, logs into the ScreenCloud web app, clicks on the Media tab, and opens the Upload window. With the inclusion of cursor movements, that might end up being more advanced than creating an Apple Shortcuts automation

But let’s start with a more straightforward AutoHotkey script. We’ll send data from your clipboard to your screens to build live dashboards that update whenever you press a keyboard shortcut.

Creating An AutoHotKey Script

Before you can do anything with AutoHotKey, you’ll need to download and install the latest stable version. And you should probably familiarize yourself with the documentation, as well.

After opening the AutoHotKey Dash program, there are a few things worth checking out. The Window spy tool gives you information about cursor coordinates on the screen, open window titles, positions, and colors. All of which helps when writing more advanced scripts. 

The AutoHotKey dashboard also has a Launch settings tab that you may want to write scripts using the older v1 syntax. For example, ChatGPT is excellent at writing v1 code but not up to speed on v2.

When you’re ready, click the New script button from the dashboard, give it a name, and hit the Edit button. That will open a blank Notepad document where you can start adding code. In most cases, the script will start by defining the keystroke that will kick things off, so consider learning about that language first. Most people stick with the common keyboard shortcut keys (e.g., Shift, Alt, Ctrl, etc.). 

Some basic functions include Send, which will emulate key presses and mouse actions, Run, which opens locally installed programs, and Sleep, which will pause the script before continuing. Using all three would look like this:

#Requires AutoHotkey v2.0
^m::{
Run "https://www.gmail.com"
Sleep 3000
Send "c"
Sleep 3000
Send "bob@tester.com"
}

You’d save the file with .ahk at the end, then double-click it to start watching for the shortcut. Any time you press Ctrl+m, it will open gmail.com, wait three seconds, emulate the c button, wait three seconds, and simulate typing bob@tester.com. There are more than 300 commands and functions available. We’ll use some of the more advanced ones to show how you update digital signage content without opening the app itself.

Starting From Scratch With Playgrounds

Most programming intros start with a “Hello World” example. They do that to let you get your hands on something that works as quickly and easily as possible by removing clutter.

Let’s do that with ScreenCloud’s Playgrounds app and AutoHotKey. Basically, we’ll make a keyboard shortcut that will take the last thing you selected and copied, then pass it along to your digital signage. All without even opening a browser.

Start by signing up for ScreenCloud if you haven’t already. Then add the Playgrounds app by clicking on the Apps tab from the left-hand menu and searching for Playgrounds. Open the app, click the New Instance button, and choose either Start with a blank template or click the X in the upper right corner of the template window.

Whatever you put in the JavaScript, CSS, and HTML columns will be hosted and rendered as a webpage for your digital signage. For the AutoHotKey example, paste this code into your JavaScript column:

<const render = data => {
    var background = data.background.replace(/(&nbsp;)+/g, '') //de-sanitize the background image
    var bgStyle = {
        background: `url(${background}) no-repeat center center fixed`, //use the background image from the application data in CSS
        height: "100vh"
    }

        // replace the "root" HTML element with the following and style it
    ReactDOM.render(
        <div class="root-image" style={bgStyle}>
        </div>,
        document.getElementById("root")
    )
}
getData().then(data => render(data)); // call the promise to retrieve application data

As written, that JavaScript won’t work unless we send data to ScreenCloud’s Application Data URL. You’ll need that for the AutoHotKey script, so click the Application Data button in the top right corner of your Playgrounds screen and copy the URL at the bottom of the new window that pops up. Make sure to hit the Save & Close button. Now it’s time to start working in AutoHotKey.

Open a blank Notepad file, paste this AutoHotKey, and save it as “webhook shortcut.ahk” to send your clipboard data to ScreenCloud Playgrounds:

#Requires AutoHotkey v2.0
WinHTTP := ComObject("WinHTTP.WinHttpRequest.5.1") ; use Windows' COM object for making HTTP calls
dataUrl := "https://api-playgrounds.screencloudapps.com/data/743c0c9d-" ; put your ScreenCloud Application Data URL between the quotes
; we'll attach the call to Win-Shift-j as it's unlikely to have conflicts
#+j:: 
{
  data := '{ "data": { "background": "' . A_Clipboard . '" } }' ; this is the JSON to be sent to ScreenCloud
  MsgBox '' . data ; this pops up a message box to help you make sure your JSON is formatted properly
WinHTTP.Open("PUT", dataUrl) ; open a connection to ScreenCloud Playgrounds
WinHTTP.Send(data) ; send off your JSON data
}

Copy this Wikimedia image URL:

https://upload.wikimedia.org/wikipedia/commons/4/4e/Italian_cuisine_background-1932466_1920.jpg

Press Win+Shift+J then go log into ScreenCloud and see if it updated your Playgrounds page.

Going Further With GraphQL

Playgrounds is super flexible. But if you updated the background image while your Playgrounds page was shown on your signage, you wouldn’t see the change. You’d need ScreenCloud to cycle to another page and come back to reload Playgrounds (or set the content again from the dashboard). That can be fixed with ScreenCloud’s robust GraphQL API and AutoHotKey. 

Building a cURL Call the Easy Way

The easiest way to build GraphQL calls and convert them for AutoHotkey is with Postman, an API tool. Its built-in GraphQL assistant can help you build out API calls, then its HTTP call tool can convert the GraphQL JSON for cURL.

First, we’ll need to find out our screen’s ID number. Then we can use Screencloud’s GraphQL refreshScreensByScreenIDs mutation to refresh the screen.

If you’ve never used Postman and GraphQL before, check our Beginner’s Guide to GraphQL to get started. Then in Postman, make a new request, select GraphQL, add the ScreenCloud GraphQL endpoint and your Bearer Token for authorization. Now, check the AllScreens query—along with the name and ID fields under the Nodes option. Run that query, and copy the ID number of your screen in the response.

Now you can build a mutation to refresh the screen. Clear out your current selection, and this time choose the refreshScreensByScreenIDs mutation instead. In the query tab, replace the “null” text with your screen’s ID number wrapped in quotes. Run the query, and ScreenCloud will refresh the screen.

You can then get Postman to convert this call to use in an AutoHotkey cURL workflow. Just add a new tab in Postman, and this time select an HTTP Put request. Copy in your GraphQL API endpoint URL, and in the Authorization settings, choose Bearer Token and paste in your API key. Finally, in the Body, choose a GraphQL body, and paste in the query from the GraphQL tab.

Now, click the </> button in the right sidebar, and you’ll see cURL code ready to copy. Click the gear icon and check that your settings match those in the screenshot below, then copy the generated code.

Back to AutoHotKey

All of that may take some practice, but for this example, the work has been done for you. Add this to the end of your AutoHotKey script:

curlCmd := 'curl -L "" -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_TOKEN" -d "{\\"query\\":\\"mutation RefreshScreensByScreenIds { refreshScreensByScreenIds(screenIds: \\\\\\"YOUR_SCREEN_ID\\\\\\") { error } }\\"}"'
#+k::
{
  RunWait "cmd /c " . curlCmd , , "Hide"; this line opens up the command console in the background and sends the cURL command from it
}

There are two places where you’ll need to replace some text in the curlCmd variable:

  • YOUR_API_TOKEN
  • YOUR_SCREEN_ID

If you did everything right, you can see this in action. Visit the page or device where your screen is being broadcast and hit Win-Shift-k to refresh.

It’s a basic example, but it’s good for introducing the concept of GraphQL queries with AutoHotKey. Once you’re more comfortable with the process, try more advanced mutations like castStart to cast content from your computer to a screen or inviteUser to invite a new user to your ScreenCloud account – all with a custom keyboard shortcut.

You’ve Only Just Begun

ScreenCloud by itself is an incredibly useful and versatile tool. But it becomes a total DIY powerhouse when you think of all the ways it can be hacked on:

Digital signage is useful for so much more than just restaurant menu board and internal communication updates. It’s a blank canvas for you to inform and engage your target audience with the hardware and content you’re already using. And it all starts with a 14-day free trial.

 SC Gradient

Ready to get your organization connected?

Connect your first screen today with our 14-day free trial

Free TrialBook Demo
articles