Audio Hijack 3.7.2; Help Requested to Stop Session while Screensaver is Active

So, I'm sure I'm not the only one who was devastated when Audio Hijack 3 inexplicably dropped AppleScript support; I've been able to use KM and GUI scripting to overcome much of the loss, but one extremely frustrating limitation remains (for me):

When Screensaver is active and password-locked, KM cannot send a keystroke or execute a menubar command in AH; thus I cannot Stop a Session in progress automatically based on conditions or timer; yes, I can end the length of the file created based on time in AH, but the actual Session continues until manually stopped.

This has the extremely undesirable effect of preventing Computer Sleep. When I'm not sleeping, I can respond to a push notification that the Session has ended, return to my office, unlock the screen, and manually end the Session(s), then either Sleep my Mac Pro or just allow it to enter Sleep by timer. I prefer not to do this when I'm home and/or sleeping, though I can remote in to do just that, if I'm not unconscious or too irritated to do so.

Does anyone have any suggestions to workaround this problem? I prefer not to unlock the screen for security purposes; and though it's effective, I dislike force-quitting AH to end the Session (my current solution).

My fully-loaded Mac Pro is a massive heat pump and I'm not a fan of wasting energy for hours, if not days. I'm still on Mojave, if it matters.

I am a AH user, can you show what scripting you are using? I didn’t even know they released AppleScript support, where is the documentation?

I’m afraid you have misread my post; there is no AppleScript support in Audio Hijack v3; it is only in v1 & v2; that is my problem; I can no longer script session start and stop among other things.

I’m sorry you’re right, I read too quickly. How exactly are you using KM and GUI scripting to control AH?

As long as the screen is awake, you can trigger any command from the Menubar or contextual menus; you can use GUI scripting and Found Image to Control any block in any Session window, or control actions in the main application window. I use it to turn audio blocks on and off, auto fill metadata tags, start/stop/split Sessions, change inputs/outputs/filters/effects/sources, etc., move window positions, set timers, and more. Basically, if you can do it with a mouse or keyboard, it can be scripted. You just can’t do it while behind a screensaver.

Unfortunately I do not think this can be achieved.

I have been complaining about the lack of AppleScript support (even start/end session would be something) since AH3 came out, and keep getting told that it's on their list, but no time table, yada yada. Clearly it's not happening if it hasn't happened by now.

I still use Audio Hijack Pro on my old iMac running El Capitan in part because I can use AppleScript!

1 Like

I'm just living with a kill -9; as long as the recording is completed by timer, AH doesn't seem to care if it gets murdered. It just feels wrong, though. Discovered a few other apps/processes keeping my MP awake, too; figuring out the best way to handle them. I'd hate to have to kill every offending process.

I came here looking for a solution to a similar request (and didn't find a solution here), so I tested the following two lines of ApplesScript, and they will a) activate AH, and b) issue the keyboard command to start/stop the current session. It has worked for me with no issues. I hope this helps someone else.

tell application "Audio Hijack" to activate
tell application "System Events" to keystroke "r" using {command down}
1 Like

But will the AppleScript lines work if the screensaver is active (locked)?

No bets – must test...  :sunglasses:

1 Like

No. AppleScript will not work if the screensaver is active and the computer is locked (requiring the password). The sending of the keystroke listed above would at best be sent to the password field. It might be possible to script entering the actual password to deactivate the screensaver, but I have not tested that (there are some online search results that suggest it is possible). If you are able to enter the screensaver pwd via script, then you could use the lines above to issue the AH keystroke to start/stop the session and then you can also restart the screensaver via AppleScript. However, the computer would be momentarily unlocked during that time.