On Mar 28, 2012, at 04:21, blue-orange wrote:
> I have the following task of creating a page with 1000 thumbnails linked to 
> larger files.
> I want to automate the task and the automation part is an unfamiliar 
> territory for me.

______________________________________________________________________

Hey There,

TJ's shell script looks quite spiffy, but this is maybe a little more 
user-friendly.

The script expects open documents for your original and preview lists:

 "Original_Images.txt"
 "Preview_Images.txt"

It will then assemble the requisite pieces into a new document.

On my MacBook Pro it takes ~ 0.5 seconds to run from the BBEdit Script Menu 
using 1000 line image lists.

Let me know whether or not that's what you had in mind.

--
Best Regards,
Chris

------------------------------------------------------------------------------------------------
#       Author: Christopher C. Stone <[email protected]>
#      Created: 2012-03-28 : 15:23
#     Modified: 2012-03-28 : 15:23 
#  Application: BBEdit
#      Purpose: TEST FOR BLUE-ORANGE ON THE BBEDIT LIST.
#             : Create href list from template and original & preview image url 
lists.
# Dependencies: none
------------------------------------------------------------------------------------------------
try
        set previewDocName to "Preview_Images.txt"
        set originalDocName to "Original_Images.txt"
        set hrefTemplateOrig to "<a href=\""
        set hrefTemplatePrev to "\"><img src=\""
        set hrefTemplateEnd to "\"></a>"
        set newDocContent to {}
        
        tell application "BBEdit"
                if (document originalDocName exists) and (document 
previewDocName exists) then
                        set prevEndLine to endLine of text of document 
previewDocName
                        set origEndLine to endLine of text of document 
originalDocName
                        if prevEndLine = origEndLine then
                                set prevLines to contents of lines of document 
previewDocName
                                set origLines to contents of lines of document 
originalDocName
                                
                                repeat with i from 1 to length of prevLines
                                        set _temp to hrefTemplateOrig & (item i 
of origLines) & hrefTemplatePrev & (item i of prevLines) & hrefTemplateEnd
                                        set end of newDocContent to _temp
                                end repeat
                                
                                set {oldTIDS, AppleScript's text item 
delimiters} to {AppleScript's text item delimiters, return}
                                set newDocContent to newDocContent as text
                                make new text document with properties 
{text:newDocContent}
                                set AppleScript's text item delimiters to 
oldTIDS
                                
                        end if
                end if
        end tell
        
on error eMsg number eNum
        set {c, s} to {return, "------------------------------------------"}
        set e to s & c & "Error: " & eMsg & c & s & c & "Error Number: " & eNum 
& c & s
        beep
        display dialog e
end try
------------------------------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to