What really happens when you perform a search?
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?
Make sure you have checked 'Go to the page containing CurObj' checkbox which you find when you choose 'Advanced options' under the 'Replace' tab.
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.
Yes, on the search screen in the 'Properties' combo box, you choose 'other', and enter the userproperty you wish to search for.
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.
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
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.
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.
Version 7.2 and later.
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.
Yes, you choose to search 'All' objects, and 'All' properties.