Computing.Net > Forums > Programming > Variable from a list file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Variable from a list file

Reply to Message Icon

Name: einstein8
Date: October 2, 2008 at 09:43:40 Pacific
OS: XP
CPU/Ram: 1.8Ghz/2Gb
Product: Dell
Comment:

this is the third time that i will be posting this msg.. i dont know but for some reason my post gets deleted!

i have a 100% working script below.. however, i want the isoissue to pick up from a list of variables from a separate list.txt file.. needless to say, this script should pick up the list one-by-one, run and loop the script until all the variables for isoissue has been processed..
list.txt would have something like this:
rr04cxpl109123
rr04cxpl109456
rr04cxpl109784
rr04cxpl109956
rr04cxpl109978
rr04cxpl109907


@echo off
title AUTOMATED ISO COPY

:: Type/Scan barcode and check AFC_area
Set "isoissue=rr04cxpl109902"
Set "AFC_area=RR04_ULD2"

:: Type transmittal number and AFC folder and date
Set "transmittal_no=RR04_A2ZC_SO04-005"
Set "AFC_date=Week 4 (10052008)"

:SAVE THE FILE AND RUN THE SHORTCUT ON YOUR DESKTOP:::::::::::::::::::::::::::::::::::::

Set "sourceDir=\\server1\isometrics"
Set "TOPOLFolder=\\server2\ca_a2zc\250_Pipe\250H - Deliverables\Isometrics Issued\TO_POL"
Set "HOAFCFolder=\\server3\ho_a2zc\250_Pipe\Calgary Iso's\AFC"
Set "HOMATFolder=\\server3\ho_a2zc\250_Pipe\Calgary Iso's\Material Electronic Files"
Set "CAAFCFolder=\\server2\ca_a2zc\250_Pipe\250H - Deliverables\Isometrics Issued"
Set "_report=\\server1\isometrics\logxcopy.txt"


IF NOT EXIST "%sourceDir%" (echo.Could not find %sourceDir% &GoTo:done)

:: append previous log
>>"%_report%" (
echo.%date% - %time%
---
echo.
)

:: copy files for POL Transfer
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%.i*" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%TOPOLFolder%\%AFC_date%\%transmittal_no%\" /i /y /h /f /c >>"%_report%",2>&1)
)

:: copy transmittal for POL Transfer
For /F "Delims=" %%! in ('Dir "%sourceDir%\%transmittal_no%.pdf" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%TOPOLFolder%\%AFC_date%\%transmittal_no%\" /i /y /h /f /c >>"%_report%",2>&1)
)

:: copy transmittal to HO AFC
For /F "Delims=" %%! in ('Dir "%sourceDir%\%transmittal_no%.pdf" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%HOAFCFolder%\%AFC_area%\%AFC_date%\" /i /y /h /f /c >>"%_report%",2>&1)
)

:: copy files to HO AFC
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%.i*" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%HOAFCFolder%\%AFC_area%\%AFC_date%\" /i /y /h /f /c >>"%_report%",2>&1)
)

:: copy files to MAT AFC
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%*.*" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%HOMATFolder%\%AFC_area%\%AFC_date%\" /i /y /h /f /c >>"%_report%",2>&1)
)

:: copy files to CA AFC for Backup
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%*.*" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%CAAFCFolder%\%transmittal_no%\" /i /y /h /f /c >>"%_report%",2>&1)
)

:: copy Transmittal to CA AFC for Backup
For /F "Delims=" %%! in ('Dir "%sourceDir%\%transmittal_no%.pdf" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%CAAFCFolder%\%transmittal_no%\" /i /y /h /f /c >>"%_report%",2>&1)
)

:done
title,Done.......

echo.&pause>nul

hopeless but trying



Sponsored Link
Ads by Google

Response Number 1
Name: einstein8
Date: October 3, 2008 at 13:17:42 Pacific
Reply:

anyone? any help on the matter is highly appreciated.. - Marie

hopeless but trying


0

Response Number 2
Name: Judago
Date: October 3, 2008 at 14:42:04 Pacific
Reply:

To be honest I haven't pored over your script thoroughly enough to understand it all but I think I know what you need to change.

This:


title AUTOMATED ISO COPY

:: Type/Scan barcode and check AFC_area
Set "isoissue=rr04cxpl109902"

To this:


title AUTOMATED ISO COPY
for /f %%g in (yourtextfile.txt) do call :body %%G
goto :eof

:body
:: Type/Scan barcode and check AFC_area
Set "isoissue=%1"

And this:


:done
title,Done.......

echo.&pause>nul

To this:


:done
title,Done.......

echo.&pause>nul
goto :eof



0

Response Number 3
Name: einstein8
Date: October 4, 2008 at 22:08:48 Pacific
Reply:

Thanks Judago for trying to help. I tried editing the script and adding as you have advised. While it doesnt seem to give any error, it doesnt seem to go through the list either. Do I need to put anything special on my list.txt? Regards - M

hopeless but trying


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Variable from a list file

Variable from A List File Part 2 www.computing.net/answers/programming/variable-from-a-list-file-part-2/17073.html

%var% from a txt file vbs www.computing.net/answers/programming/var-from-a-txt-file-vbs-/14365.html

Setting variables from a txt file www.computing.net/answers/programming/setting-variables-from-a-txt-file/15639.html