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


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

/* set the alt rom dir */
altromdir=vpgetitemvalue(window,1004)



rc=stream(mameprog,'C','QUERY EXISTS')
if length(altromdir) > 0 then
  rc2=stream(altromdir,'C','QUERY EXISTS')
else
  rc2='none'



if length(rc) > 0 and ((rc2='none') or (length(rc2) > 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'

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
  response=VpMessageBox(window,'MAMERun - ERROR','You have entered an invalid path')
