begin
select wait 100 abort

runback P61Con

;;TODO: Deal with UseCode extraction (maybe a command line to peek text on screen or a winuae memdump that searches
;;			 for the string USECODE:)

WAIT          30
SELECT WINDOW "The Player 6.1A"

GADGETUP      "Convert Protracker module(s)" 0,1,124,107 
SELECT WINDOW "Select Module(s) to Convert:"
WAIT          30
GADGET "" 12,9999,15,127 "dh0:t/p61cache"
GADGET "" 11,9999,15,142 $arg[1]

SELECT WINDOW "Select Filename For Saving:"
WAIT          30
GADGET "" 12,9999,15,136 "dh0:t/p61cache"
GADGET "" 11,9999,15,151 $arg[2]
;;how to wait for a button with the tesxt "Continue..."

WaitForCompletion:
WAIT 100
;;Window width 366 is the continue window's width
IF #win.width <> 366
GOTO WaitForCompletion

GETGADGET "" 1,9999,127,76
con echo $result text


format "dh0:t/p61cache/usecode.%s" $arg[2]
execute "UseCodeFinder.exe" $result
format "dh0:t/done.%s" $arg[2]
execute "makedir" $result
WAIT 20
execute dh0:tools/uae-configuration SPC_QUIT 1
END




