I’m working on a script which needs to provide the user some feedback from the CLI. I would like to use “do shell script” and have the feedback displayed in a dialog box similar to the example below but I’m having a problem actually getting the text I want returned.
This example works:
set dialog_text to do shell script "date" display dialog dialog_text
My script is for working with GPG signed archives. I would just use GPGFile Tool but it doesn’t do exactly what I want (verify the archive and extract a copy of the enclosed document in one step.) Here’s the command which does what I want entered straght into the CLI (text is edited for anonymity):
fingal$ gpg “/Users/fingal/Desktop/AppleScripts for GPG - open/transcription copy 5.doc.gpg”
gpg: Signature made Mon Jul 11 15:18:51 2005 EDT using DSA key ID 3E5F3C58
gpg: Good signature from “Aram Fingal firstname.lastname@example.org”
I want to have the two lines (beginning with “gpg:”) which are returned from GPG displayed in a dialog box when this command is run using “do shell script” as in the AppleScript below (you will, of course, have to have GPG installed in order to run this). What happens is that the document is properly extracted but I get a blank dialog box. How can I get the dialog box part to work?
display dialog "To use this script, drag one or more signature files or a signed archives to it." on open files_dragged_to_this_script repeat with each_file in files_dragged_to_this_script set shell_script to "/usr/local/bin/gpg " & "\"" & POSIX path of each_file & "\"" set dialog_text to (do shell script shell_script) display dialog dialog_text end repeat end open