Parse-O-Matic
Home Sitemap
 

About the PSKB / Terms of Use


Installing and running a script

;===============================================================================
;
; HTML File Mass Edit
;
; This script is designed for use with the Parse-O-Matic Power Tool,
; which is available from www.parse-o-matic.com.
;
; This script will copy any or all HTML files (i.e. files with the extension
; .htm .html or .css) from one folder (directory) into another folder, and
; in so doing will apply the same changes to all of them.
;
; The destination directory must contain a lookup file named:
;
; LufHTMLMassChange.txt
;
; This is a standard Parse-O-Matic lookup file. Briefly stated, it is a
; CSV (Comma Separated Value) file with (in this case) two fields. The
; first field is the original text and the second field is the new text.
; Note that changes are made in the order they appear in the lookup file.
; Here is an example of a lookup file:
;
; "aol.com/psmisc" , "aol.com/getmydata/pskb/pskb.htm"
; "/psmisc/favicon.ico" , "/getmydata/favicon.ico"
;
; (These are two of the edits we used when we were moving the PinnSoft
; Knowledge Base to a new URL.)
;
; As you can see, lookup files are quite tolerant about format. For more
; information about lookup files, please consult the Parse-O-Matic user
; manual.
;
; This handy utility can save you a lot of time if you have many web pages
; which need to be changed in the same way. There are HTML editors that do
; this very nicely, but some of us still like to create each web page the
; old-fashioned way -- in a text editor. Somehow an HTML editor just seems
; like more work to us!
;
; Needless to say, this script can easily be adapted to apply mass changes
; to any kind of text files, so it can serve as the foundation for an
; automatic multiple text file editor.
;
;===============================================================================
; Config Section
;===============================================================================
Config
$CfgEnableOptionX = 'Y'
$CfgCaptionX = '&DestFolder'
$CfgHintX = 'Name of folder to which to send modified HTML files'
$CfgEnableOptionY = 'N'
$CfgEnableOptionZ = 'N'
$CfgCopyright = 'Copyright © 2005-2008 by Pyroto, Inc.'
$CfgVersion = '1.00.00'
$CfgProgrammer = 'Timothy Campbell'
AtSym = '@' ; Anti-spam technique
$CfgEmail = 'info' AtSym 'parse-o-matic.com'
$CfgLicense = 'This script may be used by anyone who has a valid ' >>
'Advanced Scripting License from Pyroto, Inc. ' >>
', or is evaluating one of our ' >>
'Parse-O-Matic products (for up to 30 days).'
$CfgDefaultOFN = ''
End
;===============================================================================
; TaskInit Step
;===============================================================================
TaskInit
DestFolder = $OptionX
Change DestFolder '/' '\'
If DestFolder = '' Stop 'Please specify a destination folder in '>>
'the DestFolder input box' $A0$0D$0A$0D >>
'Note: Your lookup file LufHTMLMassChange.txt must already be located ' >>
'in the specified folder'
LastChar = Parse DestFolder -1 -1
If LastChar <> '\' DestFolder = DestFolder '\'
LufFName = DestFolder 'LufHTMLMassChange.txt'
LookUpFile 'HTMLMC' LufFname
ValidExtens = ' .htm .html .css'
End
;===============================================================================
; TaskDone Step
;===============================================================================
TaskDone
ShowNote ''
End
;===============================================================================
; FileInit Step
;===============================================================================
FileInit
ShortInpFname = $ActualIFN
SourceDir = Parse ShortInpFname '' '>*\' 'Cut Include'
If SourceDir = DestFolder Stop >>
'Your DestFolder cannot be the same as your input folder'
ShowNote ShortInpFname
SIFExten = Parse ShortInpFname '>*.' '' 'Include'
If ValidExtens ^ SIFExten OutFileOkay = 'Y'
Otherwise OutFileOkay = 'N'
FirstPass = 'Y'
End
;===============================================================================
; Main
;===============================================================================
; Check that we can process this file; if so, set the new output file
;-------------------------------------------------------------------------------
Begin FirstPass = 'Y'
FirstPass = 'N'
Begin OutFileOkay = 'N'
LogMsg ' Not processed -- valid extensions are:' $0A$0D >>
ValidExtens
NextStep
End
NewOFN = DestFolder ShortInpFname
OutFile NewOFN
End
;-------------------------------------------------------------------------------
; Apply and output the changes
;-------------------------------------------------------------------------------
MassChange $Data 'HTMLMC'
OutEnd $Data




 

Parse-O-Matic Free, Basic, Business and Enterprise are data conversion tools that allow you to parse, convert, mine, import and export data files, reports, web capture, logs, legacy databases, text, CSV (comma separated; comma delimited), ASCII, EBCDIC, and almost any data format that you may have.

Copyright © 1986-2010 Pyroto, Inc. All rights reserved. Legal