I am trying to write a macro for QuickTime Player X and it won't even show up as a application option. I tried writing Java like this and it still didn't work.
sf.ui.app('com.apple.QuickTimePlayerX').appActivate();
Here's the log:
16.06.2020 18:30:55.15 [Backend]: Logging unknown error in action (02) AppActivateAction: Value cannot be null. Parameter name: str
Error in line 0:
Error invoking app.activate
System.ArgumentNullException: Value cannot be null. Parameter name: str
at CFString..ctor(String, Boolean) + 0x6d
at Mac.AppKit.NSRunningApplication.GetRunningApplications(String) + 0x3d
at SoundFlow.Shortcuts.Automation.Actions.AppActivateAction.d__3.MoveNext() + 0x57
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
at sfbackend!+0xe5df0b
at sfbackend!+0xe5de36
at SoundFlow.Shortcuts.Automation.AutoAction`1.d__20.MoveNext() + 0x268
<< Command: SCREEN RECORD [user:cka5k7bd0000ebs1090w9ktyy:ckbio9fux0002ec10tf8dltw5]
- Dustin Harris @Dustin_Harris
try it like this:
sf.app.launch({ path: "/Applications/Quicktime Player.app", });
Maybe that'll do it?
Edit: the above script launches Quicktime if it's closed. If it's already open but not the focused app, your script will make it the focused app.
- JJonathan Grossman @Jonathan_Grossman
Thanks Dustin, but this won't open the app. btw - I'm on Catalina 10.15.5 using QuicktimeX
Dustin Harris @Dustin_Harris
Ahh, I hadn’t realized they switched things up in Catalina (which I can’t move to yet :( )
- In reply toJonathan_Grossman⬆:
Christian Scheuer @chrscheuer2020-06-18 14:50:54.545Z
Hi Jonathan. Are you trying to launch the app or to activate it if it's already open?
Dustin's method should work to launch the app, but it needs a valid path, and the paths changed in Catalina, so you'd need to update it with the valid path to the app.
- JJonathan Grossman @Jonathan_Grossman
open the app, dismiss a dialog box, choose menu option "new screen recording"
- In reply tochrscheuer⬆:JJonathan Grossman @Jonathan_Grossman
What is the correct path for Catalina? The QuickTime app doesn’t even come up as an option in the macros application drop down. Guess it has to be java?
Christian Scheuer @chrscheuer2020-06-18 18:23:30.275Z
I don't have Catalina so I can't help you directly.
But if you navigate to the application in Finder you can press Option+Cmd+C to copy its path to the clipboard.- JJonathan Grossman @Jonathan_Grossman
That worked...here's the code I used to open QT, dismiss the dialog box, put it into screen record
sf.app.launch({ path: "/System/Applications/QuickTime Player.app", }); sf.wait({intervalMs:500}); sf.ui.app('com.apple.QuickTimePlayerX').mainWindow.buttons.whoseTitle.is('Cancel').first.elementClick(); sf.keyboard.press({ keys: "ctrl+cmd+n", });
Christian Scheuer @chrscheuer2020-06-18 19:42:04.655Z
Brilliant! Thanks for sharing, Jonathan :)