Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Seeking help with Applescript and Automator

Seeking help with Applescript and Automator
Thread Tools
Grizzled Veteran
Join Date: Apr 2004
Location: Nagoya, Japan • 日本 名古屋市
Status: Offline
Reply With Quote
Jan 23, 2006, 12:06 PM
 
I've been trying out iWeb and its suitability for easy weblog publishing, and I'd like to be able to easily stick a few custom lines of code in. My idea is to put a key word in the text, and then run an Automator script to do a search-and-replace right before uploading.

The only problem is, I can't figure out how to make Automator do that. I'm guessing I'll need an Applescript to do the text manipulation, but I don't know how to integrate it into a workflow. I found one Applescript that does a string replacement, but I'm not sure how to apply it to the input file in an Automator workflow. Any suggestions are appreciated.
     
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Jan 23, 2006, 03:52 PM
 
Sorry, I don't know the answer, but AppleScript is absolutely hopeless at text manipulation (compared to Perl, or others). If you've found a script that already does it then you're one step ahead already.
     
Mac Elite
Join Date: Oct 1999
Location: Montréal, Québec (Canada)
Status: Offline
Reply With Quote
Jan 29, 2006, 01:13 PM
 
Or perhaps you could execute a terminal program instead (grep?), which would be more efficient than AppleScript. Alternatively, you could embed code in you document that would automatically insert a few lines upon rendering. Depending on the hosting service you're using, you may be able to use the <include> command.

The easiest way I can think of (albeit unorthodox) would be to call a JavaScript from within your template, which would reside in a separate file:[HTML]<script language="Javascript" type="text/javascript" src="site/your_script.js" />[/HTML] The .js file would contain the custom code you'd like to add. For exemple : [HTML]document.write("<a href='http://www.macnn.com'> <img src='http://www.testing.com/image.jpg' /> </a>");
document.write("<P>Lorem ipsum yadayada</P>");[/HTML]
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:25 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2