WinBatch Technical Support Forum

Archived Boards => WinBatch Script Exchange => Topic started by: winuser2003 on December 16, 2013, 09:34:23 am

Title: Drop Down List Box
Post by: winuser2003 on December 16, 2013, 09:34:23 am

Thank you for taking the time to read my issue, and I hope I am posting in the correct area. I have a drop down list that displays a few items, and the line is as follows

Code: [Select]
ATGFILELIST= STRCAT("SmartSupplyATGWeeklyReport_2013_12_15.xls",@TAB,"SmartSupplyATGWeeklyReport_2013_12_22.xls",@TAB,"SmartSupplyATGWeeklyReport_2013_12_29.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_01_05.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_01_12.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_01_19.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_01_26.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_02_02.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_02_09.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_02_16.xls",@TAB,"SmartSupplyATGWeeklyReport_2014_02_23.xls")

Now the items in the above line change from time to time. I would like to see if its possible to setup a variable where it just reads from maybe a txt file, but still lists the same items. Editing the script itself can be a lot of hassel, whereas if I use something as simple as a notepad the process is a little easier. I believe there is a way to do this, but cannot remember. I set a variable called "ATGFILELIST and its just calling the drop down menu data direct from the script. I would rather the source of this data be in a txt file if  possible. Thank you for your time.
Title: Re: Drop Down List Box
Post by: JTaylor on December 16, 2013, 09:56:37 am
Sure.   You will probably find FileGet() and StrReplace() useful functions.

Title: Re: Drop Down List Box
Post by: Deana on December 16, 2013, 09:57:34 am
Create a separate txt file that has each file name on its own line and place in the same directory as your script. Then in your script you can read the data and replace the carriage return line feeds with tabs, like this:

Code: Winbatch
filedata = FileGet( DirSCript(): 'xlsfiles.txt')
ATGFILELIST = StrReplace( filedata, @CRLF, @TAB )
Title: Re: Drop Down List Box
Post by: winuser2003 on December 16, 2013, 07:10:03 pm
As usual thats the perfect kind of assistance :) thank you. I apologize if I posted this in the wrong section however.