home *** CD-ROM | disk | FTP | other *** search
/ ftp.funduc.com / 2014.08.ftp.funduc.com.tar / ftp.funduc.com / sr-64.zip / ScriptInfo.txt < prev    next >
Text File  |  2008-12-10  |  20KB  |  433 lines

  1.                   Search and Replace for Windows
  2.                       Funduc Software, Inc.
  3.              Copyright 1995-2009, All Rights Reserved
  4.     http://www.searchandreplace.com     http://www.funduc.com
  5.  
  6.             Information On Search And Replace Scripts
  7.             -----------------------------------------
  8.                            Version 6.1
  9.  
  10. Provided here is some information on Search and Replace scripts.
  11. This contains a sample script (see below for cut lines) but this
  12. file itself is NOT a sample script. Sample scripts installed with
  13. the program. They all have the name extension, .srs.
  14.  
  15. This information is also available in the program F1 hlp.
  16.  
  17. Scroll to below the sample script in this file for information on
  18. the [Options] section switches.
  19.  
  20. Notes:
  21. ------
  22.  
  23. * Scripts are saved as ASCII files. The safest way to create a
  24. valid script is to use the Script dialog. As you gain experience
  25. you can modify/create scripts with your text editor, perhaps using
  26. an existing script as a model. Be sure to reload your script into
  27. the Script dialog if you edit it with an external editor
  28.  
  29. * The simplest script possible is a text file consisting of a
  30. search string(s) separated by blank lines or a search/replace
  31. string(s) on adjacent lines. See the F1 hlp topic -Simple Script-
  32. for more information.
  33.  
  34. * If you are running a script from the command line, add the /s
  35. switch to launch Search and Replace and automatically initiate a
  36. search. If your script involves a replace, use /r in your command
  37. line to initiate the replace.
  38.  
  39. * Please note that if you specify linked script(s), follow-up
  40. scripts operate in the same mode as the script that launches them.
  41. For example, if the initial script is run as a search-only,
  42. scripts linked from the initial script are also search-only. If
  43. the initial script is run as a search-replace, linked scripts are
  44. search-replace.
  45.  
  46. * The following tags must be at the beginning and end of the
  47. script: [Script for Search and Replace] and [End of Search and
  48. Replace Script].
  49.  
  50. * Comment text must immediately follow the [Script for Search and
  51. Replace] section or after the closing ] bracket in the Search &/or
  52. Replace strings.
  53.  
  54. * The order of section headings must follow that outlined below. 
  55.  
  56. * The [Options] section is not required. If you create a script
  57. using a text editor and wish to set only one or a few options, it
  58. is OK to enter only those specific options. Scripts saved via
  59. Search and Replace will have all options saved with the script.
  60.  
  61. * Search strings can be entered on the next line after a [Search]
  62. tag. To enter the Regular Expression, Case Sensitive off (or
  63. Insensitive), Whole Word Only and Binary Mode, you must use the /x
  64. /i /w /b flags respectively. The flags are case insensitive. This
  65. is similar to the flags for Command Line Parameters.
  66.  
  67. * Replace strings can be entered on the next line after a
  68. [Replace] tag. You can only use the /b flag for Binary Mode with
  69. this tag since all other tags are specified on the Search field.
  70.  
  71. * Path and mask strings can be entered on the next line after a
  72. [Path] tag. No flags can be used with this tag. The mask string
  73. must be entered right after the path string and a \ character is
  74. expected between them. For example c:\*.ini will use Path C:\ and
  75. Mask *.ini. If you turn on the Search Subdirectories box on the
  76. main window, all INI files on the C: drive would be processed.
  77.  
  78. * You can enter Search strings only, both Search and Replace
  79. strings, Path and mask strings only, or all the fields in a
  80. script. You can also override some of the values from the main
  81. window by entering new Search and Replace strings or new Path and
  82. Mask strings. 
  83.  
  84. * When a script is active, the Search, Replace, File Mask, and
  85. Path fields in the Search and Replace main window will change to
  86. reflect the script in use. For example, given a script named,
  87. example.srs, which only has settings for a search string, the
  88. Search field in the main window will change to read "Use Script
  89. file: d:\example.srs". If example.srs also involved a replace
  90. string and a file mask, the Replace and File Mask fields would
  91. also change to read, "Use Script file: d:\example.srs".
  92.  
  93. * See the F1 Help for information on use of the %%today%% string
  94. in the Min Date Filter= and/or Max Date Filter= switches for
  95. manually edited scripts.
  96.  
  97. * SRDUMP.SRS File: To generate a script file that contains
  98. your current program settings, do the following:
  99.  
  100.   1. Hold the CTRL key and click on the Scripts toolbar button 
  101.      with your mouse. 
  102.   2. The above will cause the script editor to open. Close the 
  103.      editor. 
  104.   3. A file named 'SRDUMP.SRS' is generated in the 'Program Work
  105.      Path' by Step 1. Unless you have taken special steps for a
  106.      network installation, this is generally the same file path
  107.      that the Search and Replace executable is (sr32.exe) is
  108.      installed in. C:\Tools\SR is the default program installation
  109.      path.
  110.   4. Use your file manager to copy/rename SRDUMP.SRS to another file. 
  111.   
  112. You can use SRDUMP.SRS as a template for developing other scripts.
  113.  
  114. --------- SAMPLE SCRIPT BEGINS ON NEXT LINE ---------------------
  115. [Script for Search and Replace]
  116.  
  117. This is an example script using alternate program options for the
  118. script. The text you are reading here is the script comment added
  119. via the Advanced Script Dialog. Script comments always after the
  120. 'Script for Search and Replace' tag and before any other section
  121. tags.
  122.  
  123. NOTE: The script sections demarked by [ ] and the [Options]
  124.   switches must be entered in the order you see here. The first
  125.   line must be the bracketed 'Script for Search and Replace' tag
  126.   above. If you are not using Linked Scripts, the 'End of Search
  127.   and Replace Script' tag is the last line. 
  128.   
  129. NOTE: It is not necessary to specify all the [Options] switches.
  130.   For version 3.9 and above, switches within the [Options]
  131.   section can be in any order. If a given Options switch is not
  132.   specified in a script, the settings last in effect for the
  133.   program will be used. In addition, the General Options settings
  134.   that are included in the 'SRDUMP file' method above are ignored
  135.   when the script is run in version 3.9+. For example, if your
  136.   script specifies a 'Default Viewer', the program ignores this
  137.   when you run the script. This preserves your default settings
  138.   for interactive use.
  139.  
  140. NOTE: Use the 'SRDUMP file' to generate a script that contains the
  141.   program options currently in effect. You can use SRDUMP.SRS as a
  142.   template for developing other scripts manually.
  143.  
  144. NOTE: The iteration switch, Script Loop= , must be added by
  145.   editing the script manually with your text editor. Script Loop=
  146.   must be the last entry in the [Options] section. See F1 hlp
  147.   topic - Scripts-Iteration Operator - for more info.
  148.  
  149. NOTE: See F1 hlp topic - Scripts-Linked Scripts - for information
  150.   on how to chain scripts. For version 3.4+, follow-up scripts are
  151.   specified below the [End of Search and Replace Script] line in a
  152.   script. You must specify this manually, via your text editor.
  153.  
  154. [Expression]
  155. E1 AND E2
  156. [Options]
  157. Search_subdir=0
  158. Prompt_flag=0
  159. One hit=0
  160. Count Across Files=0
  161. Replace Processing=0
  162. Process Binary Files=1
  163. Buffer Size=102400
  164. Num Buffers To Process=0
  165. Output_File=
  166. Append to output file=0
  167. Backup Path=D:\SRBACKUP
  168. Write to Backup Dir=0
  169. Keep file time stamp=0
  170. Max Display Chars=128
  171. Max Reg Expr=32767
  172. Unzip Dir=C:\WINDOWS\TEMP
  173. Show Progress Dialog=1
  174. Before Hit=<
  175. After Hit=>
  176. Line Prefix=Line %3d -  
  177. Binary Prefix=Offset 0x%6lx -
  178. Show_Files=1
  179. Show Files Without Hits=1
  180. Display Replace String=1
  181. Display File Stats=1
  182. Show File Date and Size=0
  183. Reverse Filters=0
  184. Min Size Filter=0
  185. Max Size Filter=0
  186. Min Date Filter=%%today-1%% 
  187. Max Date Filter=
  188. Skip Files Mask=0
  189. Ignore Attributes=55
  190. Sort File Names=3
  191. Sort Ascending=0
  192. Script Loop=1
  193. [Search]          This comment added to a search line.
  194. Search string #1
  195. [Replace /b]      This comment added to a replace line.
  196. Replacement string #1
  197. [Search /bix]
  198. Search string #2
  199. [Replace]
  200. Replacement string #2
  201. [Path]
  202. c:\*.ini
  203. [Path]
  204. d:\work\*.txt
  205. [End of Search and Replace Script]
  206. c:\tools\sr\Linked Script1.srs
  207. c:\tools\sr\Linked Script2.srs
  208. --------- SAMPLE SCRIPT ENDS ON LINE ABOVE ---------------------
  209.  
  210.              Script [Expression] & [Options] Sections
  211.              ----------------------------------------
  212.  
  213. Below is some detail on the items in the [Expression] and
  214. [Options] section of a script. Use this as a guide for manual
  215. edits.
  216.  
  217. It is not necessary to specify all switches in the [Options]
  218. section. For example, a sole [Options] item could be Prompt_flag=0.
  219.  
  220. The order of the [Options] switches should be maintained to ensure
  221. the program parses the input properly. For example, if you have
  222. Show_Files= and Display Replace String= specified in your script,
  223. do so in this order.
  224.  
  225.  
  226. Script Item                 Description
  227. ----------------            --------------------------------------
  228. [Expression]
  229. E1 AND E2                   This section is optional. It is created 
  230.                             via the Advanced Dialog in the script 
  231.                             editor.
  232.  
  233. [Options] 
  234. Search_subdir=              0 = No; 1 = Yes. If this switch is
  235.                             not specified, the current program
  236.                             setting is used.
  237.  
  238. Prompt_flag=                Corresponds to Replace Prompts in
  239.                             Options-Replace. 0 = Prompt on All;
  240.                             1 = Prompt on Each File; 2 = No
  241.                             Prompts. Current program setting is
  242.                             used if this is not specified.
  243.  
  244. One hit=                    Corresponds to 'Stop Processing After
  245.                             First Hit In File' in Options-Search.
  246.                             0 = No; 1 = Yes. Omit to use current
  247.                             program setting.
  248.  
  249. Count Across Files=         This is for v 4.3+.  %n>> and %n<< 
  250.                             counter replacements normally do not
  251.                             reset with each file.  Specify Count
  252.                             Across Files=1 to cause the program to
  253.                             reset with each new file instead of
  254.                             sequencing across files.  This switch
  255.                             must be specified manually with a text
  256.                             editor.
  257.  
  258. Replace Processing=         For ver 4.4+. See Special Case
  259.                             Handling for more information. The
  260.                             choices are:
  261.                             Replace Processing=0 - No special effects. 
  262.                               This is the default if the switch is 
  263.                               omitted.
  264.                             Replace Processing=1 - Capitalize words
  265.                               during replaces.
  266.                             Replace Processing=2 - Match Existing
  267.                               letter case.
  268.                               
  269. Process Binary Files=       For version 5.0+. Search and Replace
  270.                             normally searches any file that meets
  271.                             the file mask/path and filter
  272.                             criteria.  If you specify Process
  273.                             Binary Files=0 the program will skip
  274.                             any file it determines is 'binary'.
  275.                             Note that depending your output
  276.                             settings, the file(s) will still be
  277.                             listed.  But they will be shown as
  278.                             having no hits.
  279.                             
  280. Buffer Size=                The size of the memory block (in
  281.                             bytes) used by the program when
  282.                             reading files can be adjusted using
  283.                             this switch.  For most uses we suggest
  284.                             leaving this at default or omitting it
  285.                             entirely.  The default is 102400.  The
  286.                             lowest value permitted is Buffer Size=
  287.                             1024.
  288.  
  289.                             Note: Buffer Size may have indirect
  290.                             effect on Max Reg Expr= behavior.  If
  291.                             Buffer Size= is set lower than Max Reg
  292.                             Expr= by limiting the size of blocks
  293.                             searched the effective Max Reg Expr=
  294.                             is limited to Buffer Size.  The
  295.                             default Max Reg Expr=32767 bytes.  If
  296.                             your search requires this span as a
  297.                             minimum, Buffer Size should be at
  298.                             least Buffer Size=32767.
  299.  
  300. Num Buffers To Process=     Use this switch to limit the number of
  301.                             blocks to process in each file.  The
  302.                             default Num Buffers To Process=0 means
  303.                             all blocks, or the entire file.  This
  304.                             switch can be used in conjunction with
  305.                             the Buffer Size= switch above.  For
  306.                             example, to search only the first
  307.                             26,000 bytes of all files specify:
  308.                               Buffer Size=26000
  309.                               Num Buffers To Process=1
  310.                             
  311.                             Note: If One hit=1 is specified, that
  312.                             switch takes precedence if a hit is
  313.                             found within the number of blocks
  314.                             specified.
  315.  
  316. Output_File=                Options-Output. Omit or leave blank if 
  317.                             none is to be used.
  318.  
  319. Append to output file=0     Corresponds to 'Append to Output File'
  320.                             in Options-Output. 0 = No; 1 = Yes.
  321.                             Omit to use current program setting.
  322.  
  323. Max Reg Expr=               Options-Search. Determines the maximum
  324.                             number of characters spanned by
  325.                             regular expression terms. The range is 
  326.                             50 to 32767.
  327.                             
  328. Max Display Chars=          Options-Search. Determines the number
  329.                             of characters to list on each hit line.
  330.                             The range is 128 to 4069.
  331.  
  332. Backup Path=                Options-Replace. If this switch is
  333.                             included but no file is specified,
  334.                             no backup path will be used. If not
  335.                             specified, the program default is
  336.                             used.
  337.  
  338. Write to Backup Dir=        Options-Replace. 0 = No; 1 = Yes
  339.  
  340. Unzip Dir=                  Options-Search.
  341.  
  342. Keep file time stamp=       Corresponds to 'Do not change file
  343.                             date/time' in Options-Replace. 0 = No;
  344.                             1 = Yes. Omit to use current program
  345.                             setting.
  346.  
  347. Show Progress Dialog=       Options-Search. Determines whether or 
  348.                             not to display the progress meter.
  349.  
  350. Before Hit=                 Options-Output. 
  351. After Hit=
  352.  
  353. Show_Files=                 Corresponds to 'Display First Hit
  354.                             Line' in Options-Output. 0 = No; 1 =
  355.                             Yes. Current program setting is used
  356.                             if this is not specified.
  357.  
  358. Show Files Without Hits=    Corresponds to 'Display Files
  359.                             Without Hits' in Options-Output. 0 =
  360.                             No; 1 = Yes. Current program setting
  361.                             is used if this is not specified.
  362.  
  363. Display Replace String=     Corresponds to 'Display Replace
  364.                             String' in Options-Output. 0 = No; 1
  365.                             = Yes. Current program setting is
  366.                             used if this is not specified.
  367.  
  368. Display File Stats=         Corresponds to 'Display Number of
  369.                             Hits in File' in Options-Output. 0 =
  370.                             No; 1 = Yes. Current program setting
  371.                             is used if this is not specified.
  372.  
  373. Show File Date and Size=    Corresponds to 'Display File Size and
  374.                             Date/Time' in Options-Output. 0 =
  375.                             No; 1 = Yes. Current program setting
  376.                             is used if this is not specified.
  377.  
  378. Reverse Filters=0           Corresponds to the 'Reverse Filter'
  379.                             checkbox in Options-Filter. 0= No; 1 =
  380.                             Yes. Omit to use current program
  381.                             setting. See Skip Files Mask and
  382.                             Ignore Attributes below for more info.
  383.  
  384. Min Size Filter=            Options-Filter. Omit some or all to 
  385. Max Size Filter=            use current program setting. You can 
  386. Min Date Filter=            use a form of %%today%% for the Date
  387. Max Date Filter=            switches.
  388.  
  389. Skip Files Mask=0           The default values for these two 
  390. Ignore Attributes=55        settings are listed here. These values
  391.                             are related to the Attributes
  392.                             checkboxes in Options-Filters. The
  393.                             number of possible values, in
  394.                             conjunction with the Reverse Filters
  395.                             switch above, is extensive and
  396.                             difficult to explain. Most users will
  397.                             not have any setting here. If you
  398.                             do need a special setting,
  399.                             experiment interactively with Options-
  400.                             Filters dialog and some file searches.
  401.                             When you are satisfied, generate an
  402.                             'SRDUMP.SRS' file and copy the
  403.                             switch settings into your production
  404.                             script. You can also write us for help
  405.                             at support@searchandreplace.com
  406.  
  407. Sort File Names=            Corresponds to the 'Sort Results By'
  408.                             combo list in Options-Search. The
  409.                             values are: 0 = Unsorted, 
  410.                             1 = File Name, 2 = File Extension, 
  411.                             3 = File Date/Time, 4 = File Size, 
  412.                             5 = File Path. Omit to use current 
  413.                             program setting.
  414.  
  415. Sort Ascending=             Corresponds to the Sort Ascending
  416.                             checkbox in Options-Search. 0 =
  417.                             Descending, 1 = Ascending. Omit to use
  418.                             current program setting.
  419.                             
  420. Line Prefix=                These two switches for for v 4.3+ only. 
  421. Binary Prefix=              They are 'read-only' settings for users 
  422.                             who create/edit scripts manually, with
  423.                             a text editor.  If you save a script
  424.                             with the script editor these switches
  425.                             will be stripped out.
  426.  
  427. Script Loop=                Script Iteration Counter. This must be
  428.                             entered manually. It must be the last
  429.                             entry in the [Options] section. Also
  430.                             see Script Repeat Action in the F1 Help 
  431.                             form information on how to repeat specific 
  432.                             search/replace strings. 
  433.