Last active
December 8, 2023 22:07
-
-
Save iamkirkbater/ba6278d0ac6d695cb8c6c5fc309ba210 to your computer and use it in GitHub Desktop.
Launches OBS, starts the virtual camera, and then minimizes the window.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} -- remove this line if running in Script Editor and not with Automator | |
tell application "OBS" to activate | |
tell application "System Events" | |
tell process "OBS" | |
set frontmost to true | |
if name of every menu item of menu "Tools" of menu bar 1 contains "Start Virtual Camera" then | |
click menu item "Start Virtual Camera" of menu "Tools" of menu bar 1 | |
end if | |
click (first button of window 1 whose role description is "minimize button") | |
end tell | |
end tell | |
end run -- remove this line if running in Script Editor and not with Automator |
Thanks for the help and info.
Will give it a try.
Ray
On 19 Sep 2021, at 20:27, slln ***@***.***> wrote:
@slln commented on this gist.
I got it to work in the script! Im new to AppleScript and this is my first time on github so sorry if my lingo isn't worded right.
you have to set a hotkey to start virtual camera in OBS to F12.
then add the following to your code:
key down 63 -- fn
key code 111 -- f12
Also, I have made mine to do the following:
Open OBS
Start Virtual Camera
Open Multiview Windowed
Minimize main window
Open Zoom
Heres my full script for Script Editor:
tell application "OBS" to activate
tell application "System Events"
tell process "OBS"
set frontmost to true
key down 63 -- fn
key code 111 -- f12
if name of every menu item of menu "View" of menu bar 1 contains "Multiview (Windowed)" then
click menu item "Multiview (Windowed)" of menu "View" of menu bar 1
end if
click (first button of window 2 whose role description is "minimize button")
end tell
tell application "zoom.us" to activate
end tell
Thank you!
For those that want the very basic open, start vitural cam, then minimize and have, like me, little knowledge I managed to adapt the script above to the bare minimum need:
(remember 1st to activate F12 in settings>shortcuts of OBS)
tell application "OBS" to activate
tell application "System Events"
tell process "OBS"
set frontmost to true
key down 63 -- fn
key code 111 -- f12
click (first button of window 1 whose role description is "minimize button")
end tell
end tell
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <https://gist.github.com/ba6278d0ac6d695cb8c6c5fc309ba210#gistcomment-3898290>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ATHUP653MQ6WA6IZ4T7AWCDUCY2SFANCNFSM4QNTLBRA>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Here's a properly formatted option that is sligthly more minimalistic. Like mentioned above, for this to work in the latest version of OBS, you can make it work by setting a keyboard shortcut for "Start Virtual Camera".
Mine is F5.
I use Google meet, so at the end I switch focus to "Google Chrome" instead of "zoom.us". Same same.
Start virtual cam:
tell application "OBS" to activate
tell application "System Events"
tell process "OBS"
set frontmost to true
key down 63 -- fn
key code 96 -- f5
set visible to false
end tell
end tell
tell application "Google Chrome" to activate
Stop virtual cam & quit:
tell application "System Events"
tell process "OBS"
set visible to true
set frontmost to true
key down 63 -- fn
key code 96 -- f5
end tell
end tell
tell application "OBS" to quit
tell application "Google Chrome" to activate
^ Using this method locked the Option key on my Mac -- required the virtual keyboard to get unstuck
Try this method instead: https://stackoverflow.com/questions/3690167/how-can-one-invoke-a-keyboard-shortcut-from-within-an-applescript
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!
For those that want the very basic open, start vitural cam, then minimize and have, like me, little knowledge I managed to adapt the script above to the bare minimum need:
(remember 1st to activate F12 in settings>shortcuts of OBS)
tell application "OBS" to activate
tell application "System Events"
tell process "OBS"
set frontmost to true
key down 63 -- fn
key code 111 -- f12
click (first button of window 1 whose role description is "minimize button")
end tell
end tell