how to make dialog box interacting with bat

December 19, 2010 at 12:06:11
Specs: Windows Vista Home Premium-32bit / Windows 7 Ultimate 32bit, CPU=intel-core2duo_2.1GHz/RAM=3GB
Hallow every one,

I have a question.

Is there any easy programing language or software to make a dialog box (GUI Window) which I can run from a bat file and receive one or more inputs (which I want users to provide) passed to that bat file?

I mean, for a batch programing usually we use (set /p <variable>="<User prompt text string>") syntax format to prompt a user to provide a input value what required, but I want to give a prompt to users through a dialog box (GUI Window) and receive the input value (wich a user have inputted) directly or indirectly (if not possible directly) passed to the corespondent running batch program.

Is that possible? if it is possible then i want to know in detailed about how to do it.


Can any one help me,

Please help me.


See More: how to make dialog box interacting with bat

Report •


#1
December 19, 2010 at 14:31:57
vis.basic or vbscript are probably what you're wanting. here's a vis basic program
i wrote to put the clipboard contents into a text file. The "dialogue" is simply the
path/filename where the user wants the clipboard content to go. (It eliminates having
to use "notepad", which i hate, and doing a filesave.)

Attribute VB_Name = "clip"

Sub main()
'write clipboard into a file
X = Clipboard.GetText
c = InputBox("CLIPBOARD CONTENT: " + Chr(10) + X + Chr(10) + "file, [line#]: ")
if ltrim(c)="" then end
p = InStr(c, " ")
If p > 0 Then
Line = Mid(c, p + 1)
c = Left(c, p - 1)
Open "c:\windows\tempor~1\temp" For Output As #3
Open c For Input As #1
For i = 1 To Line
If EOF(1) Then Exit For
Line Input #1, k
Print #3, k
Next i
Print #3, X
Do While Not EOF(1)
Line Input #1, k
Print #3, k
Loop
Close
Shell ("move /y c:\windows\tempor~1\temp " + c), 2
Else
On Error GoTo 10
Open c For Append As #1
GoTo 20
10 Resume 11
11 Open c For Output As #1
20 On Error GoTo 0
Print #1, X
Close #1
End If
End Sub
'-----------------------
vbscript uses the same command, "inputbox", so you don't have to aquire or
posess a vis.basic platform to use the function, but has the slight disadvantage
that it is not compiled so your batch file has to go like:
cscript .\getdata.vbs
and the "getdata" will probably have to write the data through an intermediate squibfile i believe (i've gotten real rusty from not using vbscript for awhile).


Report •

#2
December 20, 2010 at 06:49:23
Google: Wizapp.exe

Happy is ONE who says I am an OttoMAN.


Report •

#3
December 20, 2010 at 14:02:07
Thank u nbrane for your reply,

and good coding,


I would like to know that, whatever type of GUI it opens is the input of a user on that GUI can be passed to the "bat app." which have executed the "VBScript file" to run the GUI and still running and waiting for a input value which is gonna come from the GUI executed by the "VBScript file" through the "bat app." with "CScript syntax" so that the "bat app." can move forward ??

I have saved your code on my desktop with a name getdata.vbs (as suggested) and tried to run it from a bat file which is also on my desktop named as dataget.bat but it is showing the following error msg. on the cmd window which was executed by the dataget.bat to run the getdata.vbs to execute the GUI you have mentioned in your reply for my post.


C:\Users\INDRAJIT\Desktop\getdata.vbs(7, 21) Microsoft VBScript compilation error: Expected statement

Again, Thank u for your reply nbrane


Report •

Related Solutions

#4
December 20, 2010 at 16:32:24
THANK YOU VARY MUCH MUs for your reply,

It is the exact type of thing I was wanting but the Wizard's Apprentice software is made only for Windows 95 / 98 / Me / NT / 2000 / Xp and i am using vista and 7 (dual boot) is there any thing like it for vista and 7 ?


My apologies:- SORRY, I was just missed out your reply and is not replying you as soon as possible. SORRY for delayed replying MUs.


Again, MUs, thank you vary much for your reply.


Report •

#5
December 20, 2010 at 20:53:19
Sorry, for the mis-confusion, Lol! The program i gave was visual basic, not vbscript.
Two different platforms...
To do what you want, here is the vbscript "bare bones" version, vbscript first:
'---- begin, getdata.vbs
set outp=wscript.stdout
c=inputbox("what? ")
outp.write(c)
'----------- end
and here's the batch that will invoke it:
::begin batch script dataget.bat
@echo off & setlocal
for /f "tokens=*" %%a in ('cscript getdata.vbs') do set x=%%a
echo the returned value from the gui-box is: %x%
::---- end script

This should work. It is the "absolute zero" of a working demo.
Of course, make sure all the paths (to programs and scripts) are straight!


Report •

#6
December 21, 2010 at 00:50:17
"is there any thing like it for vista and 7 ?" Dont think so, maybe a google search will help.

"My apologies:- SORRY, I was just missed out your reply and is not replying you as soon as possible. SORRY for delayed replying MUs."

Hey, no problem at all :)

Regards,

Happy is ONE who says I am an OttoMAN.


Report •

#7
December 21, 2010 at 10:11:15
Thank you vary much nbrane, for your reply...

nbrane,

I don't know VB and VBScript, i thought your replayed code is in VBScript.. and sorry for that.


So, your code was in VB


As i don't know VB and VBSctipt for that region can you post the exact code what i have to have in the getdata.vbs file?

and for the region that i am not also familiar with the CScript command of batch, can you confirm that the cscript getdata.vbs in the for /f command is gonna enough to run the getdata.vbs?

(I will include the proper directory of getdata.bat file in the cscript getdata.vbs in the for /f command as your suggestion)

Again, Thank you vary much nbrane, for your reply...


Thanks MUs, for your reply.......

MUs,
"Dont think so, maybe a google search will help."

I did a search on the web and found nothing so useful but there is some softwares called "X Window System, version 11" , CygWin/x and XMing can you give me some more detail about these softwares that can i direct the output of those softwares to my bat program?


Again, Thanks MUs, for your reply.......


Report •

#8
December 21, 2010 at 10:34:55
As i don't know VB and VBSctipt for that region can you post the exact code what i have to have in the getdata.vbs file?

Black_Blood,

As nbrane posted, What should go in your VBS file is:

set outp=wscript.stdout
c=inputbox("what? ")
outp.write(c)

You will be able to call the to VBScript using this command in a batch file:

for /f "tokens=*" %%a in ('cscript getdata.vbs') do set x=%%a

Can I put a question here?


Report •

#9
December 22, 2010 at 16:04:31
Thanks Matt123, for your reply,

it works.

but i am wanting a much more controllable and customizable way to do such.

can you please help me about it??


SORY for delayed reply...



Report •

Ask Question