How to send a terminal command from Processing in mac?

edited June 2015 in How To...

for example: there is a terminal command like : openssl base64 -in /Users/saurabh.datta/Documents/Processing/sketches/tinderBot_101/application.macosx64/infoImage.jpg -out /Users/saurabh.datta/Documents/Processing/sketches/tinderBot_101/application.macosx64/encodedB64.txt How can I invoke this command from within Processing? All the threads I've checked doesn't work:

Answers

  • Answer ✓

    Using the runtime, you can call commands:

    String term = "openssl base64 -in /Users/saurabh.datta/Documents/Processing/sketches/tinderBot_101/application.macosx64/infoImage.jpg -out /Users/saurabh.datta/Documents/Processing/sketches/tinderBot_101/application.macosx64/encodedB64.txt";
    
    try {
    Runtime rt = Runtime.getRuntime();
    Process pr = rt.exec(term);
    } catch (Exception e){}
    

    hope this helps! ak

  • Thanks @akirsky - I got that one working..

Sign In or Register to comment.