Example of using TASKDIALOG Custom Buttons for menu item selection

1527114609331.png


Code:
@setlocal
@echo off
set title="Custom Button Dialog Box"
set instruction="Here's What To Do:"
set text=Check one of the following buttons:
set ac="Open"
set ad="Click on a button to select it"
set ae="Close"
set b1="IP address(es) of local computer."
set b2="Index of the current adapter"
set b3="Number of adapters in the system"
set b4="Display the IP Address for each adapter"
set b5="Exit"

set CustomButtons=/B%b1 /B%b2 /B%b3 /B%b4 /B%b5

taskdialog /A%ad /AC%ac /AE%ae %CustomButtons /I /L %title %instruction %text

switch %_taskdialog_button
case 1000
  echo You pressed the %b1 button
  echo The IP address(es) of local computer are %_ip
case 1001
  echo You pressed the %b2 button
  echo The index of the current adapter is %_ipadapter
case 1002
  echo You pressed the %b3 button
  echo There are %_ipadapters adapters in the system
case 1003
  echo You pressed the %b4 button
  echo Adapter # IP Address
  do kount=0 to %@dec[%_ipadapters]
    echo %@formatn[9.0,%kount] %@ipaddressn[%kount]
  enddo
case 1004
  echo You pressed the %b5 button
endswitch
endlocal

Joe
 

Similar threads