Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 10, 2013, 05:31 PM   #1
Mudbug
Administrator emeritus
 
Mudbug's Avatar
 
Join Date: Jun 2002
Location: North Central Colorado
Send a message via AIM to Mudbug Send a message via Skype™ to Mudbug
Automator: trimming file path (POSIX text)

Hi everyone -
I've posted this in the apple discussions forum, but thought I might get faster help here. (http://discussions.apple.com/thread/5298918) If you can help there instead, that would work just as well.


This is what gets passed to Mail:

/Users/colin/Desktop/test/3/file3.txt
/Users/colin/Desktop/test/2/file2.txt
/Users/colin/Desktop/test/1/file1.txt

I want to remove the /Users/colin/Desktop/test/ from the above list when it is passed to mail. How do I do that? (it's probably right in front of me...)
__________________
I think I understand what you're talking about, but where are we going to find a duck and a rubber hose at this time of night?
Mudbug is offline   0 Reply With Quote
Old Sep 10, 2013, 07:20 PM   #2
subsonix
macrumors 68040
 
Join Date: Feb 2008
You can probably exchange the "get names of finder items" action with "run shell script" and this content:

Code:
for f in "$@"
do
	echo "$f" | sed 's/\/Users\/colin\/Desktop\/test\///g'
done
Also, select "as argument" in the upper right corner drop down menu.

Keep in mind that the file path is specific to your environment, and hard coded here, so if you move the files or run it on a different computer it will probably not work without modifications.
subsonix is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Using Automator to play audio file from within Automator made application? nobodyhome OS X 10.8 Mountain Lion 0 Jan 14, 2014 04:23 PM
How to know the path of the file location from spotlight? hajime Mac Basics and Help 7 Nov 25, 2013 12:25 PM
Get File Path w Filename doubledee OS X 10.8 Mountain Lion 13 Jul 22, 2013 11:10 PM
Automator - Using Variable in Path? alexk403 Mac Programming 0 Jul 22, 2013 06:36 PM
Need help setting library to load script as POSIX file googleman76 Mac Programming 2 Sep 28, 2012 05:36 PM

Forum Jump

All times are GMT -5. The time now is 11:50 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC