Send Text To STDOUT Without A Newline In JXA/OSA Script
osascript
#!/usr/bin/env osascript -l JavaScript
ObjC.import('Foundation');
const send_stdout = (text) => {
$.NSFileHandle.fileHandleWithStandardOutput.writeData($.NSString.alloc.initWithString(String(text)).dataUsingEncoding($.NSNEXTSTEPStringEncoding))
}
Footnotes And References
- •Answer To: Output JXA to stdout
This is where I found the code. The original version took multiple arguments. I switched it to a single text in put