ToolBook Batcher Frequently Asked Questions

What really happens when you perform a search?

I paste an object after I have found a specific page, but the object is being pasted at the first page in the target book?

What exactly does the 'suspend execution on scripterrors' checkbox do?

Can I search for userproperties?

Can I add a userproperty to the found objects?

Can I search for values in arrays?

How do I delete an object during a search?

What about those setting files?

Which ToolBook versions are supported?

When I choose an object type, why does the property list change?

Can I search in all properties and objects in a book?

 

What really happens when you perform a search?

I paste an object after I have found a specific page, but the object is being pasted at the first page in the target book?

Make sure you have checked 'Go to the page containing CurObj' checkbox which you find when you choose 'Advanced options' under the 'Replace' tab.

 

What exactly does the 'suspend execution on scripterrors' checkbox do?

If it is not checked, the script to be executed will be inserted in a function (ufDkmdTempBatchFunction). The function is inserted in the target books bookscript. This function is removed when the search is done.

That means that you will be able to debug the script if a error occurs during the search. You will also be able to view the values of variables etc.

Can I search for userproperties?

Yes, on the search screen in the 'Properties' combo box, you choose 'other', and enter the userproperty you wish to search for.

Can I add a userproperty to the found objects?

Yes, in the replace screen you choose to replace a property value. In the combobox you choose 'other' and enter the name in the corresponding field. In the value field you enter the value for the new property.

Can I search for values in arrays?

You cannot search directly for values in arrays. You can search for properties that hold an array. When the batcher finds an array the value is set to '[Array]', so if you wish to find an array you should enter '[array]' in the value field.

But by making a script, you can search for values in arrays:

Search criteria:

Find all multiple choice objects.

Code:

-- Find all objects that has an answer set to false

-- and add them to the svbatchoutput variable

local tempArr[][]

if "asym_wid_ansarray" is in userproperties of curObj

tempArr = asym_wid_ansarray of curobj

dim1 = item 1 of dimensions(tempArr)

step i from 1 to dim1

if tempArr[i][10] = true
                  svBatchOutput = svBatchOutPut & crlf & curObj & tab & tempArr[i][10]
      end if

end step

end if

You can see the content of the 'svBatchOutPut' variable on the ' svBatchOutPut' on results page.

You can use the same approach to change values in arrays:

Search criteria:

Find all multiple choice objects.

Code:

-- Find all objects that has an answer set to false

-- and change the value to true

local tempArr[][]

if "asym_wid_ansarray" is in userproperties of curObj

tempArr = asym_wid_ansarray of curobj

dim1 = item 1 of dimensions(tempArr)

step i from 1 to dim1

if tempArr[i][10] = true
            svBatchOutput = svBatchOutPut & crlf & curObj & tab & tempArr[i][10]

               tempArr[i][10] = false
         end if

end step

asym_wid_ansarray of curobj = tempArr

end if

How do I delete an object during a search?

In the replace screen you choose to execute a 'script/command'.


Then you can use the 'deleteobject' function to delete the object.

If you want to delete the current found object, you write:

Get deleteObject(curObj) -- as curObj hold a reference to the most recent found object.

What about those setting files?

The setting files store the search information, defined under the 'Find/replace' tab.

The files are saved in the settings directory, which you will find in the same directory as the batcher.

A 'batch.ini' file is also stored in that directory. This file is updated every time you start a search, or exit the Batcher application. It stores the same information as the setting files, plus a reference to the current work directory.

Both the .ini file and the setting files (.bss) use the .ini file format.

Which ToolBook versions are supported?

Version 7.2 and later.

When I choose an object type, why does the property list change?

When you choose a standard object, you only see the properties that you are able to get from that object and likewise in the replace screen. You will only see the properties that you are able to set.

Off course you can override by choosing 'other' and enter a custom property in the field.

Can I search in all properties and objects in a book?

Yes, you choose to search 'All' objects, and 'All' properties.