40
147
But if you want to replace A with B and X with Y in a single set of files, you should do so as a single action
on the Action panel. Simply set the search type on the Action panel to ´list of literal textµ or ´list of regular
expressionsµ. Then you can add both the A->B and X->Y replacements to the list on the Action panel. Turn
off non-overlapping search if you want to make the second replacement work on the results of the first
replacement as would happen when you run the two replacements as separate actions. The benefit of using a
single action is that each file is opened and saved only once.
A PowerGREP Sequence executes the actions in the sequence independently. There is no way to make a later
step in the action use the search matches found by an earlier step in the action, even if both steps work on the
same set of files. This is just like executing two actions on the Action panel: the second action doesn’t know
anything about the first. If you want to do something like searching for something in a file, and then using
that match in a search-and-replace, you need to do that in a single action. PowerGREP’s way of allowing
named capturing groups to carry over from one part of the action to the next makes this possible.
The only thing that can be carried over from an earlier step in the sequence to a later step is the file selection,
including the ability to make a step process only the files that a previous step searched through, found
matches in, did not find matches in, or created as a target file.
Building Up a PowerGREP Sequence
Before adding a step to the sequence, use the Action panel to prepare the file selection and action for the
step. Then click the New Step button on the Sequence panel. Change the settings on the Action panel as
needed for the second step, and click the New Step button again. You can add as many steps to the sequence
as you like. Steps are executed strictly from top to bottom. Use the Up and Down toolbar buttons to change
their order.
To permanently remove a step from the sequence, click the Delete button on the toolbar. To temporarily
disable a step, clear the checkbox next to the step in the list on the Sequence panel.
To edit a step’s action, use the items under the Action button on the Sequence toolbar or in the Action
submenu in the Sequence menu. First click Sequence to Action to copy the action from the selected step to
the Action panel. Edit the action on the Action panel. Then use Action to Sequence to copy the action from
the Action panel to the selected step, replacing the old action.
By default, all steps in the sequence have their ´file selectionµ option set to ´File Selectorµ. That means the
step will search through the files marked on the File Selector panel at the time you execute the sequence. This
allows you to create sequences that are not tied to a specific set of files. Whenever you want to execute the
sequence on a new set of files, just load the sequence on the Sequence panel, prepare a new file selection in
the File Selector, and execute the sequence.
You can make the sequence to work on a specific set of files, ignoring the File Selector. Select the first step in
the sequence and then click on File Selector to Sequence under Files on the Sequence toolbar. This copies the
file selection to the step. The ´file selectionµ setting for the first step then indicates ´own file selectionµ.
If you want another step in the sequence to work on the same set of files, select that step. Click on the ´file
selectionµ drop-down list and choose ´file selection from other stepµ. Then select the step that has its own
file selection in the ´stepµ drop-down list. This list indicates steps by the index numbers that they have in the
sequence. Those numbers are also shown in the first column of the list of steps. The benefit of copying the
C# Imaging - Scan Barcode Image in C#.NET RasterEdge Barcode Reader DLL add-in enables developers to add barcode image recognition & types, such as Code 128, EAN-13, QR Code, PDF-417, etc.
add jpg to pdf file; how to add an image to a pdf in reader
33
148
file selection to only the first step that uses it and then making all other steps reference it is that you can easily
change the set of files that all those steps work on simply by copying a new file selection to the first step.
A step can also work on a subset of the files that were searched through by a previous step. Instead of
choosing ´file selection from another stepµ in the ´file selectionµ drop-down list, you can choose:
Files matched by other step: Search through the files in which another step in the sequence already
found matches.
Files not matched by other step: Search through the files that another step searched through without
finding any matches.
Target files from other step: Search through the files that were created or overwritten by another
step.
Executing a PowerGREP Sequence
Click the Preview, Execute, or Quick Execute button on the Sequence toolbar to preview or execute the
sequence. The Preview and Execute buttons keep detailed results for each step. Quick Execute only counts
search matches and is therefore faster and uses less memory. Previewing a sequence does not modify any files
at all. Since the steps in the sequence always run independently, previewing a sequence will not give the same
results as executing it if a later step searches through files that would have been created or modified by an
earlier step if you had executed the sequence rather than previewing it.
If any of the actions in the sequence create backup files, then the sequence is added as a single item to the
Undo History. There you can delete all the backup files created by the sequence or use them to undo the
changes made by the sequence. If multiple steps in the sequence modify the same file, only one backup copy
is made of that file. Undoing a sequence always undoes all steps in the sequence.
While the sequence runs, PowerGREP updates the Results panel with the results of the step that is being
executed. When the last step has completed, the Results panel shows the results of the last step. To see the
results of an earlier step, select the step on the Sequence panel and click on Sequence to Results under the
Results button on the Sequence toolbar or in the Results submenu in the Sequence menu. This copies the
results of the selected step to the Results panel.
If you double-click a step in the sequence, the file selection, action, and results of that step are all copied to
the File Selector, Action, and Results panels.
Examples: Replace in file names and contents and Apply an extra search-and-replace to target files
C# PDF Image Extract Library: Select, copy, paste PDF images in C# Get image information, such as its location, zonal information, metadata, and so on. Able to edit, add, delete, move, and output PDF document image.
adding an image to a pdf file; add jpg to pdf form
28
149
18. Sequence Menu
The Sequence menu lists commands for use with the Sequence panel. See the Sequence reference chapter for
more information on the Sequence panel itself.
Clear
Removes all steps from the Sequence panel.
Open
Loads a sequence from a PowerGREP Sequence Action file or a sequence with results from a PowerGREP
Sequence Results file.
You can quickly reopen a recently opened or saved sequence file by clicking the downward pointing arrow
next to the Open button on the Sequence toolbar. Or, you can click the right-pointing arrow next to the
Open item in the Sequence menu. A new menu listing the last 16 opened or saved files will appear. Select
´Maintain Listµ to access the last 100 files.
Save
Saves the whole sequence into a PowerGREP Sequence Action file. Any results that may appear on the
Sequence panel are not saved. You will be prompted for the file name each time.
Sequence files are appropriate for sequences that you execute repeatedly, in exactly the same way. Sequence
files can be executed from the command line. You can even generate them with other applications. Use the
Library panel to store boilerplate sequence definitions for later adaptation.
Save Results
This command is only available after you’ve executed the sequence. It saves the whole sequence and the
results of all its steps into a PowerGREP Sequence Results file. PowerGREP results files use a special XML-
based file format. While you could process the XML file with other applications, the primary purpose of
saving results files is to be able to inspect the results in PowerGREP at a later time.
Favorites
If you often open the same files, you should add them to your favorites for quick access. Before you can do
so, you need to save the sequence to a file. PowerGREP’s window caption will then indicate the name of the
sequence file. Click the downward pointing arrow next to the Favorites button on the Sequence toolbar, or
24
150
the right-pointing arrow next to the Favorites item in the Sequence menu. Then select ´Add Current
Sequenceµ to add the current sequence file to the favorites. Pick a file from the menu to open it.
If you click the Favorites button or menu item directly, a window will pop up where you can organize your
sequence favorites. If you have many favorites, you can organize them in folders for easier reference later.
Add to Library
Adds the whole sequence definition as a single item to the PowerGREP Library. Any results that may appear
on the Sequence panel are not added to the library.
New Step
Adds a new step to the sequence. The settings on the Action panel are copied to the new step. The settings
on the File Selector are not copied to the step. Use the File Selector to Sequence menu item if you want to
copy the file selection also.
Delete Step
Removes the selected step from the sequence.
Move Step Up
Moves the selected step one position upwards in the sequence, so it will be executed sooner. Steps are always
executed from top to bottom, one after the other.
Move Step Down
Moves the selected step one position downwards in the sequence, so it will be executed later. Steps are always
executed from top to bottom, one after the other.
File Selector to Sequence
The File Selector to Sequence item in the Files submenu of the Sequence menu copies the file selection
you’ve made in the File Selector to the selected step in the sequence. The selected step will use that file
selection next time you execute the sequence.
27
151
Open File Selection
The Open File Selection item in the Files submenu of the Sequence menu loads a file selection from a
PowerGREP File Selection, Action, or Results file into the selected step in the sequence. The step will use
that file selection next time you execute the sequence.
Sequence to File Selector
The Sequence to File Selector item in the Files submenu of the Sequence menu copies the file selection from
the selected step in the sequence to the File Selector. If you have already executed the sequence, you will get
the file selection that this step actually used, even if you configured the step to use another step’s file
selection. If you have not yet executed the sequence, the Sequence to File Selector command is only available
for steps that have their own file selection.
Save File Selection
The Save File Selection item in the Files submenu of the Sequence menu saves the the file selection from the
selected step in the sequence into a PowerGREP File Selection file. If you have already executed the
sequence, this saves the file selection that this step actually used, even if you configured the step to use
another step’s file selection. If you have not yet executed the sequence, the Save File Selection command is
only available for steps that have their own file selection.
Action to Sequence
The Action to Sequence item in the Action submenu of the Sequence menu copies the settings on the Action
panel to the selected step in the sequence. The step will use that action next time you execute the sequence..
Open Action
The Open Action item in the Action submenu of the Sequence menu loads loads an action from a
PowerGREP Action or Results file into the selected step in the sequence. The step will use that action next
time you execute the sequence.
Sequence to Action
The Sequence to Action item in the Action submenu of the Sequence menu copies the action from the
selected step in the sequence to the Action panel.
29
152
Save Action
The Save Action item in the Action submenu of the Sequence menu saves the action from the selected step
in the sequence into a PowerGREP Action file.
Sequence to Results
The Sequence to Results item in the Results submenu of the Sequence menu copies the results from the
selected step in the sequence to the Results panel.
Save Results
The Save Results item in the Results submenu of the Sequence menu saves the file selection, results from the
selected step in the sequence into a PowerGREP Results file.
Clear Step Results
The Clear Step Results in the Results submenu of the Sequence menu removes the results for the selected
step from the Sequence panel. If a step produced a lot of results that you aren’t interested in, you can clear
them to reduce PowerGREP’s memory usage. It’s not necessary to manually clear the results before executing
the sequence again.
Clear Sequence Results
The Clear Sequence Results in the Results submenu of the Sequence menu removes the results for the entire
sequence from the Sequence panel. If a sequence produced a lot of results that you aren’t interested in, you
can clear them to reduce PowerGREP’s memory usage. It’s not necessary to manually clear the results before
executing the sequence again.
Preview
Click the Preview button on the Sequence toolbar, or press Alt+F9 on the keyboard, to execute the sequence
without creating or modifying any files. Previewing an sequence is always perfectly safe. It will never do
anything that you might regret later.
If later steps in the sequence work on files that are modified by earlier steps when executing rather than
previewing the sequence, then previewing the sequence does not show the same results. Because the preview
did not actually modify the files in the earlier steps, the later steps see the original files rather than the
modified files. PowerGREP does not have a feature to preview the effects of modifications made on the
same file by multiple steps without actually modifying the file.
15
153
Execute
The Execute item in the Sequence menu executes the sequence for real. If the target type of an action in the
sequence calls for files to be created or modified, executing the sequence will do so. PowerGREP will show
detailed search results on the Results panel.
Quick Execute
The Quick Execute item in the Sequence menu executes the sequence for real, without keeping individual
match results. The Results panel will only show how many matches were found in each file. Files will be
created or modified according to the target type of each action in the sequence.
Quick Execute is significantly faster than Execute or Preview, and will use far less of your computer’s
memory. That’s because it doesn’t have to keep track of each individual match to be able to show you all the
details on the Results panel. If you don’t plan to inspect the search results, Quick Execute is the way to go.
When preparing a new sequence that you plan to execute on a large number of files, or some very large files,
you should first preview the sequence on just a couple of the files. When you’re confident the sequence works
the way it should, expand the file selection to all the files, and use Quick Execute to execute it for real.
10
154
19. Library Reference
A PowerGREP Library is a convenient place to store PowerGREP file selections, actions, and sequences for
later reuse. You can open and save libraries on the Library panel in PowerGREP. In the default layout, you
can access the library panel by clicking on its tab just below the menu bar.
To add an file selection to the library, use the Add to Library item in the File Selection menu or File Selection
toolbar. To add an action to the library, use the Add to Library item in the Action menu or Action toolbar.
To add a sequence to the library, use the Add to Library item in the Sequence menu or Sequence toolbar.
You don’t need to save the file selection, action, or sequence before adding it to the library. A copy of the
entire file selection, action, or sequence definition is stored in the library file itself.
33
155
While the Save item in the Action menu saves a .pga file that includes both the file selection and the action
definition, the Add to Library item in the Action menu only adds the action definition itself. To store both
the file selection and the action in the library, use the Add to Library item in both the File Selection and the
Action menus.
When you open a library, you will see a list of one-line descriptions of all the items in the library. The icon
next to each item indicates whether it is a file selection, action, or sequence. Click on an item to make
PowerGREP show the complete description along with a summary of the item itself. This is the main
advantage of storing file selections, actions, and sequences in a library rather than saving them into separate
files. You can easily seek out the item you want to use by comparing the descriptions.
To reuse a file selection, action, or sequence from the library, click the Use button on the Library toolbar. If
you selected a file selection, it is copied to the File Selector panel. If you selected an action, it is copied to the
Action panel. If you selected a sequence, it is copied to the Sequence panel. All settings on the destination
panel are completely replaced with those of the item from the library.
If you use an item from the library, and then edit that item on the File Selection, Action, or Sequence panel,
the item stored in the library is not automatically updated. You can adapt items you used from the library to
the situation at hand without messing up your carefully collected library. If you do want to update the item in
the library, simply use the Add to Library menu item again. If you didn’t change the description on the Action
or Sequence panel, PowerGREP will ask you if you want to replace the action or sequence already in the
library. If you did change the description, the new action or sequence is added to the library alongside the old
action or sequence.
If you want to add an action from the library to the sequence you’re preparing on the Sequence panel, use the
Use Item in Sequence command in the Library menu. This appends the action to the sequence. You can also
combine multiple sequences. Load the first sequence into the Sequence panel. Then select the second
sequence in the library and use the Use Item in Sequence command in the Library menu. This appends the
sequence to the one on the Sequence panel instead of replacing it.
PowerGREP automatically and regularly saves library files. You only need to use the Save item in the Library
menu or the Save button on the Library toolbar when you want to save a copy of the library under a new
name, or when you want to give a new library a name.
Library files are automatically synchronized between multiple instances of PowerGREP. If you open the same
library in two or more instances, any modifications you make to the library in one instance will automatically
appear in all other instances. There is no risk of data loss when you edit a library in more than one
PowerGREP instance at the same time.
Documents you may be interested
Documents you may be interested