Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for MacOS #16

Open
coezbek opened this issue Jun 13, 2021 · 2 comments
Open

Support for MacOS #16

coezbek opened this issue Jun 13, 2021 · 2 comments

Comments

@coezbek
Copy link

coezbek commented Jun 13, 2021

Could you document in the Readme whether you plan to support MacOS in the future or it will be a limitation?

@OzymandiasTheGreat
Copy link
Owner

Supporting macOS would be great, but unless I get my hands on a Mac or somebody with a Mac makes a pull request, it's not happening.

@floyd-fuh
Copy link

floyd-fuh commented Apr 6, 2023

Just my 0.02$, as I was also looking for Mac support and the only thing I needed to do was copy some HTML into the HTML clipboard, I solved it like this (just leaving this here because it might help someone in the future):

import subprocess
import binascii
from sys import platform
if platform != "darwin":
    import klembord

html = '''<head>
<style>
</style>
</head>
<body>
<h3>Title text</h3>
<p class=MsoNormal>Example, <b>Bold</b></p>
</body>'''

if platform == "darwin":
    hexvalue = html.encode().hex()
    command = f"echo 'set the clipboard to «data HTML{hexvalue}»'|osascript"
    #print(command)
    subprocess.run(command, shell=True)
else:
    klembord.set({'text/html': html.encode()})

So basically using Apple script (osascript) a lot of the functionalities are possible (although subprocessing to the shell might not be everyone's favourite option).

Btw. if anybody is wondering, this way you can generate Microsoft Word formatted clipboard content (you can use a tool like ClipSpy to reverse engineer the HTML clipboard contents generated by Word) on a client host machine with python and then paste it into a Windows VM that runs Microsoft Word.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants