topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday June 1, 2020, 6:26 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: create an active and open text file from entered variables while running batch  (Read 1223 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 562
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
I am trying to do something that i can't seem to manage.  During the running if a long script there are several steps where various data is either input or created.  At the end of the script, it is easy to write up a Job-Run Sheet that shows all the parts and pieces and where they got used and how.
I would like to be able to create the Job-Run sheet so that it is filled in while the loader is being run.  The first data entered is the job number and I use that to create a text file named "entered number.txt".  An d i was able to echo the first bit of data into it as line 1
But when i open the file so it can stay open as edited i cannot get the script to continue 
This is a setup for User to create a setup log and it would he helpful if they had that information displayed as it was entered instead of after the fact.  I have been able to create the Job-run <#> text file as well as write the first line but as soon as i open the file for viewing I am unable to return to the original batch script to continue.
This does not have to be a text file at that point as long as the User can see an easy to read listing of what they did so far.
Below is the code where the problem starts. 

set /p snum="Enter Job Number: "
>%snum%.txt echo Job Number is %snum%
call notepad %snum%.txt

>>PS:  I also tried cmd /c with same results
As soon as I call notepad to open the file so it can be read, the script stops.  I want it to stay in view so each step that echos more data to it will display the data in the same way
« Last Edit: January 04, 2020, 04:47 PM by questorfla »

highend01

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 175
    • View Profile
    • Donate to Member
set /p snum="Enter Job Number: "
>%snum%.txt echo Job Number is %snum%
start "" notepad %snum%.txt
>>%snum%.txt echo Next line
>>%snum%.txt echo Last line


questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 562
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Thanks, highend .   That did better than I was doing.  I think I am ready to admit that I need a complete form template of some kind.  There are quite a few of these input fields, some need to have character count limits, some need to be set for numbers only.  We have used this specific setup script for some time and it works so well I hate to give it up.  But it is hard to explain how it works for new hires.
There are hundreds of 'forms programs' out there including MS Access and even Excel.  There are probably only 10 variables that have to be input and then another 4 or 5 that are created within the script.  It would be nice if I could get all this to display on the screen at the same time just like a filled-in form.
This would let me catch any errors before the project gets created with erroneous input.  Clicking the "GO" button at the bottom would accept the data fields and continue the creation and the displayed form could be saved as a filled-in template.  It might come in handy to be able to open that same form at a later date to see what was done.   
In addition, since these things are created sequentially, opening the last form would automatically fill in the same data fields and I could just change the ones that needed it.  A couple of us who use this in the IT department have played around with different options but since the script was written in a batch script the only thing I can think of for making a nice front end form would be to use HTA to make it.  Or maybe VBS.  Powershell is a pain since Windows restricts it by default
I figured there might even be something already on the Board from long ago but maybe I am searching with the wrong terms

highend01

  • Supporting Member
  • Joined in 2011
  • **
  • Posts: 175
    • View Profile
    • Donate to Member
Use AHK and create a simple GUI for what you need...