Re: Man entry to pdf variant command
Re: Man entry to pdf variant command
- Subject: Re: Man entry to pdf variant command
- From: Laine Lee via AppleScript-Users <email@hidden>
- Date: Sun, 31 Jan 2021 14:12:08 -0600
- Thread-topic: Man entry to pdf variant command
On 1/31/21, 1:40 AM, "Axel Lüttgens via AppleScript-Users"
<email@hidden> wrote:
Le 31 janv. 2021 à 07:36, Laine Lee a écrit :
[…]
Now why is it that
{ echo '.ps 8' ; ffmpeg -h full ; } | /usr/local/bin/groff -fC -dpaper=a4l
-P-pa4 -P-l -ms -T pdf | open -f -a /Applications/Preview.app
Works fine in Terminal, but
do shell script “{ echo '.ps 8' ; ffmpeg -h full ; } | /usr/local/bin/groff -fC
-dpaper=a4l -P-pa4 -P-l -ms -T pdf | open -f -a /Applications/Preview.app”
doesn’t work in Script Editor?
Remember, running in Mojave.
[…]
Hello Laine,
It could well be that you need to specify the full path of ffmpeg.
Indeed, the environment of the shell invoked by "do shell script" is a rather
bare one, unrelated to the user’s environment; you may have a look at the
output of:
do shell script "echo $PATH"
Thanks, Axel.
Yes, that appears to be the case.
Here’s an implementation that works for me if the clipboard contains “ffmpeg”
or “ffmpeg -h full”, or if the clipboard is empty and I respond to the dialog
box by entering either of those strings.
I’m far from mastering groff. I’m not getting expected results from the groff
options I’ve attempted to include. Although the font size specification seems
to yield expected results, I still need to find the necessary option settings
to set line breaks to match the output of “ffmpeg -h full” in Terminal.
I understand that “/System” must be added at the beginning of the two instances
indicating the path to Preview.app if you’re using a system newer than Mojave.
try
set z to the clipboard
on error
set z to ""
end try
set x to "/usr/local/bin/"
display dialog "Specify the executable name or the documentation request
command:" default answer z
set z to text returned of result
--display dialog z
if z contains ("" & space) then
set y to x & z
do shell script "{ echo '.ps 7
.ll 6i
.ce 600' ;" & space & y & space & "; } |
/usr/local/bin/groff -fC -dpaper=l -P-pl -P-p -ms -Tpdf | open -f -a
/Applications/Preview.app"
else
set x to z
do shell script "man -t" & space & x & space & "| open -f
-a /Applications/Preview.app"
end if
Laine
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden