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

Add MacOSX compatibiilty for Office-related activities #110

Open
AlJohri opened this issue Feb 18, 2020 · 1 comment
Open

Add MacOSX compatibiilty for Office-related activities #110

AlJohri opened this issue Feb 18, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@AlJohri
Copy link

AlJohri commented Feb 18, 2020

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:

const word = Application("Microsoft Word");
word.open("input.docx");
const doc = word.activeDocument;
doc.saveAs({ fileName: "output.pdf", fileFormat: "format PDF" });

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 method document.add_paragraph(text) which has an equivalent in MacOS as can be seen in the AppleScript Scripting Dictionary:

Screen Shot 2020-02-18 at 1 24 14 AM

@AlJohri AlJohri changed the title [feature request] add macos compatibiilty for microsoft office activities? [feature request] add macos compatibiilty for all microsoft office activities Feb 18, 2020
@koenvaneijk
Copy link
Contributor

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).

@koenvaneijk koenvaneijk added the enhancement New feature or request label Apr 3, 2020
@koenvaneijk koenvaneijk changed the title [feature request] add macos compatibiilty for all microsoft office activities Add MacOSX compatibiilty for Office-related activities Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants