Check out the example WaitForPort (a command usually placed in Rexxc) in ARexxGuide:
http://aminet.net/search?query=arexxguide2
Further I would first check the path of your command AmigaAMP with "IF EXISTS(<filespec>)" where <filespec> is the full path to AmigaAMP and if not exist exit the script with error message. More or less on top of your script.
Code:
/**/
/* @{" SHOW() " link ARx_Func2.ag/SHOW()} can be used to check for the existence of a port */
if ~show('P', 'VLT') then do
address command /* both RUN and WAITFORPORT are DOS commands.*/
'run >nil: vlt:VLT'
/*
The loop below assures that the program will wait at least 50
seconds for the port to open, but will exit as soon as the port
is available.
*/
do 5 while ~show('P', 'VLT')
'waitforport VLT'
end
address /* @{" toggle " link ARx_Instr.ag/ADDRESS 23} back to previous address */
/* The return code RC is set to 5 when WaitForPort times out **
** before the port is available. */
if rc = 5 then do
say 'Unable to load VLT'
exit
end
end