# I've done it! Purge Kontakt RAM with a Keyboard Shortcut (Mac)



## David Kudell (May 26, 2021)

Kontakt doesn’t have a keyboard shortcut or a menu command to purge RAM, which makes it a laborious process when setting up a template. So I was excited to finally figure out how to do it using Keyboard Maestro on a Mac. I recorded a little video to show how to set it up. Hope this saves you some time! 

(Windows users, if you know of a program similar to Keyboard Maestro that will work let us know in the comments!)


----------



## givemenoughrope (May 26, 2021)

Ha I've had this very thought. Just navigating Kontakt in general could use some more KM shortcuts in general.


----------



## Loïc D (May 26, 2021)

Funny because I was about to do it also. I’m also on a macro to select each track and purge Kontakt.
Possible improvement : restore the original location of Kontakt window.

Anyway, at last, we can bless Kontakt for not being resizable !


----------



## David Kudell (May 26, 2021)

Loïc D said:


> Funny because I was about to do it also. I’m also on a macro to select each track and purge Kontakt.
> Possible improvement : restore the original location of Kontakt window.
> 
> Anyway, at last, we can bless Kontakt for not being resizable !


Yes! Definitely this could be built upon and automated further...you could have it go through and do a bunch of tracks at a time. I was thinking you could have it do like 10 at a time, but I imagine there's a way for it to keep going down the list of tracks until you hit a key to make Keyboard Maestro stop or something.

Restoring the window is an interesting idea, although in Cubase I find it odd how windows pop up in random locations anyway. This is where I wish Cubase had Logic's "link" button that would just show the currently selected track's instrument.


----------



## ProfoundSilence (May 26, 2021)

Same could be done with autohotkey


----------



## David Kudell (May 26, 2021)

Windows users! Adam Adams has posted his macro to do this with Auto Hotkey. Check it out here!









🇬🇧 Keyboard shortcut for KONTAKT “Purge Samples” function?!


Quick workaround to make your life easier




adam-adams.com


----------



## OLB (May 27, 2021)

Hi David, awesome idea and video! Really like your style. 

There's a simpler way for this without having to move the Kontakt windows. Just make a screenshot of the little 'floppy disk' icon in Kontakt and use the KM macro below. 






Add a 'Click at Found Image' action and then drag the screenshot into the grey square. 
A little tweak is to 'restore mouse location' and disable 'Notify on Failure' so it's seamless.

This will use the Global purge function which would be even better when using Kontakt multis.

Ohh the happiness we get from these little things.. thanks David!


----------



## Loïc D (May 27, 2021)

I found “Found image” less reliable than David’s method.
I’m working on a KM macro that applies an articulation on selected notes in Logic Pro.
It’s heavily relying on “Found image” and this is not 100% accurate.
I’m refining the settings over time and will publish it here as soon as I’ve got improved reliability.


----------



## David Kudell (May 27, 2021)

OLB said:


> Hi David, awesome idea and video! Really like your style.
> 
> There's a simpler way for this without having to move the Kontakt windows. Just make a screenshot of the little 'floppy disk' icon in Kontakt and use the KM macro below.
> 
> ...


Thanks! So actually it turns out you don’t even need that first step I used to move the window, which I didn’t realize...it will click a certain distance from the front window no matter where it is. So you can still do the second part of your macro which uses the disk icon / global purge, but you don’t need found image, just a simple click on the disk.


----------



## Manaberry (May 27, 2021)

For Windows, BOME MIDI translator and (as mentioned already) Auto Hot Key can do pretty much everything.


----------



## David Kudell (May 27, 2021)

Manaberry said:


> For Windows, BOME MIDI translator and (as mentioned already) Auto Hot Key can do pretty much everything.


Thank you, yes in the comments section of the YouTube video there’s a link to an Autohotkey shortcut that someone has made available as a download.


----------



## OLB (May 27, 2021)

David Kudell said:


> Thanks! So actually it turns out you don’t even need that first step I used to move the window, which I didn’t realize...it will click a certain distance from the front window no matter where it is. So you can still do the second part of your macro which uses the disk icon / global purge, but you don’t need found image, just a simple click on the disk.


Nice one, even better indeed!


----------



## Illico (May 28, 2021)

Nice workaround. The best feature Cubase (all DAW) should implement are an embedded Python macro player with access to some windows and objects API. There are lots of developer's 'geek' here that could implement a "Purge All Kontakt instances" in one click.


----------



## Zedcars (May 30, 2021)

If NI knew the lengths people were going to to get this set up perhaps they could spend an afternoon programming a hotkey into the interface. Maybe you could send them a feature request for a future update.

In the meantime, nice work there.


----------



## blaggins (Jul 19, 2021)

I'm attempting to use Adam Adams's AutoHotKey script with Cubase Pro 11 but for some reason the SHIFT + W and CTRL + SHIFT + W does nothing at all. I know AHK is intercepting the keypress because I cannot capture those strokes from within Cubase's own Key Commands setup, but nothing is happening and I'm not able to figure out what is going wrong. Anyone gotten it to work with Cubase? I figure I must be doing something stupid...


----------



## Wunderhorn (Jul 19, 2021)

Thank you for sharing!
If only Native Instruments was listening to what lengths user got to make such an important key command happen...

I wonder how this would work inside VEP, since Kontakt does not really pop out of it as separate window that can be moved around.

Also, I would assume that a lot of users are using multis in Kontakt and I noticed that you used the function to purge from a single patch instead of "global purge". It might involve another step to open the additional layer of the fly-out menu.


----------



## blaggins (Jul 19, 2021)

I solved my own problem (took more tiny flicks of the mouse and debug statements than I cared for...) If anyone else if having trouble getting Adam's script to work on a 4k monitor on Cubase Pro 11 on Windows 10 (not actually sure which of these has conspired to force my offsets to be something entirely different than what was in the original script), this should work for you:

`; KONTAKT PURGE Shortcut
; v1.02
; by Adam Adams ([email protected])
; minor updates to work on Cubase 11/Windows 10/4K monitor by tpoots (find me on vi-control.net)
#NoEnv
; #Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2
SetMouseDelay, 0
SetDefaultMouseSpeed, 1
#IfWinActive ahk_class SteinbergWindowClass ; We are matching Kontakt WITHIN Cubase
+w:: ; Shift + W
CoordMode, Mouse, Client ; Use active window as a point of reference for mouse clicks
CoordMode, Pixel, Client ; Use active window as point of reference for PixelGetColor
WinGetPos, Xpos, Ypos, Width, Height ; Use the ActiveWindow (the script only works in Kontakt within Cubase anyway, so your active window will be that Kontakt instance.)
PixelGetColor, kontakt1, Width-37, 65 ; Probing selected window to check if it's the KONTAKT instance
PixelGetColor, kontakt2, Width-52, 65 ;
; uncomment if checking hex values: MsgBox % "kontakt1 = " . kontakt1 . " , kontakt2 = " . kontakt2
if (kontakt1 = 0xc6c6c6 AND kontakt2 = 0xa2a2a2) {
PixelGetColor, master, Width-264, 110 ; check if the master controls are present
MasterOffset := 0 ; set a variable for offset
if (master = 0x36322C) { ; <-- this color doesn't match according to my eyes, but it seems to work
MasterOffset := MasterOffset+55 ; move the mouse additional pixels if the master section is opened
}
MouseGetPos, StartX, StartY ; Save starting mouse mosition, so it can come back to it later
MouseMove, Width-303, 160+MasterOffset ; Little arrow in the first instrument
Click
MouseMove, Width-303, 218+MasterOffset ; Purge samples
Click
MouseMove, StartX, StartY ; Return the mouse cursor to the starting position
}
return`


----------



## givemenoughrope (Jul 19, 2021)

givemenoughrope said:


> Ha I've had this very thought. Just navigating Kontakt in general could use some more KM shortcuts in general.


Although all my multis are saved purged..


----------



## David Kudell (Jul 19, 2021)

Wunderhorn said:


> Thank you for sharing!
> If only Native Instruments was listening to what lengths user got to make such an important key command happen...
> 
> I wonder how this would work inside VEP, since Kontakt does not really pop out of it as separate window that can be moved around.
> ...


Yes using the global purge is another option. Although I had a bit of trouble trying to create it this way. Someone told me they got it to work by inserting a few quick delays in the Keyboard Maestro since Kontakt doesn't quite keep up when you do it without the delays.

Personally I'm a single instrument/track guy, which I know some may think is wasteful of resources but I find it makes mixing and organization much faster and straightforward, although that's probably for another thread.


----------



## noisyneil (Aug 14, 2021)

GREAT idea! I've done my own twist on it. I press a button on my Stream Deck and it loads a channel strip preset with a Kontakt instrument loaded, then automatically purges the instrument straight away. 

View attachment vid.mp4


If you fancy trying it, my KM macro is attached and I explain the preset-loading part of it HERE.


----------

