473,411 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Run a .Bat file on the client machine

Is there a way to do it?

thx...sonny
Nov 19 '05 #1
10 3833
Sure, if you can convince them to ignore all the security warnings and
install an ActiveX control that runs the batch file.

"sonny" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
Is there a way to do it?

thx...sonny


Nov 19 '05 #2
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" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
Is there a way to do it?

thx...sonny

Nov 19 '05 #3
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" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
Is there a way to do it?

thx...sonny


Nov 19 '05 #4
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" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
Is there a way to do it?

thx...sonny


Nov 19 '05 #5
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" <so***@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
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" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
> Is there a way to do it?
>
> thx...sonny


Nov 19 '05 #6
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" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
Is there a way to do it?

thx...sonny


Nov 19 '05 #7
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" <so***@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
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" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
> Is there a way to do it?
>
> thx...sonny


Nov 19 '05 #8
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" <so***@discussions.microsoft.com> wrote in message
news:3B**********************************@microsof t.com...
> Is there a way to do it?
>
> thx...sonny

Nov 19 '05 #9
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" <so***@discussions.microsoft.com> wrote in message
> news:3B**********************************@microsof t.com...
> > Is there a way to do it?
> >
> > thx...sonny
>
>
>

Nov 19 '05 #10
In that case, your best bet would be to create a Windows Form or ActiveX
Control that will run in the client browser.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"sonny" <so***@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
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" <so***@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
>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" <so***@discussions.microsoft.com> wrote in message
>> news:3B**********************************@microsof t.com...
>> > Is there a way to do it?
>> >
>> > thx...sonny
>>
>>
>>


Nov 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: WM Chung | last post by:
Hello all, My dotnet application configuration is that the client, Web server and database all reside in 3 different computers. There is a function which can browse a file and read in the...
3
by: Paul | last post by:
Is it possible to delete a file on a client side machine using VB/JAVA script? My website allows the user to upload a file to the website and after that I would like to delete the file on their...
1
by: POnfri | last post by:
Hi, I have a problem in a peace of code were i'm doing a file copy using File.Copy. The Source is local and the target is a remote machine. Example: File.Copy(C:\temp\hi.txt,...
4
by: Nikhil Tayal | last post by:
Is there a way to write a file on the client machine from an aspx page? I've a custom query page and need to store the search criteria specified in an XML file on the user machine from my web page...
3
by: Beatrice | last post by:
I am stuck with this problem and desperately need your help. I would like to upload an xml file or any file from client machine and then save it to the server machine. Since the file path on the...
4
by: sunilj20 | last post by:
Hello, I have a requirement wherein, a user clicks on a file name in an ASP.NET web application, and the file should automatically be downloaded (Without showing the "Open", "Save As") in the...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
9
by: CGW | last post by:
I asked the question yesterday, but know better how to ask it, today: I'm trying to use the File.Copy method to copy a file from a client to server (.Net web app under IIS ). It looks to me that...
1
by: harriegovin | last post by:
Hi, Here is the scenario. I have a web application written in vb.net. One of the functionalities of the application is to save the recordset in an xml format on to the client machine. The xml...
0
by: gopikrishnan | last post by:
Hi to all, In Linux, I can able to open a odt file through JSP and Servlet coding. But there creates a problem.. When a client opens a odt file from his machine, the file opens in server side...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.