MarioMey / obs-osc-pythonscript

Receive/send OSC messages from/to OBS.
GNU General Public License v3.0
0 stars 0 forks source link

LD_PRELOAD in Windows? #1

Open baesek opened 2 years ago

baesek commented 2 years ago

How or can i use this script for OBS running on Windows 10? I tried to follow your instructions, but I don't know how to start OBS with LD_PRELOAD. I assume I somehow have to put the line C:/Program Files/Python37/python37.dll somewhere.

MarioMey commented 2 years ago

I use Debian and I have a Windows 10 partition to test... but, before rebooting my computer and test it by myself, try this: https://support.shotgunsoftware.com/hc/en-us/articles/114094235653-Setting-global-environment-variables-on-Windows. If it doesn't work, tell me: we gonna find the way.

baesek commented 2 years ago

Hi Mario! Thanks so much for your fast response. This is what I tried, I added your script in the Tools/Scripts menu of abs and added the path to my python installation in the next tab there too. (C:\Program Files\Python37) then I ran the code on the left bottom of the screenshot below. But the scene did not change by doing so. Greetings from Hamburg, Germany

Am 11.08.2021 um 20:20 schrieb Mario Mey @.***>:

I use Debian and I have a Windows 10 partition to test... but, before rebooting my computer and test it by myself, try this: https://support.shotgunsoftware.com/hc/en-us/articles/114094235653-Setting-global-environment-variables-on-Windows https://support.shotgunsoftware.com/hc/en-us/articles/114094235653-Setting-global-environment-variables-on-Windows. If it doesn't work, tell me: we gonna find the way.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MarioMey/obs-osc-pythonscript/issues/1#issuecomment-897048174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACQ7TF7FYJR5V6LOL4227OTT4K5ONANCNFSM5B7C5EUQ. 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&utm_campaign=notification-email.

MarioMey commented 2 years ago

What screenshot?

baesek commented 2 years ago

I attached it to my mail. I just uploaded it to my server: https://platz.uber.space/share/LD_PRELOAD_win10_problem.png https://platz.uber.space/share/LD_PRELOAD_win10_problem.png

Am 11.08.2021 um 20:52 schrieb Mario Mey @.***>:

What screenshot?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MarioMey/obs-osc-pythonscript/issues/1#issuecomment-897069049, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACQ7TF5MZGJZBUK5C575UL3T4LBIFANCNFSM5B7C5EUQ. 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&utm_campaign=notification-email.

MarioMey commented 2 years ago

Someone from Python Argentina Telegram channel told me what to do: in OBS, go to Tools -> Scripts -> Python Settings and configure path there.

baesek commented 2 years ago

(changed my username...) Okay I found out, that I have to install Python 3.6 instead of 3.7. After adding the path (C:/Program Files/Python36/) to theTools -> Scripts -> Python Settings, I get a Scripting log which says:

[obs_osc_pythonscript.py] Traceback (most recent call last): [obs_osc_pythonscript.py] File "C:/Users/User/automat-display/obs/obs-osc/obs-osc-pythonscript-main\obs_osc_pythonscript.py", line 36, in [obs_osc_pythonscript.py] from obs_osc_api import ( [obs_osc_pythonscript.py] ModuleNotFoundError: No module named 'obs_osc_api'

baesek commented 2 years ago

I could somehow get it working now by changing some lines in obs_osc_pythonscript.py

"""
from obs_osc_api import (
    scene_change, 
    consola, 
    consola_hslider, 
    c1, c2, c3, 
    c, 
    th
)
"""

from obs_api import (
    # I inserted these 5 from the obs_osc_api import above
    consola, 
    consola_hslider, 
    c1, c2, c3, 
    c, 
    th,

    scene_change, 
    item_set_visible,
    item_remove, 
    item_duplicate,
    item_reference,
    item_set_transform,
    item_get_transform,
    item_set_pos,
    item_set_scl,
    item_set_rot,
    item_set_alignment,
    item_set_visible,
    item_set_crop,
    item_set_scl_filter,
    item_get_order_index,
    item_set_order_index,
    item_swap_order_index,
    item_set_private_setting,
    item_create_group,
    item_create_text,
    item_create_image,
    item_create_video,
)

After that i had to install two python packages for my python36 installation to get it working by entering the following lines into a powershell which was run as an administrator

C:/Program Files/Python36/python.exe -m pip install requests
C:/Program Files/Python36/python.exe -m pip install pillow

I also removed LD_PRELOAD from my windows environment variables and it still worked...

MarioMey commented 2 years ago

So... does it work? Congratulations!

baesek commented 2 years ago

Yes! Super cool script and super fast! Thank you for this. I am just wondering how to find out what commands are possible. For example setting the projector the fullscreen via an osc message.

MarioMey commented 2 years ago

Well... no, I didn't do that. My scripts (you can see in action in IG @videoconfestejo) are for treat OBS as a game engine: almost all the functions are for manipulate sceneitems and scources. Creating them, transforming them, removing them, etc.

Check https://github.com/upgradeQ/OBS-Studio-Python-Scripting-Cheatsheet-obspython-Examples-of-API for more commands.