Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: AppleScript In Web Publishing...



Peter, 

It sounds like you want to use AppleScript to create a fairly simple, straight-forward page of links to specific files using AppleScript. 


Here's how I would tackle a project like this:

Create a template page (Using BB Edit, or whatever HTML editing software you prefer.)

Divide the page into sections: 
 Header: which comes before links
 Link prefix: which comes before each link
 Link suffix: which follows each link
 Footer: which follows last link

In the HTML template, use unique comments to keep these parts separate.

save your template where your appleScript knows where it is.  

To start with I would "hard wire" the path into the script: 
 set myTemplate to "drive:file" as alias

Then, use something like this: 

 set dirWithFilesToLinkTo to choose folder with prompt "Navigate to folder with files you want to include in the HTML"

Use the finder to get a list of files, and use appleScript to message the file paths to valid links.

Next read your template document and use text item delimiters to break it into its segments, then reassemble your document, adding the links to the files in a repeat loop

something like this:
set htmlDoc to {htmlHeader}
repeat with thisURL in listOfURLs
set the end of htmlDoc to linkPrefix
set the end of htmlDoc to thisURL as string
set the end of htmlDoc to linkSuffix
end repeat
set the end of htmlDoc to htmlFooter

set htmlDoc to htmlDoc as string

Write the document to a new file.


HTH,

ES
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.