SceneSwitcher icon indicating copy to clipboard operation
SceneSwitcher copied to clipboard

Can't Trigger AppleScripts

Open ukiews opened this issue 2 years ago • 7 comments

Describe the bug When trying to run an AppleScript app from the "Run" Command, Mac shows error:

Screen Shot 2023-02-10 at 4 41 02 PM

Version information OSX 10.15.7

  • OBS Version 29.0.2
  • Plugin Version 1.20.4

Additional context Already mentioned in the Discussion of Forum, but issue still persists.

ukiews avatar Feb 11 '23 00:02 ukiews

Thanks for reporting the issue here again - makes tracking it a bit easier. I have the suspicion that the location where the plugin is installed makes the difference, but I haven't gotten around to testing it yet.

Update: Installing the plugin in /Library instead of ~/Library also does not seem to make a difference Sorry for being so slow in tracking this down ... :(

WarmUpTill avatar Feb 13 '23 18:02 WarmUpTill

Checking in again. Any possible work around? Is no one else using apple scripts...

ukiews avatar Feb 27 '23 22:02 ukiews

Maybe this will help? https://developer.apple.com/forums/thread/108815

ukiews avatar Mar 04 '23 02:03 ukiews

I also suspect that it is related to the entitlements. Adding the corresponding permissions to the plugin does not seem to have any effect however. So it might be that the entitlements set of OBS itself needs to be adjusted.

Unfortunately I am not sure how to test / confirm this yet. I am unable to modify the existing entitlements of the OBS package without it becoming unusable for some reason. Disabling the signature checking is also not possible in the VM setup I am using as entering the recovery mode of MacOS does not seem to work.

I will try to look into it further once I figure this out.

WarmUpTill avatar Mar 04 '23 18:03 WarmUpTill

Thank you!

ukiews avatar Mar 08 '23 20:03 ukiews

Unfortunately I am at a bit of a loss on how to continue here.

I tried adding the following entitlements to OBS itself or to the plugin, but both resulted in the application no longer being able to start at all (even when compiling OBS and the plugin locally in the VM where I am attempting to start it).

<key>com.apple.security.automation.apple-events</key>
<true/>
<key>NSAppleEventsUsageDescription</key>
<string>Advanced scene switcher needs additional permissions to be able to run AppleScript applications</string>

OBS

I am not sure what lead to this change in behaviour, but for now I have no clue how to re-enable the functionality to run apple scripts from within OBS / the plugin.

If anyone is more experienced in regards to this and reads this, any help or hints would be much appreciated. :)

WarmUpTill avatar Mar 22 '23 18:03 WarmUpTill

Lua scripts can be used to run AppleScripts and other commands.

I modified a lua script that Advanced Scene Switcher can use to send command lines. Please try this gist.
https://gist.github.com/UUoocl/8aca085e91eb48c3a8284d9d632319d4 I've successfully tested several command-lines.

Example Macro image

Script sequence diagram

sequenceDiagram
    Adv.SS->>Text Source: Set text to command-line
    Adv.SS->>Lua Script: Run the Hotkey Command Script
    Lua Script->>Text Source: Get command-line text
    Lua Script->> Lua Script: Run Command-line

UUoocl avatar Mar 25 '24 00:03 UUoocl