# # File: mkScriptLib.ini # # Function: Makes a whack of HTML Pages # by reading STH:WebScripts # # External files: The following "pattern files" are used # # [Main] Server = $ ENV, ArsSvr $ Port = $ ENV, ArsPort $ User = $ ENV, ArsUsr $ Password = $ ENV, ArsPwd $ ArgNm = Fpfx PrmReq = 1, . PrmReq = . PrmReq = . Function: PrmReq = . This builds Meta-Update Script Library Web pages for PrmReq = . individual scripts pointed to by a filename in the record. PrmReq = . We read STH:WebStr and generate an html page for each record PrmReq = . as well as the index.html with the link table to each of PrmReq = . the built pages. PrmReq = . PrmReq = . Usage: PrmReq = . SthMupd.exe -v $CTL, ScriptFx$ -p Fpfx PrmReq = . where: PrmReq = . Fpfx output file prefix (w/ path) eg: x42_ or /m/k/x42_ PrmReq = . PrmReq = . Notes: PrmReq = . PrmReq = . #--- Do ----------------------------------------------------------------.do++ [Do] # This is the main entry point of this script. This section is # specified on the command line. # # We do an AssignInit to allow for some script configurations # then we query our form of WebScripts in Remedy # specifying a sort order. # AssignInit = asg-Cfg Query = Scr, & STH:WebScr, & @sort(Complexity, Sort, Category, Type, Item), & 'Status' = "Active" AssignPre = DoOnePgEg-asgInit Launch = DoOnePgEg Launch = DoOnePg Launch = DoIndex [DoOnePgEg] # # This queries a dependent form, building an inner string of examples # a la
text[ .. ] # AssignInit = DoOnePgEg-asgInit Query = Eg, & STH:WebScrEg, & 'WebScriptId' = "$Scr, 1$" AssignPre = DoOnePgEg-asgPre AssignTerm = DoOnePgEg-asgTerm [DoOnePgEg-asgInit] @Cmd = Ref, ScrV, Eg, "" [DoOnePgEg-asgTerm] @Cmd = @if("$ScrV, Eg$" != "") & Ref, ScrV, Eg, "$ScrV, Eg$ " [DoOnePgEg-asgPre] @Cmd = @if("$ScrV, Eg$" == "") @Cmd = Ref, ScrV, Eg, "
"
@Cmd = else
@Cmd = Ref, ScrV, Eg, "$ScrV, Eg$\n"
@Cmd = endif
@Cmd = Ref, ScrV, Eg, "$ScrV, Eg$ SthMupd.exe $Eg, Text$ "
[DoOnePg]
Output = F2, F-scr_detail, $Arg, Fpfx$scr_$Scr, Fnm$.html
Assign = F-OnePg-asg
### Double Output= caused a blow up here!
### Output = F2, F-index, $Arg, Fpfx$scr_$Scr, Fnm$.html
[F-OnePg-asg]
# init some fields
@Cmd = Ref, ScrV, Demonstrates, ""
@Cmd = Ref, ScrV, Loading, ""
@Cmd = Ref, ScrV, LoadingNA, ""
@Cmd = Ref, ScrV, icotext, " &
&
&
"
# handle the ico and img attachments ...
@Cmd = @if("$Scr, ico$" != "")
@Cmd = Ref, V2, @rc, 0
@Cmd = Ref, V2, extension, ""
# extracts the file path, name, extension, from the attachment name
# caution! the $Scr, outp$ reference in the next line, causes a get of the attachment val
# really, the val IS the name (only) unless being assigned to an attachment field
# esp now that we have AttachSave ..
@Cmd = Ref, V2, F-split, @regex, @(.*)[/\\\\](.*)\\.(.*)@, $Scr, ico$
@Cmd = @if(! "$V2, @rc$")
@Cmd = Msg, W, regex no match: @(.*)[/\\\\](.*)\\.(.*)@ against: $Scr, ico$
@Cmd = Msg, W, File not extracted
@Cmd = else
@Cmd = Ref, V2, icoR, "scr_$Scr, Fnm$-ico.$V2, extension$"
@Cmd = Ref, V2, ico, "$Arg, Fpfx$$V2, icoR$"
@Cmd = AttachSave, Scr, ico, "$V2, ico$"
@Cmd = @if("$Scr, img$" != "")
@Cmd = Ref, V3, @rc, 0
@Cmd = Ref, V3, extension, ""
@Cmd = Ref, V3, F-split, @regex, @(.*)[/\\\\](.*)\\.(.*)@, $Scr, img$
@Cmd = @if(! "$V3, @rc$")
@Cmd = Msg, W, regex no match: @(.*)[/\\\\](.*)\\.(.*)@ against: $Scr, img$
@Cmd = Msg, W, File not extracted
@Cmd = Ref, ScrV, icotext, " &
&
&
&
&
&
Sample Output &
&
"
@Cmd = else
@Cmd = Ref, V3, imgR, "scr_$Scr, Fnm$-img.$V2, extension$"
@Cmd = Ref, V3, img, "$Arg, Fpfx$$V3, imgR$"
@Cmd = AttachSave, Scr, img, "$V3, img$"
@Cmd = Ref, ScrV, X, 1012
@Cmd = Ref, ScrV, Y, 588
@Cmd = @if("$Scr, ImgWinszH$" != "") &
Ref, ScrV, X, $Scr, ImgWinszH$
@Cmd = @if("$Scr, ImgWinszV$" != "") &
Ref, ScrV, Y, $Scr, ImgWinszV$
@Cmd = Ref, ScrV, icotext, " &
&
&
&
&
&
Click the &
&
Sample Output &
&
to open a
new window with an enlarged image. &
&
"
@Cmd = endif
@Cmd = else
@Cmd = Ref, ScrV, icotext, " &
&
&
&
Sample Output &
&
"
@Cmd = endif
@Cmd = endif
@Cmd = endif
# handle line fields in the long description and Demonstrates
# xlate all into
##@Cmd = Ref, ScrV, F-OnePg-asg-RegexFlds, @regex, @(.*)@, $Scr, DescriptionLong$
# get rid of any terminating line feeds
##@Cmd = Ref, ScrV, F-OnePg-asg-RegexFlds, @regex, @(.*)\<\\p\>\
$@, $ScrV, DescLong$
@Cmd = Ref, ScrV, DescLong, $Scr, DescriptionLong$
# ditto for Demonstrates
##@Cmd = Ref, ScrV, F-OnePg-asg-RegexDemo, @regex, @(.*)@, $Scr, Demonstrates$
##@Cmd = Ref, ScrV, F-OnePg-asg-RegexDemo, @regex, @(.*)\<\\p\>\
$@, $ScrV, Demonstrates$
# handle the text of Demonstrates
@Cmd = Ref, ScrV, Demonstrates, $Scr, Demonstrates$
@Cmd = Ref, ScrV, Demonstrates2, @F-OnePg-asg-Demonstrates
@Cmd = Ref, ScrV, Demonstrates, $ScrV, Demonstrates2$
@Cmd = Ref, ScrV, Demonstrates2, /del
# ditto for loading
##@Cmd = Ref, ScrV, F-OnePg-asg-RegexLoad, @regex, @(.*)@, $Scr, Loading$
##@Cmd = Ref, ScrV, F-OnePg-asg-RegexLoad, @regex, @(.*)\<\\p\>\
$@, $ScrV, Loading$
@Cmd = Ref, ScrV, Loading, $Scr, Loading$
# handle the text of Loading
@Cmd = Ref, ScrV, Loading, @F-OnePg-asg-Loading
# handle the text of Downloading the zip
@Cmd = Ref, ScrV, Dnld, @F-OnePg-asg-Dnld
# eh bien, build the file easy peasy
File = ptn2\\dtl.ptn
[F-OnePg-asg-Dnld]
#
# This is a "called" assignment.
# It checks out the availble download files and builds the download links
# text and saves the download files ..
@Cmd = Ref, V, gotul, 0
String = "
"
String = " "
String = " "
String = " Downloads "
String = " "
@Cmd = @if("$Scr, zip$" != "")
@Cmd = @if(! "$V, gotul$") Include, F-OnePg-asg-Dnld-ul
String = " Save the zip, expand in your samples or scripts directory. "
String = " The zip file may contain different versions of the script "
String = " and a tutorial document. "
String = "
"
String = " zip "
@Cmd = AttachSave, Scr, zip, "$Arg, Fpfx$scr_$Scr, Fnm$.zip"
@Cmd = endif
@Cmd = @if("$Scr, ini$" != "")
@Cmd = @if(! "$V, gotul$") Include, F-OnePg-asg-Dnld-ul
String = " Script Source "
@Cmd = AttachSave, Scr, ini, "$Arg, Fpfx$scr_$Scr, Fnm$.ini"
@Cmd = endif
@Cmd = @if("$Scr, outp$" != "")
# get rid of anoying error msg - change Mupd's SkipIf!!!!
# extracts the file path, name, extension, from the attachment name
# caution! the $Scr, outp$ reference in the next line, causes a get of the attachment val
# really, the val IS the name (only) unless being assigned to an attachment field
# esp now that we have AttachSave ..
@Cmd = Ref, VV, F-split, @regex, @(.*)[/\\\\](.*)\\.(.*)@, $Scr, outp$
@Cmd = @if(! "$VV, @rc$")
@Cmd = Msg, W, regex no match: @(.*)[/\\\\](.*)\\.(.*)@ against: $Scr, outp$
@Cmd = Msg, W, File not extracted
@Cmd = else
@Cmd = @if(! "$V, gotul$") Include, F-OnePg-asg-Dnld-ul
@Cmd = Ref, VV, outp, "$Arg, Fpfx$scr_$Scr, Fnm$.$VV, extension$"
@Cmd = Ref, VV, outpR, "scr_$Scr, Fnm$.$VV, extension$"
String = " Output Example "
@Cmd = AttachSave, Scr, outp, "$VV, outp$"
@Cmd = endif
@Cmd = endif
@Cmd = @if(! "$V, gotul$") Include, F-OnePg-asg-Dnld-ul
String = "
"
String = " "
[F-OnePg-asg-Dnld-ul]
# This assignment section is referenced by [F-OnePg-asg-Dnld] when
# we're handling the first of the Dnld files; it adds the opening
# html
String = " "
String = " "
String = " "
@Cmd = Ref, V, gotul, 1
### [F-OnePg-asg-Dnld-ul-end]
### String = "
"
### String = " "
### String = " "
[F-split]
# This is a regex field declaration for strings extracted
path = $
name = $
extension = $
[F-OnePg-asg-Demonstrates]
# Called section (Included); add the "Demonstrates" section and text
@Cmd = @if("$ScrV, Demonstrates$" != "")
String = "Demonstrates &
"
String = " $ScrV, Demonstrates$"
String = "
"
@Cmd = endif
[F-OnePg-asg-Loading]
# Called section (Included); add the "Loading" section and text
# add the "Running" section and text
@Cmd = @if("$ScrV, Loading$" != "" || "$Scr, LoadingNA$" != "")
String = "Loading &
"
@Cmd = @if("$Scr, LoadingNA$" != "")
String = " Running this script is not advised. $Scr, LoadingNACmt$"
String = "
"
@Cmd = endif
String = " $ScrV, Loading$"
String = "
"
@Cmd = endif
@Cmd = @if("$Scr, Running$" != "" || "$Scr, LoadingNA$" != "")
String = "Running &
"
@Cmd = @if("$Scr, LoadingNA$" != "")
String = " Running this script is not advised. $Scr, LoadingNACmt$"
String = "
"
@Cmd = endif
String = " $Scr, Running$"
String = "
"
@Cmd = endif
@Cmd = @if("$ScrV, Eg$" != "")
# String = "Examples "
String = " $ScrV, Eg$ "
@Cmd = endif
### [F-OnePg-asg-zip]
[F-OnePg-asg-RegexFlds]
# here we'll just match the whole string always and use the Subst in
# the field definition to replace embedded line feeds with the
# html equivalent of ""
DescLong = $ ## Subst @\n@
@
[F-OnePg-asg-RegexDemo]
Demonstrates = $ ## Subst @\n@
@
[F-OnePg-asg-RegexLoad]
Loading = $ ## Subst @\n@
@
#- DoIndex -----------------------------------------------------------
[DoIndex]
# This control section creates the Index.html file with the table
# of references having been generated already by querying (and
# building the html pages) the WebScripts table.
#
Output = F1, F-index, $Arg, Fpfx$index.html
# This outputs the opening text
AssignOpen = F-index-asg-Open
# This doesn't actually add to the index.html file
Assign = asg-elm
# This output's the stuff accumulated in the Assign=
# and the terminating text
AssignClose = F-index-asg-Close
#- Output Files ------------------------------------------------------
[F-index]
Type = Pattern
[F-scr_detail]
Type = Pattern, MultiFile
#- Assignment Sections -----------------------------------------------
[asg-Cfg]
@Cmd = Ref, Cfg, IndexLinkText, 1
[F-index-asg-Open]
File = ptn2\\ix_open.ptn
@Cmd = Ref, BUF, p1, @asg-1-pre
@Cmd = Ref, BUF, p2, @asg-2-pre
@Cmd = Ref, BUF, p3, @asg-3-pre
[asg-1-pre]
String=" "
String="
"
String= @if ("$Cfg, IndexLinkText$") &
" These simple scripts are a good introduction to Meta-Update. These scripts generate reports and files."
[asg-2-pre]
String=" "
String="
"
String= @if ("$Cfg, IndexLinkText$") &
" These are more complex scripts used to generate files, extract data, and update data in ARS or ITSM. These scripts will extend your knowledge of Meta-Update scripting."
[asg-3-pre]
String=" "
String="
"
String= @if ("$Cfg, IndexLinkText$") &
" These scripts perform complex extracts, loads, and updates of ITSM data. You should be familiar with Meta-Update scripting for these scripts"
[asg-elm]
@Cmd = Ref, X, text, @asg-elm-item
@Cmd = @if("$Scr, Complexity$" == "Simple")
@Cmd = Ref, BUF, p1, $Buf, p1$$X, text$
@Cmd = endif
@Cmd = @if("$Scr, Complexity$" == "Middle")
@Cmd = Ref, BUF, p2, $Buf, p2$$X, text$
@Cmd = endif
@Cmd = @if("$Scr, Complexity$" == "Complex")
@Cmd = Ref, BUF, p3, $Buf, p3$$X, text$
@Cmd = endif
[asg-elm-item]
String="
"
String=" $Scr, Description$"
[F-index-asg-Close]
File = ptn2\\ix_close.ptn
[F-index-asg-elm]
File = ptn2\\ix_close.ptn