/* Event Clicked/selected - DONE  1006 */
Arg window self




/* set the mame program file */
oldmameprog=mameprog
mameprog=vpgetitemvalue(window,1002)




rc=stream(mameprog,'C','QUERY EXISTS')

IF length(rc) > 0 THEN
  DO

    savesettings=1

    /* set the mame dir */
    /* drive=filespec('drive',mameprog)
    path=filespec('path',mameprog) */

    mamedrive=filespec('drive',mameprog)
    mamepath=filespec('path',mameprog)
    mamedir=mamedrive||mamepath
    romdir=mamedir||'roms\'

    /* mamedir=drive||path
    romdir=mamedir||'roms\' */
    romfile=romdir||'*.zip'

    /* set the alt rom dir */
    altromdir=vpgetitemvalue(window,1004)
    altromfile=altromdir||'*.zip'

    /* set the external command */
    /* Get item value 1008 Entry Field */
    extcmd = VpGetItemValue(window,1008)

    /* if length(iniloc) > 0 then
      do
        CALL LINEOUT iniloc,mameprog,1
        CALL LINEOUT iniloc,altromdir
        CALL LINEOUT iniloc,extcmd
        rc=stream(iniloc,'C','CLOSE')
      end  */

    CALL VpNotify window,'message'

    CALL VpWindow window,"CLOSE"

  END
ELSE
  DO
  if rc then
  else

    response=VpMessageBox(window,'MAMERun - ERROR','You have entered an invalid path for MAME!')
    mameprog=oldmameprog
    /* Set item value 1002 Entry Field */
    CALL VpSetItemValue window,1002,oldmameprog
  END
