Applescript question
Bruce D'Arcus
bdarcus at mac.com
Mon Sep 2 19:10:01 PDT 2002
Can someone please help me figure this out? Below is the OO2LaTeX
script I have modifed to produce html-tagged text with headings for OO
levels, and notes placed within the outline. The script worked fine
until I tried to add the "NEW" code below, which gives me the
following error:
Can't make "</p>" into a number.
I'd really like to figure this out, as my next step would be a simple
DocBook XML script. I know virtually nothing about AS though, and only
got this far because John Johnson provided the original script and a
few suggestions (the new code suggestion was from him). I also don't
know how to get the correct heading tagging below the top level of the
outline (h2, h3, etc.)...
Bruce
------------------------------------------------------------------------
---------------------
global topicList, numItems, myText, includeNotes
set return to ASCII character 13
-- *** removed following commands to ask whether to include notes ***
-- display dialog "Include notes as text?" buttons {"Yes", "No"}
default button 1
-- if the button returned of the result is "Yes" then
set includeNotes to true
-- else
-- set includeNotes to false
-- end if
tell front document of application "OmniOutliner"
set numItems to the count of rows
set the topicList to {}
repeat with rowNumber from 1 to numItems
set aRow to row rowNumber
set myTopic to text of cell 2 of aRow
set myLvl to the level of aRow
set myNote to the note of aRow
set the topicList to the topicList & {{myTopic, myLvl, myNote}}
end repeat
end tell
-- BEGIN NEW
set return to ASCII character 13
set theNote to "<p>" & (myNote) & "</p>"
set {olddelims, AppleScript's text item delimiters} to {AppleScript's
text item delimiters, return} --change this line if you need to deal
with multiple returns
set theNoteList to theNote as list
set AppleScript's text item delimiters to "</p>" + return + "<p>"
set theNote to theNoteList as text
set AppleScript's text item delimiters to the olddelims
-- Basically, this is AS's way of doing a find/replace. If your
paragraphs
-- are instead delimited by two returns, put return + return in place
of
-- return in the commented line above.
-- END NEW
set myText to ""
repeat with itemNum from 1 to numItems
set myItem to item itemNum of the topicList
-- set myText to myText & "\\"
if (item 2 of myItem) > 1 then
repeat with subNum from 1 to ((item 2 of myItem) - 1)
-- set myText to myText & "sub"
end repeat
end if
set myText to myText & "<h1>" & item 1 of myItem & "</h1>" & return
if item 3 of myItem is not "" and includeNotes is true then
set myText to myText & return & item 3 of the myItem & return
end if
set myText to myText & return
end repeat
set the clipboard to myText
display dialog "The outline has been converted to html and placed on the
clipboard." buttons {"OK"} default button 1 with icon note giving up
after 5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 12282 bytes
Desc: not available
Url : /mailman/archive/omnioutliner-users/attachments/20020902/999e7b8e/attachment.bin
More information about the OmniOutliner-Users
mailing list