Commands & Syntax > Commands > User Interaction >

Menu ADD ITEM - < menu_additem >() ... [Pro]

www.perfectkeyboard.com

 

Menu ADD ITEM
<menu_additem>("Item name","Item identifier","Icon file",Icon index)
Available in: Professional edition

This command adds a new item to menu shown on the screen using "menu_show" command.

 

#

Parameter name

Parameter description

1

Item name

Name of the item as it shows in the menu. To add submenu items insert '.' (dot) to begin of the item name. To specify end of the submenu, insert just '.' Item. To underline a specific character within the item, insert '&' character right before it.

2

Item identifier

This is an optional parameter. If it is supplied, the "menu_show" command returns item identifier rather than item name.

3

Icon file

File containing an icon (.exe, .dll, .ico).

4

Icon index

Position of the icon in the file.

 

Example (Macro Steps):

 

1

<#> <#> This macro will show how to use 'menu_additem'

2

<#> <#> and 'menu_show' commands

3

Macro execution: ONLY COMMANDS

4

Menu ADD ITEM "Item 1", Item identifier=""

5

Menu ADD ITEM "Item 2", Item identifier=""

6

Menu ADD ITEM "Item 3", Item identifier=""

7

Menu ADD ITEM ".Item 1 - 1", Item identifier=""

8

Menu ADD ITEM ".Item 1 - 2", Item identifier=""

9

Menu ADD ITEM ".Item 1 - 3", Item identifier=""

10

Menu ADD ITEM ".Item 1 - 4", Item identifier=""

11

Menu ADD ITEM ".", Item identifier=""

12

Menu SHOW [ x = -1, y = -1 ], Variable to keep selected item = vItem, Get item = Identifier, Add item numbers (1-9, A-Z) = Yes

13

IF STRING vItem != NO

14

Message SHOW "" : "Selected item is: %vItem%" (other parameters: x = -100, y = -100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

15

ENDIF

Example (Plain Text):

 

<#> This macro will show how to use 'menu_additem'

<#> and 'menu_show' commands

<cmds>

<menu_additem>("Item 1","","shell32.dll",3)

<menu_additem>("Item 2","","shell32.dll",4)

<menu_additem>("Item 3","","shell32.dll",5)

<menu_additem>(".Item 1 - 1","","shell32.dll",6)

<menu_additem>(".Item 1 - 2","","shell32.dll",7)

<menu_additem>(".Item 1 - 3","","shell32.dll",8)

<menu_additem>(".Item 1 - 4","","shell32.dll",9)

<menu_additem>(".")

<menu_show>(-1,-1,vItem,1,1)

<if_str>("vItem != NO")

   <msg>(-100,-100,"Selected item is: %vItem%","Message",1)

<endif>