Upload
julianna-marsh
View
224
Download
1
Embed Size (px)
Citation preview
2. Recording a Macro
Macro Recording
Select Record Macro from the Macro file menu and the dialog box opposite will appear
Your macro will require a name not previously used within that script
You can assign a shortcut key to launch the macro
Macro Recording
As soon as you have selected OK on the previous dialog box, you are recording
Everything you do will be recorded as a line of code
At the bottom right of your screen is Stop Macro Command Dialog.
When you have completed your macro select ‘Stop Recording’
Example
1. Open the image Spots.tif from the example images
2. Select to record a macro called Count
3. Select the count/size dialog box from the Measure file menu
4. Set a threshold
5. Count
6. Select to view the measurement data
7. Stop Recording
Example
Sub Count()
ret = IpBlbShow(1)
ret = IpBlbSetAttr(BLOB_AUTORANGE, 1)
ret = IpBlbSetAttr(BLOB_BRIGHTOBJ, 0)
ret = IpBlbCount()
ret = IpBlbUpdate(0)
ret = IpBlbShowData(1)
End Sub
Macro Recording
Your macro is now complete and will exist as an item in the Macro file menu
It will also appear as an item in the Macro dialog box – see opposite
It can be executed by selecting at either of these points or by any shortcut key assigned
Assigning a button to your macroFrom the Edit file menu select Preferences
From the Preferences dialog box select the Toolbar Tab
Select Add and you will be prompted to browse to your script file and from that select the macro
Then select Apply and the number 1 will appear as the last item on your tool bar.