7
2. Recording a Macro

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

Embed Size (px)

Citation preview

Page 1: 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

2. Recording a Macro

Page 2: 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

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

Page 3: 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

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’

Page 4: 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

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

Page 5: 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

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

Page 6: 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

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

Page 7: 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

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.