Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Scripting prompt input

Reply
 
Old 08-05-2008   #1 (permalink)
Please....


 
 

Scripting prompt input

I need help scripting a code that will do the following, (I'm very bad at
this so if you can make it dummy proof it would be great...ie tell me where
to fill things in)

I have a program called cgwave.exe and it opens up in a DOS window. When
the program opens, it asks me for the name of the input file. I put in the
name and hit enter then the program runs. I need to run this process in a
loop "x" number of times for "x" number of input files. My only variable is
the name of the input file.

I was told to use WASP and I'm not getting far in that. This is what I have
so far using WASP;

$window = Select-Window cgwave
$file = "Final_test_monocramatic_03s_0721.cgi{Enter}"
Send-Keys $window $file

The problem with it thus far is that it doesn't write anything into the
command prompt. If I replace "cgwave" with "notepad" it works fine so I
don't think WASP is going to work for me.

Can I do this in a batch file easier?? Thank you for your help and remember,
I'm not to bright at this stuff so detailed explaination would help.



My System SpecsSystem Spec
Old 08-06-2008   #2 (permalink)
Shay Levy [MVP]


 
 

Re: Scripting prompt input



If cgwave.exe accepts input then you can do it. For instance:

1. Create a Test directory on your C drive
2. Inside the Test create a test file.
3. Create an input file that stores the input you would like to auto enter

In the example below I created c:\input.txt and typed inside this lines:
Y [PRESS ENTER]


Now you can delete the none empty directory like so:

C:\>rd c:\test /S < input.txt
c:\test, Are you sure (Y/N)? Y

# folder deleted





---
Shay Levy
Windows PowerShell
http://blogs.microsoft.co.il/blogs/ScriptFanatic

P> I need help scripting a code that will do the following, (I'm very
P> bad at this so if you can make it dummy proof it would be great...ie
P> tell me where to fill things in)
P>
P> I have a program called cgwave.exe and it opens up in a DOS window.
P> When the program opens, it asks me for the name of the input file. I
P> put in the name and hit enter then the program runs. I need to run
P> this process in a loop "x" number of times for "x" number of input
P> files. My only variable is the name of the input file.
P>
P> I was told to use WASP and I'm not getting far in that. This is what
P> I have so far using WASP;
P>
P> $window = Select-Window cgwave
P> $file = "Final_test_monocramatic_03s_0721.cgi{Enter}"
P> Send-Keys $window $file
P> The problem with it thus far is that it doesn't write anything into
P> the command prompt. If I replace "cgwave" with "notepad" it works
P> fine so I don't think WASP is going to work for me.
P>
P> Can I do this in a batch file easier?? Thank you for your help and
P> remember, I'm not to bright at this stuff so detailed explaination
P> would help.
P>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Prompt for input if import-csv not used? PowerShell
VB scripting help VB Script
UAC and scripting Vista General
Chinese Traditional Input using Phonetic Input Vista General
Scripting bug? PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46