Code: Select all
set "mFinURL=%mURL1%%%G%mURL2%%%G%mURL3%"
for /f "delims=" %%G in (id.txt) do (
wget --http-user=%IMSUSER% --http-password=%IMSPASS% --tries=10 -O - >> C:\Users\MatthewM.MEDICAGROUP\Desktop\UnreportorAssignBatch\%ims% %mFinURL%
)
CLS
set "mFinSPS=%mURL1%%%b%mURL2%%%b%mURL4%%%b%mURL5%%%c"
rem This opens the IMS and logs in
::start OpenIMS.exe
ping localhost -n 10 > nul
rem This reads the accession numbers in acc.txt searches ims.txt and outputs the id to variable %%a and spsid to variable %%c
for /f "delims=" %%a in ('type "acc.txt"') do (
for %%z in ('sed -n "s/.*&sps_id=[0-9][0-9][0-9][0-9][0-9][0-9][0-9]');.><td>%%a.*<td>\(.*\)<\/td>.*<\/td>.*/\1/p" "ims.txt"') do (
for /f "tokens=1,2" %%b in ('sed -n "s/.*=\(.*\)&sps_id=\([0-9][0-9][0-9][0-9][0-9][0-9][0-9]\)');.><td>%%a.*/\1 \2/p" "ims.txt"') do (
echo the reference "%%a" returns ID="%%b" and number "%%c"
if "%%z"=="Unreported" echo and Unreported was found
start chrome.exe %mFinSPS%
ping localhost -n 6 > nul
rem This runs a AHK script which unreports the exams on the IMS
if not "%%z"=="Unreported" start ChangeToKT.exe
ping localhost -n 6 > nul
)
)
)