Forum OpenACS Q&A: getting a script to run

Collapse
Posted by Matthew Smith on
I have a script I found in the documentation at:http://media.wu-wien.ac.at/download/xowiki-doc

How do I actually get the script to run?

Here is the script I am trying to get to work:
-------------------------------------------------------------
## A small script to load the OpenACS documentation into xowiki
## by Gustaf Neumann
## load doc pages into xowiki -gustaf neumann

# include path for loading tdom
lappend auto_path /usr/local/aolserver4/lib
package require tdom
package require XOTcl; namespace import ::xotcl::*
package require xotcl::serializer

set docpath /usr/local/openacs-4/packages/acs-core-docs/www/

namespace eval ::xowiki {
Class create Page -parameter { {lang en} {description ""} {text ""}
{nls_language en_US} {mime_type text/html} name title text }

set c 0
foreach docpage [glob $docpath/*.html] {
set f [open $docpage r]; set data [read $f]; close $f
dom parse -html $data doc
$doc documentElement root

set content ""
foreach n [$root selectNodes //body/*] { append content [$n asHTML] \n }

set p [Page create page[incr c] -name en:[file tail $docpage] \
-title [[$root selectNodes //title] asText] \
-text [list $content text/html]]
puts [::Serializer deepSerialize $p]
}
}

Collapse
Posted by Gustaf Neumann on
Sorry, i was a few days abroad. The most simple solution is to run the script outside OpenACS/aolserver. Call it with "tclsh scriptname". You might want to adjust the document path, and maybe the autopath.