Re: Appending text
Re: Appending text
- Subject: Re: Appending text
- From: Ben Waldie <email@hidden>
- Date: Mon, 01 Jun 2009 16:57:32 -0400
Francisco,
On May 31, 2009, at 10:32 PM, Francisco Parada wrote:
I have a script that gets all the directories and files in a
specified folder. All the content's references (or links) are then
placed into a text file.
What I'm trying to accomplish is the following:
Before every line of text, I want to add a hyperlink: <a href="then
the text goes in here"... after the text (or link of the file) I
want to finish it by adding ">name of file</a>
I think I'm not being very clear, but I just can't think of another
way to explain it.
For example:
In the text file this is one of the lines:
/Volumes/MirroredSet/Pictures/Family/Barcelona0001.jpeg
I would like to append a hyperlink to it, and add the last reference
(in this case "Barcelona0001.jpeg") to the name
The output would look like this:
<a href="/Volumes/MirroredSet/Pictures/Family/
Barcelona0001">Barcelona0001.jpeg</a>
This can be done with Automator, but not without constructing a fairly
complicated workflow that involves variables, looping, and third-party
actions. Here's a link to download a sample workflow that
demonstrates how to do this, which you are welcome to download and
check out <http://www.automatedworkflows.com/files/demos/automatorworkflows/leopard/misc/BuildLinksExample.zip
>.
Please note:
a) This example workflow requires Leopard, as variables and looping
were not supported in Tiger.
b) You'll need to download the "Dispense Items Incrementally" action
from <http://automator.us/leopard/downloads/index.html> to loop
through the files individually. For more on looping through files,
you may want to check out my Peachpit article "Individually Looping
Through Files in an Automator Workflow" here <http://www.automatedworkflows.com/tips/users/peachpit/peachpit.html
>.
c) You'll need to download the demo version of my Finder and TextEdit
actions, which you can find here <http://www.automatedworkflows.com/software/automator_actions.html
>. These actions are necessary for appending prefixes and suffixes
to text and retrieving the names of files. Please note that these are
commercial actions, so if you're looking for a less expensive
solution, you'll most likely need to revert to AppleScript or shell
scripting to accomplish the desired task.
For more on variables and looping, check out some of my other Peachpit
articles at the URL above, my book "Automator for Mac OS X 10.5
Leopard: Visual QuickStart Guide" (Peachpit Press) <http://www.automatedworkflows.com/books/automator_vqs.html
>, and my video podcast series "Mac Automation Made Simple" <http://www.automatedworkflows.com/tips/podcast.html
> (and available in iTunes).
Hope this helps.
-Ben
Ben Waldie
President
Automated Workflows, LLC
610.935.0652
=============================================
AppleScript * Automator * Workflow Automation
Products, Training, Custom Development Services
<http://www.automatedworkflows.com>
<http://twitter.com/applescriptguru>
=============================================
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden