Home > OS >  Executing .exec file using Objective-C Code
Executing .exec file using Objective-C Code

Time:02-03

I am trying to make some edits on RWTS-PDFWriter Source Code:
https://github.com/3gx/RWTS-PDFwriter
To make it execute an exec file when it saves the pdf to make some changes on it. but when I hit print it always shows me that there is a backend error.
I am not very good at Objective-C, I need this project for my university assignment.

I added the code block to the pdfwriter.m file.

@autoreleasepool {

    [[NSTask launchedTaskWithLaunchPath:@"/private/var/spool/spaceprinter/QrMake.py"

    arguments:@[@"/Users/philipnakhleh/Desktop/pos.pdf"]]

    waitUntilExit];
}

but it show me backend error when I print. But, when I run the same code on a separate project it runs without problems.

Any Help??

CodePudding user response:

I solved it without using code. I made a .plist file and put it in the ~/Library/LaunchAgents. Whenever a file added to the directory the exec file will trigger and do the processing.

PS: if you want to do it for all users put it in /Library/LaunchAgents.

  • Related