Non-AppleScript OSAX Suggestions for Creating Resource-Related File

I need to create a specific type of file in OS X. It needs resources in a specific way. Currently the only way to find this is in AppleScript with OSAX. It's slow, about 1 second to start, as OSAX has to open, load, do the job and exit. I learned this in C, but this would be a last resort as there are always problems building applications to get them to work on multiple computers.

I thought maybe perl or ideally bash could pull it off, but I'm not 100% sure. The specifications of what I need to do are as follows:

  • Create a text file formatted as an email message (RFC 822 / RFC 2822 format).

  • Text files must have "STR" resource ID 8192 with an email address (to be used as SMTP MAIL FROM address) and "STR #" resource ID 8192 with recipient addresses (to be used as SMTP RCPT TO addresses).

  • The text file must have CRLF as line endings and also add resource ID "BODY" 8192.

  • The "BODY" resource must contain 4 bytes, "822" for undefined body type, "7BIT" for 7-bit data, "8BIT" for 8-bit data, and "BINM" for binary data.

Sure, the parts of creating text files are simple, but stuffing these STR resources makes me confused.

+1


source to share


2 answers


Have you looked at REALbasic? It makes it much easier than C to program something like this. You won't get it for free.

Otherwise, please explain what languages ​​you can use. Are you talking about the app you are distributing is the app just to create this file from blue?



Also, I don't understand your problem with C and "building applications to make them work on multiple computers".

+1


source


yes, Real Basic can do it. In a nutshell, I am using an odd mail server, and in order for it to take an email from the command line, I need to create a text file in a specific way and then move it to a specific folder and the email will be delivered. The developer seems to like resource fork and probably won't change.

I can currently do this with OSAX in applescript, at the cost of only generating 1 message per second. Real Basic will be about the same.

As far as C, I wrote a small command line application once, my first application, all it did was read the first few bytes of the file, convert some endianess values ​​and return an integer. I had problems distributing it as it needed to be built on every platform. This is my only experience with C.



Yes, this app for apps is only for creating this file. I know php is really good, perl is enough to get at least reading and editing. Basically, I've been playing scripting languages ​​for the better part of 10 years.

I am assuming to use this script like this:. / sendemail -f me@example.com <path / to / rfc822 / email.txt

Thanks for any pointers.

0


source







All Articles