sveinbjornt / Platypus

Create native Mac applications from command line scripts.
https://sveinbjorn.org/platypus
BSD 3-Clause "New" or "Revised" License
2.84k stars 171 forks source link

osascript: Script works fine in Terminal, but not working when launched by Platypus #259

Closed faxotherapy closed 1 year ago

faxotherapy commented 1 year ago

The following works fine when launched from Terminal:

#!/bin/bash
nmap -p 22,5900 localhost | grep closed &> /dev/null && { osascript \
  -e 'set usr to text returned of (display dialog "Saisissez un nom d'\''administrateur :" default answer "Administrateur" with title "Activation des services de partage…" with icon stop)' \
  -e 'set pswd to text returned of (display dialog "Saisissez le mot de passe :" default answer "" with hidden answer with title "Activation des services de partage…" with icon stop)' \
  -e 'do shell script "launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist; launchctl load -w /System/Library/LaunchDaemons/ssh.plist" user name usr password pswd with administrator privileges' 2> /tmp/assistance.log

But, for unknown reasons to me, the app produces by Platypus output nothing as though osascript was not compatible with Platypus. I used often Platypus, but this time I don't know how to make it work with the above script.

Update: I have to go inside [APP]/Contents/MacOS/ and double-click on the executable to make it work.