![]() |
|
|
|||||||
![]() |
ASP Net - Run a .Bat file on the client machine |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Is there a way to do it?
thx...sonny =?Utf-8?B?c29ubnk=?= |
|
|
|
|
#2 |
|
Posts: n/a
|
Sure, if you can convince them to ignore all the security warnings and
install an ActiveX control that runs the batch file. "sonny" <> wrote in message news:3BD50343-A3BA-4AE3-871B-... > Is there a way to do it? > > thx...sonny |
|
|
|
#3 |
|
Posts: n/a
|
Not really. What business requirement are you trying to achieve with this?
Chances are, we can offer more doable alternatives. -- HTH, Kevin Spencer Microsoft MVP ..Net Developer Neither a follower nor a lender be. "sonny" <> wrote in message news:3BD50343-A3BA-4AE3-871B-... > Is there a way to do it? > > thx...sonny |
|
|
|
#4 |
|
Posts: n/a
|
I have to send some bytes to the COM1 port. There's a Zebra printer waiting
to print my labels there The current application is a Windows app (Visual FoxPro) that opens a command shell and TYPEs a text file (the label) to COM1. This prints the label. I am trying to duplicate this function. If I start a process to open a command shell, this obviously doesn't work because it is server side code. I tried some bit of code that I found in the user groups that used some javascript. I haven't gotten it to work, but I would think that is the way to go, since javascript works on the client instead of the server. Any help would be appreciated...sonny "Kevin Spencer" wrote: > Not really. What business requirement are you trying to achieve with this? > Chances are, we can offer more doable alternatives. > > -- > HTH, > > Kevin Spencer > Microsoft MVP > ..Net Developer > Neither a follower nor a lender be. > > "sonny" <> wrote in message > news:3BD50343-A3BA-4AE3-871B-... > > Is there a way to do it? > > > > thx...sonny > > > |
|
|
|
#5 |
|
Posts: n/a
|
An ActiveX solution isn't out of the question. It's an internal application
for printing labels. I've never coded and ActiveX control. Do you have a handy link showing me how its done? thanks...sonny "Ken Cox [Microsoft MVP]" wrote: > Sure, if you can convince them to ignore all the security warnings and > install an ActiveX control that runs the batch file. > > "sonny" <> wrote in message > news:3BD50343-A3BA-4AE3-871B-... > > Is there a way to do it? > > > > thx...sonny > > |
|
|
|
#6 |
|
Posts: n/a
|
Well, sonny, I'm still confused. You're talking about a web application
here. How is this .bat file supposed to exist on the client? -- HTH, Kevin Spencer Microsoft MVP ..Net Developer Neither a follower nor a lender be. "sonny" <> wrote in message news:E114E5C3-8F9E-41A7-B715-... >I have to send some bytes to the COM1 port. There's a Zebra printer >waiting > to print my labels there > > The current application is a Windows app (Visual FoxPro) that opens a > command shell and TYPEs a text file (the label) to COM1. This prints the > label. I am trying to duplicate this function. > > If I start a process to open a command shell, this obviously doesn't work > because it is server side code. I tried some bit of code that I found in > the > user groups that used some javascript. I haven't gotten it to work, but I > would think that is the way to go, since javascript works on the client > instead of the server. > > Any help would be appreciated...sonny > "Kevin Spencer" wrote: > >> Not really. What business requirement are you trying to achieve with >> this? >> Chances are, we can offer more doable alternatives. >> >> -- >> HTH, >> >> Kevin Spencer >> Microsoft MVP >> ..Net Developer >> Neither a follower nor a lender be. >> >> "sonny" <> wrote in message >> news:3BD50343-A3BA-4AE3-871B-... >> > Is there a way to do it? >> > >> > thx...sonny >> >> >> |
|
|
|
#7 |
|
Posts: n/a
|
Hi Sonny,
Dunno what language your running, but I've just written a C# ASP site that opens word on the client machine and types in a load of labels (avery 7x3) ready to be printed. (using VBScript for all you non-believers!) Not sure if that's much use, but I'd have thought you could run your bat file in a similiar way using EXEC (not sure if that's available in VBScript, but im sure theres a way!). Or even by creating some VBScript to run some of the WSH code here from onload()... http://windowsitpro.com/Files/07/25285/Listing_01.txt HTH Dan "sonny" wrote: > I have to send some bytes to the COM1 port. There's a Zebra printer waiting > to print my labels there > > The current application is a Windows app (Visual FoxPro) that opens a > command shell and TYPEs a text file (the label) to COM1. This prints the > label. I am trying to duplicate this function. > > If I start a process to open a command shell, this obviously doesn't work > because it is server side code. I tried some bit of code that I found in the > user groups that used some javascript. I haven't gotten it to work, but I > would think that is the way to go, since javascript works on the client > instead of the server. > > Any help would be appreciated...sonny > "Kevin Spencer" wrote: > > > Not really. What business requirement are you trying to achieve with this? > > Chances are, we can offer more doable alternatives. > > > > -- > > HTH, > > > > Kevin Spencer > > Microsoft MVP > > ..Net Developer > > Neither a follower nor a lender be. > > > > "sonny" <> wrote in message > > news:3BD50343-A3BA-4AE3-871B-... > > > Is there a way to do it? > > > > > > thx...sonny > > > > > > |
|
|
|
#8 |
|
Posts: n/a
|
This will be an intranet application. I will be able to put the .bat file on
the client machine. "Kevin Spencer" wrote: > Well, sonny, I'm still confused. You're talking about a web application > here. How is this .bat file supposed to exist on the client? > > -- > HTH, > > Kevin Spencer > Microsoft MVP > ..Net Developer > Neither a follower nor a lender be. > > "sonny" <> wrote in message > news:E114E5C3-8F9E-41A7-B715-... > >I have to send some bytes to the COM1 port. There's a Zebra printer > >waiting > > to print my labels there > > > > The current application is a Windows app (Visual FoxPro) that opens a > > command shell and TYPEs a text file (the label) to COM1. This prints the > > label. I am trying to duplicate this function. > > > > If I start a process to open a command shell, this obviously doesn't work > > because it is server side code. I tried some bit of code that I found in > > the > > user groups that used some javascript. I haven't gotten it to work, but I > > would think that is the way to go, since javascript works on the client > > instead of the server. > > > > Any help would be appreciated...sonny > > "Kevin Spencer" wrote: > > > >> Not really. What business requirement are you trying to achieve with > >> this? > >> Chances are, we can offer more doable alternatives. > >> > >> -- > >> HTH, > >> > >> Kevin Spencer > >> Microsoft MVP > >> ..Net Developer > >> Neither a follower nor a lender be. > >> > >> "sonny" <> wrote in message > >> news:3BD50343-A3BA-4AE3-871B-... > >> > Is there a way to do it? > >> > > >> > thx...sonny > >> > >> > >> > > > |
|
|
|
#9 |
|
Posts: n/a
|
Dan,
Could you show me an example of what you did? I would appreciate it. "dhnriverside" wrote: > Hi Sonny, > > Dunno what language your running, but I've just written a C# ASP site that > opens word on the client machine and types in a load of labels (avery 7x3) > ready to be printed. (using VBScript for all you non-believers!) > > Not sure if that's much use, but I'd have thought you could run your bat > file in a similiar way using EXEC (not sure if that's available in VBScript, > but im sure theres a way!). Or even by creating some VBScript to run some of > the WSH code here from onload()... > > http://windowsitpro.com/Files/07/25285/Listing_01.txt > > HTH > > > Dan > > > "sonny" wrote: > > > I have to send some bytes to the COM1 port. There's a Zebra printer waiting > > to print my labels there > > > > The current application is a Windows app (Visual FoxPro) that opens a > > command shell and TYPEs a text file (the label) to COM1. This prints the > > label. I am trying to duplicate this function. > > > > If I start a process to open a command shell, this obviously doesn't work > > because it is server side code. I tried some bit of code that I found in the > > user groups that used some javascript. I haven't gotten it to work, but I > > would think that is the way to go, since javascript works on the client > > instead of the server. > > > > Any help would be appreciated...sonny > > "Kevin Spencer" wrote: > > > > > Not really. What business requirement are you trying to achieve with this? > > > Chances are, we can offer more doable alternatives. > > > > > > -- > > > HTH, > > > > > > Kevin Spencer > > > Microsoft MVP > > > ..Net Developer > > > Neither a follower nor a lender be. > > > > > > "sonny" <> wrote in message > > > news:3BD50343-A3BA-4AE3-871B-... > > > > Is there a way to do it? > > > > > > > > thx...sonny > > > > > > > > > |
|
|
|
#10 |
|
Posts: n/a
|
Hi Sonny,
No problem. Remember, it's C# string wordScript; // load word wordScript = "<script language=\"vbscript\">\n"; wordScript += "set app = createobject(\"Word.Application\")\n"; wordScript += "set oMainDoc = app.Documents.New()\n"; wordScript += "set oSel = app.Selection\n"; wordScript += "app.Application.Visible = True\n"; // enter some text wordScript += "oSel.TypeText \"This is some text\"\n"; wordScript += "oSel.TypeParagraph\n"; // newline wordScript += "</script>\n"; Then you need to add any code you want to use to load the Word Mailing Labels dialog / print / save / whatever, then call the following to make the VBScript run... if(!IsStartupScriptRegistered("mergeScript")) RegisterStartupScript("mergeScript", wordScript); Having said all that, this *might* work, although I havent tested it... Id try it before the word thing.. string wordScript; wordScript = "<script language=\"vbscript\">\n"; wordScript += "set objShell = CreateObject("WScript.Shell")\n"; wordScript += "set objScriptExec = objShell.Exec("c:\your.bat")\n"; wordScript += "</script>\n"; if(!IsStartupScriptRegistered("mergeScript")) RegisterStartupScript("mergeScript", wordScript); As I said, might work............ dunno! HTH Dan "sonny" wrote: > Dan, > > Could you show me an example of what you did? I would appreciate it. > > > "dhnriverside" wrote: > > > Hi Sonny, > > > > Dunno what language your running, but I've just written a C# ASP site that > > opens word on the client machine and types in a load of labels (avery 7x3) > > ready to be printed. (using VBScript for all you non-believers!) > > > > Not sure if that's much use, but I'd have thought you could run your bat > > file in a similiar way using EXEC (not sure if that's available in VBScript, > > but im sure theres a way!). Or even by creating some VBScript to run some of > > the WSH code here from onload()... > > > > http://windowsitpro.com/Files/07/25285/Listing_01.txt > > > > HTH > > > > > > Dan > > > > > > "sonny" wrote: > > > > > I have to send some bytes to the COM1 port. There's a Zebra printer waiting > > > to print my labels there > > > > > > The current application is a Windows app (Visual FoxPro) that opens a > > > command shell and TYPEs a text file (the label) to COM1. This prints the > > > label. I am trying to duplicate this function. > > > > > > If I start a process to open a command shell, this obviously doesn't work > > > because it is server side code. I tried some bit of code that I found in the > > > user groups that used some javascript. I haven't gotten it to work, but I > > > would think that is the way to go, since javascript works on the client > > > instead of the server. > > > > > > Any help would be appreciated...sonny > > > "Kevin Spencer" wrote: > > > > > > > Not really. What business requirement are you trying to achieve with this? > > > > Chances are, we can offer more doable alternatives. > > > > > > > > -- > > > > HTH, > > > > > > > > Kevin Spencer > > > > Microsoft MVP > > > > ..Net Developer > > > > Neither a follower nor a lender be. > > > > > > > > "sonny" <> wrote in message > > > > news:3BD50343-A3BA-4AE3-871B-... > > > > > Is there a way to do it? > > > > > > > > > > thx...sonny > > > > > > > > > > > > |
|