![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Batch file (CMD) output into HTA Hi All, I am wondering if it is possible to have output from a batch file back into a HTA file. What i want to do is use the nice features of HTA to put a nice clean GUI on my batch files. So that instead of having the ugly command text etc, i can have the output back into the HTA and then put some clean type faces etc around it. Is it possible? If so can someone provide and example of HTA code to do it? Any advice or help would be appreciated. Cheers, Daz |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Batch file (CMD) output into HTA Quote: > What i want to do is use the nice features of HTA to put a nice clean > GUI on my batch files. So that instead of having the ugly command > text etc, i can have the output back into the HTA and then put some > clean type faces etc around it. > first place -- to go beyond the simple DOS command line in order to provide more options and GUI possibilities. So if you want an HTA then why not use the tool that goes with it? If you want to use DOS/batch ....aren't there groups for that? I just did a search of MS newsgroups and only came up with this: microsoft.public.win2000.cmdprompt.admin I'm not sure what to search for other than "cmd". There are no groups with "batch" in the name, and not much in the way of groups with "dos" in the name. In any case, this is a VBScript group. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Batch file (CMD) output into HTA mayayana wrote: Quote: Quote: >> What i want to do is use the nice features of HTA to put a nice clean >> GUI on my batch files. So that instead of having the ugly command >> text etc, i can have the output back into the HTA and then put some >> clean type faces etc around it. >> > That was really the whole point of script in the > first place -- to go beyond the simple DOS command > line in order to provide more options and GUI > possibilities. So if you want an HTA then why not use > the tool that goes with it? If you want to use DOS/batch > ...aren't there groups for that? I just did a search of > MS newsgroups and only came up with this: > > microsoft.public.win2000.cmdprompt.admin > Quote: > I'm not sure what to search for other than "cmd". > There are no groups with "batch" in the name, and > not much in the way of groups with "dos" in the name. > Quote: > In any case, this is a VBScript group. > It's a bit unclear what OP wants to nice up. A good learning source might be scriptomaticv2. You have several output options to choose from : cmdline, text, html, xls HTH Matthias |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Batch file (CMD) output into HTA > What about the group: alt.msdos.batch.nt Quote: > relevant groups. DOS/batch isn't relevant here, yet there seem to be a lot of people who are interested in it. I would have thought that an admin group might be best, but even with "admin" the selection of Microsoft groups is sparse and specialized. I don't see anything like: microsoft.public.windows.admin[.scripting] And the DOS groups seem to be only DOS. I guess it would help if MS had come up with a name for the expanded NT command line functionality, like DOS2, NTDOS, or something like that. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Batch file (CMD) output into HTA On Jan 11, 1:11*am, Daz <darren.black...@xxxxxx> wrote: Quote: > Hi All, > > I am wondering if it is possible to have output from a batch file back > into a HTA file. > > What i want to do is use the nice features of HTA to put a nice clean > GUI on my batch files. *So that instead of having the ugly command > text etc, i can have the output back into the HTA and then put some > clean type faces etc around it. > > Is it possible? *If so can someone provide and example of HTA code to > do it? > > Any advice or help would be appreciated. > > Cheers, > Daz <HTML> <HEAD> <TITLE> MSDOS Demo</TITLE> <HTA:APPLICATION ID="oMSDOS" APPLICATIONNAME="MSDOSApp" BORDER="thick" BORDERSTYLE="normal" CAPTION="yes" ICON="C:\WinNT\system32\cmd.exe" SINGLEINSTANCE="no" VERSION="1.0" WINDOWSTATE="normal"/> <SCRIPT Language=VBScript> opener = "Me" sub initialize CurrentFolder.value = CreateObject("Wscript.Shell").CurrentDirectory Cmd.focus end sub Function CmdPrompt(sCmd) Dim alines, sCmdLine, stemp, ofs, oWS, nRes 'On Error Resume Next sCmdLine = """%comspec%"" /c " & sCmd & " 1>> " set ofs = CreateObject("Scripting.FileSystemObject") stemp = ofs.GetTempName set oWS = CreateObject("Wscript.Shell") stemp = oWS.Environment("PROCESS")("TEMP") & "\" & stemp nRes = oWS.Run(sCmdLine & Chr(34) & sTemp & Chr(34) _ , Abs(cSng(bConsoleSw)), True) alines = "ERRORLEVEL: " & nRes & vbCRLF if ofs.FileExists(sTemp) Then with ofs.OpenTextFile(stemp) if Not .AtEndofStream Then alines = aLines & .ReadAll End if End With ofs.DeleteFile stemp alines = Split(aLines, vbNewline) Else aLines = Array(nRes, "") End if ReDim Preserve alines(Ubound(alines) - 1) if Err.Number <> 0 Then _ aLines = Array("Error Number:" & CStr(Err.Number), Err.Description) CmdPrompt = alines End Function sub checkEnter With window.event if .keycode = 13 then runMS_DOS Else .cancelbubble = false .returnvalue = true End if End With End sub Sub ChDir Set oSHL = CreateObject("Shell.Application") On Error Resume Next Set oFolder = oSHL.BrowseForFolder(&H0,"Select Working Folder",&H11,&H11) If Err.Number = 0 Then CurrentFolder.value = oFolder.Self.Path Cmd.focus End if End Sub sub Copy document.ParentWindow.ClipboardData.SetData "text", Results.innerText end sub Sub runMS_DOS 'On Error Resume Next CreateObject("Wscript.Shell").CurrentDirectory = CurrentFolder.value if Err.Number <> 0 Then aLines = Array("Error Number:" & Hex(Err.Number), Err.Description) Else Results.innerhtml = "</b> Working ...</b>" aLines = CmdPrompt(Cmd.Value) End if Results.innerhtml = "<xmp>" & Join(aLines, vbCRLF) & "</xmp>" End Sub </SCRIPT> </HEAD> <BODY onload=initialize style="font:11pt Lucinda Console"> </B>Working Folder: </B> <input type=text id=CurrentFolder size=70> <input type=button value=Browse onclick=ChDir> <br> </B>MS DOS Command: </B> <input type=text onkeydown=checkEnter size=60 id=Cmd> <input type=button id=Go value=" GO " onclick=runMS_DOS> <hr> <div id=Results> </div> <hr><center> <input type=button value=" Top " onclick="scrollto 0,0:Cmd.focus:Cmd.Select">   <input type=button value=" Copy " onclick="copy">   <input type=button value=" Close " onclick="close"> </center> </BODY> </HTML> I saw a posting for the use of an MS combo box suitable for scripting a while back, but can't google the reference today. It would make a nice addition as the Command input line by letting you pick a previous command line by inspection. But, as I said, I can't find it again. Tom Lavedas ------------------- |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Batch file (CMD) output into HTA Tom Lavedas wrote: Quote: > On Jan 11, 1:11 am, Daz wrote: Quote: >> Hi All, >> >> I am wondering if it is possible to have output from a batch file >> back into a HTA file. >> >> What i want to do is use the nice features of HTA to put a nice clean >> GUI on my batch files. So that instead of having the ugly command >> text etc, i can have the output back into the HTA and then put some >> clean type faces etc around it. >> >> Is it possible? If so can someone provide and example of HTA code to >> do it? >> >> Any advice or help would be appreciated. >> >> Cheers, >> Daz > Here is an attempt I wrote some time back ... > > <HTML> Quote: > </HTML> > > I saw a posting for the use of an MS combo box suitable for scripting > a while back, but can't google the reference today. It would make a > nice addition as the Command input line by letting you pick a previous > command line by inspection. But, as I said, I can't find it again. Your HTA example is cool but there seems to a few problems with it (read HTA limitations). The first I noticed was the command line does not seem to work with internal commands of more than a single parameter. It returns an errorlevel of 0 but does nothing. Then I tried it with a batch file and it does permit parameters but if less than the number of parameters expected are provided, it seems to append a "1" to what is actually expanded. For example, say the batch has "ECHO parameters=%1 %2 %3" but only two parameters were provided on the command line (say 'foo bar'), the output is "parameters=foo bar 1". Where does the 1 come from? Another thing I noticed (actually, I expected it) is the output is not displayed in real time. Output is actually displayed after completion of the command. The output does not seem customizable in the sense of formatting the output to something pretty. Don't get me wrong, it was an educational exercise on HTA capability but I think OP will be happier to just create a shortcut to his existing batch(s) and set display properties to font and colors desired. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Batch file (CMD) output into HTA On Jan 11, 5:29*pm, "Todd Vargo" <tlva...@xxxxxx> wrote: Quote: > TomLavedaswrote: Quote: > Quote: > > I saw a posting for the use of an MS combo box suitable for scripting > > a while back, but can't google the reference today. *It would make a > > nice addition as the Command input line by letting you pick a previous > > command line by inspection. *But, as I said, I can't find it again. > Tom, I tried but could not come up with one of these. > I finally found the Combobox I was sure I had seen recently. I found a Script Center article, though it was not what I saw originally: http://www.microsoft.com/technet/scr.../combobox.mspx. It is probably the source of whatever I saw posted. Don't try to find it in the index. It doesn't seem to be there (at least I can't find it). It took a search for CLASSID to turn it up. Anyway, it works like a champ - if you have MS OFFICE installed. The implication is that all of the form objects can be used, but you would need to know the ClassID. I haven't looked for a list of those, but would have some interest in the Tab control for a project I've been working on, if anyone stumbles on it. If anyone reads this and wants a copy of the latest version of the MSDOSDemo.hta with the combobox in operation, let me know at "tlavedas at hotmail dot com" (since I don't have a web site at this time). Tom Lavedas *********** http://there.is.no.more/tglbatch/ |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Batch file (CMD) output into HTA Tom Being a 'ScriptSquirrel' - I remembered that I had got some Script (JavaScript) that creates a "proper" (ish) ComboBox in Web Pages. I guess that as it works in HTML pages, it can be used in HTA !! I cannot remember whence it came but if anyone is interested, I will ZIP the folder concerned and put it on one of my WebSites. But maybe I have not understood your post !! Best regards Take care Pete (Northolt UK) Tom Lavedas wrote: Quote: > On Jan 11, 5:29 pm, "Todd Vargo" <tlva...@xxxxxx> wrote: Quote: > > TomLavedaswrote: Quote: > > Quote: > > > I saw a posting for the use of an MS combo box suitable for scripting > > > a while back, but can't google the reference today. It would make a > > > nice addition as the Command input line by letting you pick a previous > > > command line by inspection. But, as I said, I can't find it again. > > Tom, I tried but could not come up with one of these. > > > > I finally found the Combobox I was sure I had seen recently. I found > a Script Center article, though it was not what I saw originally: > http://www.microsoft.com/technet/scr.../combobox.mspx. > It is probably the source of whatever I saw posted. Don't try to find > it in the index. It doesn't seem to be there (at least I can't find > it). It took a search for CLASSID to turn it up. > > Anyway, it works like a champ - if you have MS OFFICE installed. The > implication is that all of the form objects can be used, but you would > need to know the ClassID. I haven't looked for a list of those, but > would have some interest in the Tab control for a project I've been > working on, if anyone stumbles on it. > > If anyone reads this and wants a copy of the latest version of the > MSDOSDemo.hta with the combobox in operation, let me know at "tlavedas > at hotmail dot com" (since I don't have a web site at this time). > > Tom Lavedas > *********** > http://there.is.no.more/tglbatch/ |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Batch file (CMD) output into HTA On Jan 16, 1:26*am, p byers <p...@xxxxxx-ltd.co.uk> wrote: Quote: > Tom > Being a 'ScriptSquirrel' - I remembered that I had got some Script (JavaScript) > that creates a "proper" (ish) ComboBox in Web Pages. > I guess that as it works in HTML *pages, it can be used in HTA !! > > I cannot remember whence it came but if anyone is interested, I will ZIP the > folder concerned and put it on one of my WebSites. > > But maybe I have not understood your post !! > > Best regards > Take care > Pete (Northolt UK) > > Tom Lavedas wrote: Quote: > > On Jan 11, 5:29 pm, "Todd Vargo" <tlva...@xxxxxx> wrote: Quote: > > > TomLavedaswrote: Quote: Quote: > > > > I saw a posting for the use of an MS combo box suitable for scripting > > > > a while back, but can't google the reference today. *It would make a > > > > nice addition as the Command input line by letting you pick a previous > > > > command line by inspection. *But, as I said, I can't find it again. Quote: Quote: > > > Tom, I tried but could not come up with one of these. Quote: > > {snip} Quote: > > I finally found the Combobox I was sure I had seen recently. *I found > > a Script Center article, though it was not what I saw originally: > >http://www.microsoft.com/technet/scr...tivex/combobox..... > > It is probably the source of whatever I saw posted. *Don't try to find > > it in the index. *It doesn't seem to be there (at least I can't find > > it). *It took a search for CLASSID to turn it up. Quote: > > Anyway, it works like a champ - if you have MS OFFICE installed. *The > > implication is that all of the form objects can be used, but you would > > need to know the ClassID. *I haven't looked for a list of those, but > > would have some interest in the Tab control for a project I've been > > working on, if anyone stumbles on it. Quote: > > If anyone reads this and wants a copy of the latest version of the > > MSDOSDemo.hta with the combobox in operation, let me know at "tlavedas > > at hotmail dot com" (since I don't have a web site at this time). Quote: lot of code. I like reusing available system or application objects whenever possible. Tom Lavedas ========= |
My System Specs![]() |
| | #10 (permalink) |
| | Re: Batch file (CMD) output into HTA "mayayana" <mayaXXyana@xxxxxx> wrote in message news:%23iA4DeBdJHA.552@xxxxxx Quote: Quote: >> What about the group: alt.msdos.batch.nt >> > I'm surprised that MS doesn't seem to have more > relevant groups. DOS/batch isn't relevant here, yet > there seem to be a lot of people who are interested > in it. I would have thought that an admin group > might be best, but even with "admin" the selection > of Microsoft groups is sparse and specialized. I don't > see anything like: > microsoft.public.windows.admin[.scripting] microsoft.public.windows.server.scripting microsoft.public.win2000.cmdprompt.admin The first is non-scripting-language specific, and generic to the o/s called windows server, which covers a few varieties. The second would appear to be specific to that now obsolete/unsupported o/s called w2k, but it tends to be somewhat open to more recent versions. Quote: > And the DOS groups seem to be only DOS. I guess > it would help if MS had come up with a name for the > expanded NT command line functionality, like DOS2, > NTDOS, or something like that. The trouble with the term DOS is that that was the name of an o/s that many of us are no longer using. Yes, I know some still use w9x, some third party DOS lookalikes, and even real DOS. But since is it no longer supported, I am not surprised that MS has not created public groups dedicated to it. This has been discussed before, and IIRC, the consensus was that a proliferation of batch support groups, one for each possible O/S, would be confusing. /Al |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Batch File | Vista General | |||
| batch file help | Vista General | |||
| Batch file | Vista file management | |||
| batch file calling exe file problem | Vista security | |||
| Need help with batch file | Vista General | |||