|
Use Click Craft's Find and Fix Command to find icons in your Authorware application subject to criteria such as icon title, color, type, property or selection. You can also filter the search candidates according to the results of a custom script or evaluated expression.
Then fix each found icon by either setting one of its properties, pasting icons or applying a custom script to it and other icons in its vicinity.
Like Authorware's built-in batch property setting feature, this command can take the tedium out of repetitive maintenance operations. It also saves you from the effort of writing maintenance Commands from scratch yourself.
The Find and Fix Command is intended for use by all Authorwarians, but is especially useful for those who are familiar with Authorware's scripting features.
Once Find and Fix settings have been applied successfully and saved, they can be re-used later, even by other Authorwarians.
What's new in Version 2.45?
What's new in Version 2.30?
What's new in Version 2.10, 2.20?
With your developing application open, launch the Click Craft Find and Fix Command.
When the command is idle, it is non-modal. That means you can work on your application while the command is waiting in the wings.
Choose your Find settings. Then click the Find button.
Here are some special notes about each Find setting:
Selected icons:
If you have icons selected, only they will be found. Selected + children:
The children of selected icons will be found too. Responses only:
Only icons which are interaction responses will be found. Lib linked:
Finds icons that are linked instances of library icons. Remember that the other Find and Fix settings refer to the instance icon, not the library icon. If not selected, library instance icons are ignored in the search. By icon title:
This is a case-sensitive substring match. By icon color:
Choose one or more color to match. By icon type:
Choose one or more icon types to match. By icon property value:
Pick an icon property from the list. All icon properties for the most recent version of Authorware are shown. Then enter a value that you are searching for. The operator must be given starting in the first character position of the field. Normally it will be =, but it could also be <, <=, >, >=, <> or $. You can even make a compound phrase like <0&>10. The command constructs an expression using whatever you type in. If the property takes a string value, then make sure you enclose that value in "quotation" marks. Numeric, symbol and list values may be given as they are.
If the property takes a list value, you cannot search by giving it a literal list. This is because lists cannot be directly compared. Instead, write a Find script to extract the list property and compare each list item individually (see below).
The $ operator finds substring values in icon properties. Wildcard characters ? and * may be used in the substring (eg. $"he??o"). Note that the = operator is not used at all to specify substring finds.
You can also choose *ANY* property that satisfies property value expression.
By script/expression:
These are worth topic on their own... There are two things you can put in the By script/expression field: a script or an expression. In either case it gets evaluated for every icon in the Find operation (provided the icon hasn't already been filtered out by another criterion already). An icon is deemed to be found if the script or expression evaluates to a non-zero result.
You can script in Authorware's classic scripting language, or in Javascript. We'll start with the former:
If you want the script to reference the value of any function in the application, then you must use CallTarget("theFunction", ...). That's because your expression is really just an extension of the command itself. Similarly, if you want the value of a variable, then you need to use CallTarget("GetVariable", "theVariable",...) or CallTarget("GetInitialValue", "theVariable",...).
To make it easier to script, you can use the token %CT. For example, to get the filename of the application into your script expression (OK, not sure why you'd need to), then you can script
%CT("GetVariable", "FileName") The script or expression is applied to each icon, so you need a way to identify that icon in self referencing function calls. For this purpose, the token %Me is provided. For example, to test whether the icon is the child of a decision icon, you could use this expression:
%CT("IconType", %CT("IconParent", %Me)) = 5 For CallTarget("GetIconProperty", %Me,...), use the token %Get(...).
You can reference the current icon title in a Find script or expression with the %TitleMe token. It is equivalent to CallTarget( "IconTitle", %Me ). Similarly, the %TypeMe token refers to the icon type of the current icon, equivalent to CallTarget( "IconType", %Me ). Use IconTypeName( %TypeMe ) to get the name of that icon type. Hint: the icons shown in this Command for the icons are sequenced by icon type number!
The following variables are provided for use by the script: v0, v1, v2, ..., v9, i, j, k. If you try to use any other custom variables, the script will not be executable. Here is how you could script the above expression using a variable:
v0 := %CT("IconParent", %Me) if v0 then %Result := 0 else if %CT("IconType", v0) = 5 then %Result := 1 else %Result := 0 end if You could do it this way too:
v0 := %CT("IconParent", %Me) %Result := Test(v0, %CT("IconType", v0) = 5, 0) Here's how you can extract the Description property from each found icon:
v0 := %Get(#awIconDesc) Here are some other notes about scripts:
For longer Find scripts, select the maximise button and edit your script in a large text area. There is also a button to insert a continuation character ¬.
You can remove icons from the list. Select one icon entry and click the Skip button. It will disappear from the list.
If you manually delete found icons in your file, use the Refresh button to remove them from the list.
To locate an icon in your application, select its entry in the list and click the Locate button. You can also double-click on the list entry.
In the icon list responses are indicated with the character ®.
Choose your Fix settings. Then click the Fix button. The Fix operation will apply to all icons in the list, one by one.
Here is how you can fix the icons:
To set the property of an icon, turn the Set property checkbox on, select the property to change and enter the new property value. All icon properties for the most recent version of Authorware are listed, but not all are settable! If the property takes a string value, then make sure you enclose that value in "quotation" marks. Numeric, symbol and list values may be given as they are. Variables cannot be used in the property value field.
You can set the *FOUND* property, which is useful when the Find property was set to *ANY*. If the Find property value was a substring, then the Fix can be a substring replacement (you will be prompted).
By default, the Paste Model drop down list shows the models in the Model Palette folder (under Knowledge Objects). You can choose a different folder by selecting the Model Folder menu option.
Scripts may replace, append or prepend to any existing script for each found icon, or will just be copied in if no script yet exists. For non-calculation icons, the script is attached to the icon as an ornament.
A script copied into the application must only use custom variables that already exist and user functions that have already been loaded. Similarly, referenced icons must already exist. In other words, the script must be totally valid just as if you had typed it into the calculation editor.
On the other hand, the script can be a set of CallTarget instructions to change the listed icons in the application. Let's call this a Fix script, deserving of a topic on its own...
It's not much different from a Find script. It's implemented using CallScriptString(). Use CallTarget (or %CT) in the script to access parts of the application.
But now you can change each icon too. Use the %Me, %TitleMe or %TypeMe tokens to reference each listed icon ID, title or type in turn.
Anything you can script in a command you can script here. Remember that this script becomes an extension of the command itself. You can script to cut, copy, paste icons, insert icons, etc. If the script cannot complete for any reason, you will be notified.
The following variables are provided for use by the script: v0, v1, v2, ..., v9, i, j, k. If you try to use any other custom variables, the script will not be executable. These variables are initialised to zero only once when a Fix process begins, so you can accumulate values (like lists).
The %FoundIndex and %FoundCount tokens are provided so you can perform script logic at the start (eg. if %FoundIndex=1) or at the end (eg. if %FoundIndex=%FoundCount). The list of found icon IDs is always available to in the %IconList token.
If you set a non-zero value to the token %Result, it will be reported in a messagebox for each icon. This is a good way of stepping through your changes.
For longer Fix scripts, select the maximise button and edit your script in a large text area. There is also a button to insert a continuation character ¬.
Yes, you can set up your script to prompt for entries. Use the syntax
%Prompt(["prompt text", "initial value"]) The command implements this by replacing the %Prompt token with an internal script icon call to generate the prompt dialog. Be careful to include both the square and round brackets! Your script should expect to receive either an entered text string or one of these symbols:
In both of these cases, ensure that your script detects them and does not apply changes to the current icon.
Here is a Fix script to change the icon titles of found icons based on a prompted entry:
v0 := %CT("IconTitle", %Me)
v1 := %Prompt(["Enter icon title", v0 ]) if TypeOf(v1) = #string then %CT("SetIconTitle", %Me, v1) end if For Find or Fix scripts, set the Javascript checkbox if you wish to use Javascript. Aside from the obvious syntactic differences between the classic Authorware scripting language and Javascript, there are a few other issues to consider:
Yes, your settings are automatically saved each time you Find, Fix and Quit the command. You can also explicitly save your settings into any file. Use the File|Save As menu option.
You could develop a number of "standard" maintenance scripts which check and update your applications under development.
When you start the command, it always reloads the most recent settings.
A File|Clear All Settings menu options is provided to quickly clean the slate.
This is because the comma list separators are hard-coded into them. In Germany and other northern European countries, the default Regional Settings have the semi-colon as the list delimiter. You can set or reset your script's list separators by selecting the Localize menu option.
Yes, you can select a folder of Authorware files to work on in sequence. Select the File|Batch menu option. A dialog then prompts you for the folder that contains your Authorware files to edit. (Consider moving your files into a designated folder for this purpose). The first file will be automatically opened for you. Perform Find and Fix on the file as well as any other edits as required.
During Batch operation, a button showing your progress through the batch is shown, which when pressed advances you to the next file in sequence. It will automatically save the current file, then instigate a Find operation on the next file. You are left to perhaps alter the found list, perform the Fix and any other required edits.
Repeat until all the files in the batch folder have been fixed.
The Trial Version is limited to Finding three icons at a time. It also reminds you often that it is the Trial Version.
To upgrade it:
Please consider the ongoing effort and testing that goes into the Click Craft Find and Fix Command. If it saves you time and makes it easier for you to perform maintenance on your application, then it's worth the registration fee.
|