Passing files in automator to a terminal command?

I would like to know if something is possible: I've used automator to sort through a large number of files for specific traits using the 'Filter Finder Items' action. Can I then pass these files, one by one, into a terminal command?
Specifically, I have a bunch of markdown files that I want to run through the markdown command in the terminal.
Thanks for any help,

automator has "run shell script" action. just add that action to the end of your wrokflow with the option to pass input as arguments.

Similar Messages

  • Passing file location to script in Terminal

    Here's what I've figured out so far:
    tell application "Terminal"
    set Tiedosto to the selection
    do script "/Applications/VLC.app/Contents/MacOS/VLC -vvv " & Tiedosto & " --sub-track=1 --sout=\"#transcode{vcodec=mp2v,vb=1024,acodec=mpga,ab=128,soverlay}:standard{d st=/Users/Antti/Desktop/video.mpg,access=file}\""
    end tell
    The idea is that I could select a file from Finder, activate the script and the path of the selected file would be passed to the Terminal script as "Tiedosto".
    Well, nothing happens... Any suggestions?
    iMac Intel 2GHz   Mac OS X (10.4.7)  

    Your first problem is that you're getting the selection in Terminal.app, not the Finder, so you need to ask the Finder for the selection.
    Then, the Finder will return a list of selected items. You'll need to extract items from this list before you can use them. You can either iterate through the items, or take the first item, depending on whether you want to support multiple items:
    <pre class=command>tell application "Finder"
    set selectedItems to (get selection as alias list)
    repeat with eachItem in selectedItems
    set currentFilePath to quoted form of POSIX path of eachItem
    -- now you can use 'currentFilePath' in your do shell script command
    end repeat
    end tell</pre>
    The other option is to save the script as a droplet so that you can drag and drop files on the script icon. This is a more Mac-like experience and can easily be done by adding an 'on open (droppedFiles)' handler and iterating through the droppedFiles.
    Note that when doing this kind of thing you should add additional checks to validate the item is of the correct type you expect (e.g. you don't want to process a selected folder, MS Word document, JPEG image, etc., etc.).

  • Recover Accidentally Deleted Files in OS X via Terminal, "command not found"

    Hi!
    I am trying to recover a folder from the trash. It was deleted 30 min ago. The command I am trying to use is;
    Mys-MacBook-Pro:~ storedisk$ com.apple.Finder AppleShowAllFiles true
    And the response is;
    -bash: com.apple.Finder: command not found
    When I open any Terminal window I get this message, I don't know if this is relevant;
    Last login: Wed Nov 13 08:27:40 on ttys001
    I have found some similar replies on the forum but they do not seem to work in my case. I'm new to Terminal so I would really appreciate the help to find the cause and to resolve my problem.
    Thanks a lot!

    Thank you so much. This is the reply that I got;
    Mys-MacBook-Pro:~ storedisk$ ls -a .Trash
    .                                        Cherry Blossoms
    ..                                        FLiCKS
    .DS_Store                              Nicholas Nickleby (1977)
    13 Tzameti                              Robin Hood (2010)
    Catch-22 [1970]                              We Live in Public 2009
    Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS .
    Mys-MacBook-Pro:~ storedisk$
    Mys-MacBook-Pro:~ storedisk$ mv .Trash/FLiCKS
    usage: mv [-f | -i | -n] [-v] source target
           mv [-f | -i | -n] [-v] source ... directory
    It is the FLiCKS folder that I am trying to retreive. Does this mean that I can retreive it? And if so, when I use the command mv .Trash/filename, where should it appear? Sorry for not fully understanding the instructions.
    I also tend to empty the trash cumpulsively, which is how this happened in the first place. Trying to empty the files already in the trash but accidentally having had this folder selected I emptied that and kept the files that I didn't want.
    The trash folder still has the size as if the folder FLiCKS is still in there though, if that makes any difference?
    Thank you for all of your help.

  • Passing Files with Automator

    I want to have a automator function that downloads from a FTP server movies/files.
    Then I want to take those files and send them to a compressor droplet and automatically run and process.
    How do I pass the files from the folder that they are being downloaded to, into the droplet?
    I am using Transmit to download.

    My apologies, I read the first post as "I have an automator function that downloads from a FTP server..."  
    You could try something like:
    1) Get Specified Servers
    2) Connect to Servers
    This returns the mounted server.  Depending on how the server is set up, and what files you are interested in, you can put some combination of "Get Folder Contents" (to get everything in the server) and "Filter Finder Items" (to pick just the folders/files you are interested in).
    Then...
    x) Copy Finder Items
    - here you can specify where you want the files copied to
    x+1) Then you can do the "Open Finder Items" like I mentioned in the earlier post.
    Hope it helps!

  • Terminal command equivalent to Automator's 'set metadata pdf'

    Hi,
    When I make pdf docs I sometimes want to erase my name from the Author metadata, and put something into Title and so on.
    I know that Automator has an action called set pdf metadata, which I have successfully used.  But I would like a Terminal command that I could use instead.
    Googling this question returns suggestions of downloading pdf-manipulation libraries which are too elaborate for me to use.  I'm hoping that Automator is simply utilising a terminal command already built-in.
    Is there such a command?
    Diddles

    A bit of experimenting.
    Given a file temp.pdf in the current working directory . . .
    xattr -w "com.apple.metadata:kMDItemAuthors" "diddles1234" temp.pdf
    writes the string "diddles1234" to the Authors metadata field of temp.pdf.
    xattr -w "com.apple.metadata:kMDItemTitle" "newmetatitle" temp.pdf
    writes the string "newmetatitle" to Title metadata field of temp.pdf.
    However, if you try to put spaces into the string like this:
    xattr -w "com.apple.metadata:kMDItemTitle" "new meta title" temp.pdf
    the title field will not be changed to "new meta title". In fact, if you start with "original title" as the value of kMDItemTitle, successfully change it to "newmetatitle", and then later try to change it again to "new meta title", the value of kMDItemTitle reverts to "original title". The OS appears to "forget" the intermediate change to "newmetatitle".
    As best I can figure, in the event of a failed xattr write command, the original kMDItemTitle is rebuilt from semi-redundant data within the PDF--but more experimentation would be required to prove it. (The same is true of kMDItemAuthors, by the way.) Quick take away: The first two commands above will work if you don't use spaces in the strings to be inserted into the metadata fields. Someone more proficient in UNIX may have a better solution or explanation.

  • Terminal Command with Automator

    ok i want to use the automator to run a script so that i can view my hidden files without going through the terminal
    defaults write com.apple.finder AppleShowAllFiles FALSE
    KILLALL Finder
    these are the command but i cant get automator to run them please help

    Hi,
    What do you mean when you say you can't get Automator to run them? I created a workflow with a Run Shell Script action, put the 2 lines in the body of the action, and it seemed to work just fine.

  • Options passed to apps when opening from Dock vs Terminal command line

    I have a much used freeware application called Aquamacs (it is a mac-specific version of the emacs text editor). If I open the application from the dock, I can not use it to "compile" .tex files written in the LaTeX markup language. However, if I start it from a terminal command line with no additional options:
    /Applications/Aquamacs\ Emacs.app/Contents/MacOS/Aquamacs\ Emacs filename.tex
    then everything works just fine. Evidently, beginning from the dock passes some additional option that interferes with LaTeX. Does anyone know how to control what options an application gets at startup from the dock? I would even be satisfied just to know what options are passed. Thanks.

    From what I'm reading, you are working towards MDT but it's not approved yet, so the goal is to:
    Deploy a "bundle" of applications as painlessly as possible without using UDI to make customizations quick.
    Lets talk options then.
    Option 1:  If machines types are in a unique OU or security group, create a collection for that and set these applications to mandatory install.  After initial deployment, the provisioner can drop the computer in the proper OU or group and you're
    good to go.  Downside:  collections refresh plus client check-in makes this less than instant.
    Option 2:  Orchestrator.  You can write a runbook that will approve and push apps.  You can then use the Orch console front end or a more friendly sharepoint/SM portal to push things out like a Manager would approve apps.  Downside:  if
    not already deployed, there's no way they would approve that infrastructure if they are hesitant about MDT/UDI :)
    Option 3:  PowerShell and WMI.  This should be doable ... but I've never tried it.  It looks like you're headed down the right path ... but i guess my question is:  if you can't have UDI when do get to pick the app?  Are you planning
    to write a full multi-box for them to check their apps after the fact?  In that case ... just have the appcontroller URL pop up on first login ... might be easier than reinventing the wheel.

  • Terminal Command, how to set defaults write, make application(s) use directory path where file last saved?

    Does anyone know whether there's a terminal command to make all applications remember/use the last directory/path where I last saved a file?
    For example, let's say there are (10) ten PDF's on a website, and I want to use Preview.app to open and save each file to the same directory.
    Problem is, after each time I save a file, Preview.app doesn't automatically remember/use the last directory where I saved my file(s).
    Forcing me to navigate back to the same directory after each time I save a file; super-annoying.
    But, for some reason, when saving images from the web, Firefox remembers the last directory where I saved the file (jpeg).
    So I'm hoping there's some way, possibly a terminal command to set/force all applications (including Preview.app) to remember/use the directory/path where file(s) were last-saved.
    Anyone?

    Get the third-party utility Default Folder X 4.4.9.

  • Terminal command to find most recently opened files

    Hello,
    I have a terminal command (bash) that will find the last opened file (singular) from a given directory.  "$(ls -t | head -n1)"
    I want to be able to search for multiple "last opened" files, say 20; I also want to be able to search either all user files, or at least direct the command to search within subfolders of a  top level folder.
    Can anyone help.  I'd appreciate it!  Thanks.

    This will find all files last used today. Reference. File Meta Data attributes. Curious about a file … mdls filename.
    mdfind -onlyin ~/Documents  'kMDItemLastUsedDate >= $time.today()'

  • Terminal command that will let me access old username files...

    ... including files saved by timemachine?  I've had a lot of computer problems, first wiped the drive.  It was a chore getting old folders like "desktop" and "downloads" to open for me with my new username and for some reason I wasn't permitted by the system to use the OLD username.  I had to go to every folder and every item in every folder and reset permissions.
    Now, it seems, I need a new drive.  Which means I have to do all those things AGAIN!  Plus re-install software.
    Is there a terminal command that will let me access old timemachine drives (plural) with (unfortunately) multiple usernames?
    Please don't lecture me!  I know I've been hopelessly stupid and inefficient.  I promise to do better.  At least I DID back up.

    what you type is
    man sudo
    I presented an example, which when executed will run as "username" and display the contents of their home directory - the meaning of "ls ~username"
    I suspect that this is going over your head.
    double-click Applications -> Utilities -> Terminal
    type and hit enter
    /bin/csh
    This command starts the C-Shell command line interpreter. The ~ (tilde) character is translated by the C-Shell as the users home directory. For example, "ls ~" will display the contents of my home directory (folder) which is /Users/disguise
    You man want to read up on C-Shell and UNIX commands.

  • Terminal commands with automator and Safari

    Hey guys, I'm trying to create an automator that will open safari, enable private browsing, go to my site, and log myself in. The problem is I need a terminal command line that will ensure private browsing is enabled. Any tips / help is appreciated. Thanks

    Terminal and Unix queries are best posted to the Unix forum under OS X Technologies.

  • Terminal Command rsync

    I use rsync to backup my macbook pro. It gets really irritating to open the terminal to type the entire command every time I want to backup. Does anyone know how to save the terminal command as an auto-executing file, so that when I double-click the file it backs up.

    there are a lot of very good backup applications out there. why would you do it by hand with rsync?
    if you insist, you can put a GUI wrapper on it using apple script or automator.
    using automator:
    make a workflow consisting of a single action "run shell script". save the flow as an application.

  • Executing terminal command at startup

    What is the easiest way to execute a terminal command when OSX starts up?

    OS X has used Launchd to run startup items since Tiger (10.4). Create a .plist for the program
    you want to run and putting it in the /Library/launchAgents or the $HOME/Library/LaunchAgents
    directory, if you only want it to run at user login. Optionally, for user startup items, you can add
    the command to the Account login items, but it has to be in the form of a standalone unix script
    or automator app to work correctly as an Account login item.
    Here are some background resources on launchd:
    http://www.macgeekery.com/tips/allabout_launchd_items_and_how_to_make_oneyourself
    http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemS tartup/Articles/LaunchOnDemandDaemons.html
    http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/m an5/launchd.plist.5.html
    Here is a Gui app that can help you create launchd items:
    http://sourceforge.net/projects/lingon/files/
    Here is a thread on using Account login items to launch scripts and automator apps:
    http://discussions.apple.com/message.jspa?messageID=11569184#11569184
    Now, go start something.

  • Is there a way to pass files to a LV app in Mac OS X?

    There is an option in the Finder in Mac OS X to open files with the specified application. I tried it with my LV app, but unfortunately I haven't found any way to read out the filename passed to the app.
    (The Application/Command Line Arguments Property didn't work in this case.)
    Has anyone ever tried to pass files to a LV app in Mac OS X? I mean not in the command line but in the Finder.
    Thanks in advance

    Hi,
    When I understand this right - and as I am not so much of a MAC Expert - you want to do the following:
    1. You are in a file finder, where you can click on files an select: "open with ProgrammXY"
    2. That ProgrammXY should  be a LabVIEW App you created that can open files for Analysis.
    3. The LabVIEW App catches from somewhere the path-string and name of the file that was selected to be opened with your LabVIEWApp, like from some
    kind of property node or function.
    4. How to do that?
    I do not think that is possible, at least I do not know a way to do that in Windows so I doubt there is a way to do that in MAC OS.
    <<Anyway, it could even be an empty App, the main question is if it is even possible to get the filename in a LV App if we open it in Finder.
    When you cannot configure the Finder in a way so that he writes the file name as a command line parameter in the opening call .- exuse me if that is not MAC vocabulary - I do not see a way how to do this.
    Regards
    René

  • Terminal command to lock and unlock the dock?

    Hello,
    I manage hundreds of iMacs running Yosemite at a school site.  I use parental controls with the lock dock feature turned on.  I would like to periodically unlock the dock to customize it with new icons, but have not found a terminal command that works, or a streamlined process that is time efficient.
    So far I have been individually unlocking the dock in parent controls on each machine, restarting, editing the dock, then re-locking it parental controls, then restarting.  This takes 5-10 minutes per machine). 
    I also tried this command but it didn't work.
    defaults write com.apple.dock contents-immutable -bool true; killall Dock;
    I also tried cloning the parental controls with an exported plist file to all the machines using ARD, which works for all the parental control settings EXCEPT for the lock dock feature.
    Any ideas?
    Cheers,
    Crystal

    Sorry this is probably too late for you, but it may help others seeking this answer, I just had this problem [Mac OS x Yosemite 10.10.2] and found that the following worked for me:
    1. Use Terminal to LOCK the Dock by C&P or typing in:
    defaults write com.apple.dock contents-immutable -bool true
    Then use your preferred method to Log-Out [e.g. Key Combo ⇧⌘Q or  [Top Left Menu] then select Log Out “name”]
    and then Log-In again.
    2. Use Terminal to UNLOCK the Dock by C&P or typing in:
    defaults write com.apple.dock contents-immutable -bool false
    Then use your preferred method to Log-Out [e.g. Key Combo ⇧⌘Q or  [Top Left Menu] then select Log Out “name”]
    and then Log-In again.
    NB. You will be solely responsible for your actions making changes to the Operating System.

Maybe you are looking for

  • Itunes not recognising ipod

    i lost my entire itunes library when burning a disc. i visited the genius bar at the local apple store and was shown how to restore it, and it worked. HOWEVER when i reconneted my ipod it said that it was not the default ipod for itunes. as i have ex

  • Lack of communication from Apple

    Given that we are now in the midst of a disasterous release of the new IPhone software, it sure would be nice to see a pinned message at the top of each iPhone discussion saying something like this: Sorry, folks! We really screwed this up but please

  • Delivery of goods & customer Invoices

    Dear Friends, We are implementing only MM & FICO modules only. We are not suppose to implement SD,  means Sales Area, Sales Org., Distribution Channel, Division etc., In this scenarios,  we need to maintain some of the SD scenarios, like  delivery of

  • Need Help in displaying data labels at the top of the bars in CFCHART

    Hi, I have a cfchart with two line series and one bar. I want to display the data values at the top of the bar and the line series. Below is the XML I am using: <cfsavecontent variable="chartStyle"> <?xml version="1.0" encoding="UTF-8"?> <frameChart

  • Copy iTunes from win 7 pro to new Mac Pro?

    Have all my work on my iPhone 5s. Do nothing but manually syncing on lates iTunes. What to copy iTunes to new Mac Pro so I can use my iPhone on either computer. Laptop at work and desktop at home. All store bought music on C drive in iTunes as it sho