I need to use Briss, a .jar program, cut the PDF files in order to be display properly on e-ink readers. The basic step is run briss.jar then select open the chose your PDF file. I need automator to do this sequence of actions for me. I open automator, chose new->service->Service receives selected ->PDF->in finder.
Then I drag the briss.jar file into the workflow. and save as BrissPDF
I do see the BrissPDF when I right click a PDF file. But it does not run at all...... I am guessing I didn't pass the PDF file as an input of the briss.jar. Anyone could help?
THanks
You can open briss through bash.
First, add the Path variable. Second, add "Run Shell Script", choose to pass input as arguments, and write java -jar ~/Applications/briss-0.9/briss-0.9.jar "$1", or wherever your briss.jar file is . The $1 part is replaced with the PDF file path, and is passed as an argument to briss.
Here's a automator screenshot.
Related
If I have some simple text in a .rtf file (called test_file.rtf), how can I run this in terminal?
For example if I have cd Documents/Movies written in this file, I don't want to have to open the file, copy that line, paste it into terminal, then hit enter to get into the Movies folder. I just want to simply 'run' test_file.rtf and then I will be in Movies folder.
Is there a simple way to just call this without loads of ammendments to my setup or to the simple rtf file? Essentially just a word to type in to say 'run this command'?
I was wondering if it was possible to run a selfwritten ruby program just like any other program by double-clicking an icon of some sort.
And if it's possible, how do I do it?
I wrote a little program for a friend but I don't want him to have to use the command line to run it, because that's rather inconvenient (unless there is a way to just double-click and the command line opens the program itself..).
Thanks for your help!
The simple answer that should work for all versions of Windows is to just create a simple batch launcher.
Create a .bat file. I usually just create a new .txt file via "right click > new > text document". Then rename it, highlight everything, including the extension, and rename it to something like run.bat. The .bat part is important. Once you rename it, the icon should change to gears. If you can't overwrite the extension, or Windows is still treating it as a text document, you'll need to either manually save it as a bat, or disable "hide file extensions" in the explorer settings so the extension can be changed.
Edit the bat file, and put into it something like:
#echo off
YOUR RUN COMMAND HERE THAT YOU WOULD NORMALLY TYPE MANUALLY
pause
Paste the command that you would normally run manually where the capital text is. The first line is so it doesn't repeat the commands back, and the pause is so if an error happens, the command prompt doesn't immediately close. This gives you a chance to read the error.
Save it and close it. Now, if you double click on the bat file, your program should run.
Multiple ways
if it's for occasional use and for one script only I would pack it
to a Windows executable with Ocra, then you can double click
the .exe itself or a link to it
same as above but use jRuby and create a .jar file, not for beginners though
the easiest: if you configure Windows to start/run .rb files with your ruby.exe you can double click the .rb files itself and they
will execute, they will have the red Ruby stone icon
if you run a .reg file to enable drap and drop on .rb files you can combine the previous technique to drop files on the script and
they will be the parameters to the script, see my answer here for the reg file
my favorite: copy the .rb to your windows "C:\Users\your_user\AppData\Roaming\Microsoft\Windows\SendTo\"
folder, then you can right click file(s) or folder(s) and select
sendto and select your script, the files or folder will again be the
parameters for your script
you can create a .bat or .cmd file that starts with the path to your ruby.exe and the script as parameter, use rubyw.exe if you
don't want output
I would like to open a PDF in Photoshop from the command line. My current issue right now is that the default application for opening PDFs is Adobe Acrobat. I'm wondering if there is any parameter I can pass to specify which program to use when opening a file.
In other words, I want to emulate the option of "Open-with" when you right-click a file to open it with the non-default application, but from the command line.
I do not want to change the default application for PDFs to be Photoshop.
Any ideas?
All you need to is provide the filename as a command line argument:
photoshop <path to file>
(<path to file> needs to be quoted if it contains spaces)
For example:
photoshop "C:\Users\csterling\Documents\some document.pdf"
If the directory containing photoshop.exe isn't in your Path environment variable, you'll need to provide the full path:
"C:\Program Files\Adobe\Photoshop\photoshop" "C:\Users\csterling\Documents\some document.pdf"
This isn't a feature of the command prompt, it's a feature of the executable, i.e. photoshop.exe has to be programmed to accept a file to open as a command line argument. Fortunately, it is, as are the majority of Windows applications that operate on files.
In case you want this to work with relative path in PowerShell, here is the script:
function photo
{
$the_filename=resolve-path $args[0]
photoshop $the_filename
}
Then you can just type:
cd C:\Users\csterling\Documents
photo mypic.jpg
You can do it by using the start command:
start <program-name> <file-path>
In your case, you would have to do something like this:
start photoshop D:\open.pdf
Unfortunately, the current version of Photoshop doesn't support this operation out of the box. You can open the program: start "path_to_photoshop.exe", but there is no way to pass it a file to open. If you really want to do it, you will need to get something like this: https://www.eulanda.eu/en/access-photoshop-api-via-powershell-script. Sorry, I wish I had a better answer, especially since I wanted to be able to do this for a program I was working on.
I'm currently using the split command to split a large file into many 50MB files. For example:
split -b50m filename.ext filename.ext.
This works really well, but I'd like to use Automator to create an application that I can give to a friend who is less familiar with the command line.
I realise that there are existing applications which can handle this (e.g. Split&Concat), but I want to use this as an opportunity to learn about Automator. This is what I would like to achieve:
Drop file on application icon (e.g. filename.ext)
Split files and name them filename.ext.aa, filename.ext.ab, ...
Create new files in same location as original file
How do I pass the file name to the command line?
When you save the Automator script as an Application the dropped file is passed to the first action automatically.
Select the Run Shell Script pass the input in as an arguments and access it using $#.
You can use the above split command instead. The following Automator takes the input file and moves it to the ~/Desktop/haha folder.
This is my first time using packagemaker. Basically, I need to copy some files to some folder, and then open photoshop and load a .atn file. I have the applescript written but how can I execute this applescript from package maker?
Thanks.
You can run it from inside a bash script.
check here for details.