Open AlJohri opened 4 years ago
We've put this on our roadmap.
Would need to investigate what the best way would be to call AppleScript from Python. There's appelscript
https://pypi.org/project/applescript/ but it's not as integrated as win32com
as in not returning Python objects but just stdout/stderr.
Any suggestions are more than welcome on this topic.
As an additional challenge, our development team currently does not have access to Apple hardware and apparently you cannot buy OSX licenses for running it in a VM (legally).
I've had some success using AppleScript / JXA (Javascript for Automation) to replicate code using
win32com
on MacOS.I was able to use this approach to solve a very specific use case and create
docx2pdf
: https://github.com/AlJohri/docx2pdf.The actual conversion code looks like:
As you can see, this code is very similar to the existing python code using
win32com
.I think this same approach can be used for almost all of the activties provided by Automagica. For example, the
append_text
function uses the win32com methoddocument.add_paragraph(text)
which has an equivalent in MacOS as can be seen in the AppleScript Scripting Dictionary: