Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Run a .Bat file on the client machine

 
Thread Tools Search this Thread
Old 01-25-2005, 09:33 PM   #1
Default Run a .Bat file on the client machine


Is there a way to do it?

thx...sonny


=?Utf-8?B?c29ubnk=?=
  Reply With Quote
Old 01-25-2005, 09:46 PM   #2
Ken Cox [Microsoft MVP]
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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




Ken Cox [Microsoft MVP]
  Reply With Quote
Old 01-25-2005, 10:29 PM   #3
Kevin Spencer
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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





Kevin Spencer
  Reply With Quote
Old 01-26-2005, 12:27 AM   #4
=?Utf-8?B?c29ubnk=?=
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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

>
>
>



=?Utf-8?B?c29ubnk=?=
  Reply With Quote
Old 01-26-2005, 12:31 AM   #5
=?Utf-8?B?c29ubnk=?=
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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

>
>



=?Utf-8?B?c29ubnk=?=
  Reply With Quote
Old 01-26-2005, 02:20 PM   #6
Kevin Spencer
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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

>>
>>
>>





Kevin Spencer
  Reply With Quote
Old 01-26-2005, 02:49 PM   #7
=?Utf-8?B?ZGhucml2ZXJzaWRl?=
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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

> >
> >
> >



=?Utf-8?B?ZGhucml2ZXJzaWRl?=
  Reply With Quote
Old 01-26-2005, 03:03 PM   #8
=?Utf-8?B?c29ubnk=?=
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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
> >>
> >>
> >>

>
>
>



=?Utf-8?B?c29ubnk=?=
  Reply With Quote
Old 01-26-2005, 03:19 PM   #9
=?Utf-8?B?c29ubnk=?=
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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
> > >
> > >
> > >



=?Utf-8?B?c29ubnk=?=
  Reply With Quote
Old 01-26-2005, 03:31 PM   #10
=?Utf-8?B?ZGhucml2ZXJzaWRl?=
 
Posts: n/a
Default Re: Run a .Bat file on the client machine
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
> > > >
> > > >
> > > >



=?Utf-8?B?ZGhucml2ZXJzaWRl?=
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot Upload file from Local Machine apjustin Software 0 05-21-2008 12:02 PM
SONY DVD RW DW-G120A SOMETIMES FAILS...... atlantic965 DVD Video 0 06-18-2006 10:36 PM
problems backing up dvds Lawrence Traub DVD Video 11 09-27-2005 07:34 PM
Re: Ripping DVDs. Please answer the attached question. - Question.txt Stan Brown DVD Video 19 02-09-2005 11:19 PM
Burn process failed - help! Log file posted for help troubleshooting Michael Mason DVD Video 1 08-16-2004 09:24 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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