Shell script with automator

Dear all,

I'm spending a loto of time to configure a shell script with Automator on Sierra OSX.

What I have to do is execute automatically one command that in terminal already works and exactly:


sudo java -cp /Applications/html2pop3/html2pop3.jar htmlgui password "987654321"


What is the right syntax for execute the shell line mentioned under Automator script?

Many thanks in advance for any help!

Kindes regards,

Francy73

MacBook Pro (Retina, 15-inch, Late 2013), iOS 10.3.2

Posted on Jun 5, 2017 8:09 AM

Reply
3 replies

Jun 5, 2017 8:47 AM in response to Francy73

I borrowed the code for a hidden password prompt from here. See if the following Run AppleScript action works for you in an Automator application. I don't have Java installed to further test.


User uploaded file


set my_password to display dialog"Please enter your sudo password:" with title ¬

"Password" with icon caution default answer"" buttons {"Cancel", "OK"} default button 2 ¬


giving up after 60 with hidden answer


if length of (text returned of my_password) is not 0 then

display dialog "Running the application!" buttons ["OK"] default button 1

do shell script "sudo /usr/bin/java -cp /Applications/html2pop3/html2pop3.jar htmlgui " & "\" & my_password & \""

else

display dialog "You didn't enter a sudo password!" buttons ["OK"] default button 1

end if

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Shell script with automator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.