Solved

Client-based addressing a local modem

Posted on 2002-05-17
29
505 Views
Last Modified: 2007-12-19
Hello Experts,

Looking for a code that addresses the local modem I found a sollution that should do the job at http://www.15seconds.com.

---Quote-----

In the following example, the pager object picks up the phone (modem), dials 212-555-5555, waits about 6 seconds (each comma is about 2 seconds), then dials 1234, and then hangs up.
A possible application would be automatically sending a message to a support technician's pager when an emergency work-order enters the system.

dim oDialer
set oDialer = server.createobject("dialer.pager")
oDialer.dial "212-555-5555,,,1234"
set oDialer = nothing

-----End of quote---------------

A downloadable code that should be compiled is privided as well:

-------------Beginning of code-----
dim oDialer
set oDialer = server.createobject("dialer.pager")
oDialer.dial "212-555-5555,,,1234"
set oDialer = nothing

Public Sub Dial(num As String)
    On Error Resume Next
    Dim Communications 'As MSCommLib.MSComm
    Set Communications = CreateObject("MSCommLib.MSComm")
    DialString$ = "ATDT" + num + ";" + Chr$(13)
    Communications.CommPort = 3
    Communications.Settings = "300,N,8,1"
   
    On Error Resume Next
    Communications.PortOpen = True
   
    If Err Then
        MsgBox Err.Description
      ' MsgBox "COM1: not available. Change the CommPort property to another port."
       Exit Sub
    End If
   
    ' Flush the input buffer.
    Communications.InBufferCount = 0
   
    ' Dial the number.
    Communications.Output = DialString$
   
    ' Wait for "OK" to come back from the modem.
    Do
       dummy = DoEvents()
       ' If there is data in the buffer, then read it.
       If Communications.InBufferCount Then
          FromModem$ = FromModem$ + Communications.Input
          ' Check for "OK".
          If InStr(FromModem$, "OK") Then
             ' Notify the user to pick up the phone.
             Beep
       '      MsgBox "Please pick up the phone and either press Enter or click OK"
             Exit Do
          End If
       End If

    Loop
   
    ' Disconnect the modem.
    Communications.Output = "ATH" + Chr$(13)
    ' Close the port.
    Communications.PortOpen = False
 
 
End Sub
-------------End of code------------------------------


I am not an expert in ASP or VB.
But I know that the provided answer is server-based one and I am looking for a client-based sollution. The sollution should use the local modem in a intranet enviorment.

My question is:

Can someone please help me by providing me with a client-based sollution?

The code does not need protection an, if posible, can be used directly in the asp site. If this is not possible a ActiveX object on the client is no problem either.

The person that profides me me with a working peace of code will get  the points

Thanks,

Franse
0
Comment
Question by:franse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
  • 6
  • +3
29 Comments
 
LVL 19

Expert Comment

by:webwoman
ID: 7017142
YOu want the SERVER to dial? Because that's what's going to happen. ASP runs on the SERVER not the CLIENT.

If you want this online, there is no good client based solution. How do you know they're not using the modem for their connection? How would you know what to dial? What if they're in some other country? What if they don't HAVE a modem?

If you want this, have them download an app, install it, and it can do whatever you want.
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7017295
When I did a job for SAIC, I had to create a paging system similar to what you ask, but I used Perl scripts to acccomplish this.

Have you checked with the pager company?  Most of the good text messaging pagers already have software available that does this...
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7017299
And so does most UPS software, backup software, etc.

Which begs the question -- what is this for?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 28

Expert Comment

by:AzraSound
ID: 7017337
What happens if you run the above on the client-side?
0
 

Author Comment

by:franse
ID: 7018351
Thanks for the quick response,

You seem to have some questions.

Answers:

To Webwoman:

No I want the visiting client to use its own modem. And I know they have a modem becouse it is, like I wrote in INTRANET enviorment. The sollution can be for example a ActiveX bowser plugin.

To mgfranz:

The Lanuage does not mather as long as I can activate it from a ASP site. And I do not need to have pager to be called. I like to call a normal Phone number.

To webwoman:

I know those apps do more or less the same. But I am looking for a sollution that should be started from a ASP site.

To AzraSound:

Now thats a question I like to have answerd.
I do not know enough about VB and ASP to check if it should work.

What do I need it for?

I have a large DB with address data like name, City and Phone numbers. The information is accessed by a series of webforms that show the information on the screen. A phone number is only readable and the number is dailed on the phone. And with this question I like to investigate the possibily of using the PC as a phone and dailing the number by clicking on a button directly on the screen behind the presented number.

I hope I've cleared some smoke,

Franse









0
 
LVL 19

Expert Comment

by:webwoman
ID: 7018953
ASP runs on the SERVER, not the CLIENT. It's not going to do you any good at all.

You might be able to get an ActiveX control to work. All computers will, of course, have to have the modems connected to a phone line. That's a pretty unusual intranet setup -- by definition that's a network environment, and there usually wouldn't be much need for modems to be working.
0
 

Author Comment

by:franse
ID: 7019020
Dear webwoman,

Why do you question my need for this sollution?
If I say the connecting clients all have modems and they are all able to work as a phone. Then you can be sure they can.
If you think you can't contribute thats fine with me.
But please leave others to think otherwise.

Thank you,

Franse
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7019609
And again...
ASP runs on the SERVER, not the client. It's not going to do what you want. By definition, it CAN'T.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7019610
Why not just use OUtlook? It can do EXACTLY what you want, it's probably already installed, and you wouldn't need to do anything but import the address book into a public folder.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7021515
>>But I know that the provided answer is server-based one and I am looking for a client-based sollution.

Nothing in the above code is saying it MUST be ASP.  VBScript does not necessarily, automatically, indicate ASP code.



>>If this is not possible a ActiveX object on the client is no problem either.

The above function is using an ActiveX object, though the clients may yet to have it installed.  For simple testing, just paste the above Dial function into an html page between script tags ( <script language="VBScript"> 'code </script>  )  and see what happens.  You could just have a button on the page that calls the function:

<input type="button" value="Dial" onclick="Dial('212-555-5555,,,1234')">
0
 

Author Comment

by:franse
ID: 7023761
AzraSound,

The code for the ActiveX object is all I have (in the question). Can you explain how to make an object out of it?
I think I need Visual Studio for it but do not know how and what to do. A version of Visual studio 6 is avalable to me.

Thanks,

Franse

 
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7023966
The line:

>>CreateObject("MSCommLib.MSComm")

is what creates the object.  It is this MSComm control that would need to be distributed to users who do not have it on their machines.  There really is no reason to go and create a control of your own that will simply use this control.

The only thing I noticed looking at the code now is the use of 'DoEvents' which is not available to you in VBScript.  However, you may not need it since I believe the communications buffer receives data asynchronously regardless if your app is eating up a bulk of the CPU.
0
 

Author Comment

by:franse
ID: 7025318
AzraSound,

Sorry to little knowlige of what we are talking about.

The code I use is:

-------------------Beginning of code---------------------
<script language="VBScript">
Public Sub Dial(num As String)
   On Error Resume Next
   Dim Communications 'As MSCommLib.MSComm
   Set Communications = CreateObject("MSCommLib.MSComm")
   DialString$ = "ATDT" + num + ";" + Chr$(13)
   Communications.CommPort = 3
   Communications.Settings = "300,N,8,1"
   
   On Error Resume Next
   Communications.PortOpen = True
   
   If Err Then
       MsgBox Err.Description
     ' MsgBox "COM1: not available. Change the CommPort

property to another port."
      Exit Sub
   End If
   
   ' Flush the input buffer.
   Communications.InBufferCount = 0
   
   ' Dial the number.
   Communications.Output = DialString$
   
   ' Wait for "OK" to come back from the modem.
   Do
      dummy = DoEvents()
      ' If there is data in the buffer, then read it.
      If Communications.InBufferCount Then
         FromModem$ = FromModem$ + Communications.Input
         ' Check for "OK".
         If InStr(FromModem$, "OK") Then
            ' Notify the user to pick up the phone.
            Beep
      '      MsgBox "Please pick up the phone and either press

Enter or click OK"
            Exit Do
         End If
      End If

   Loop
   
   ' Disconnect the modem.
   Communications.Output = "ATH" + Chr$(13)
   ' Close the port.
   Communications.PortOpen = False


End Sub
</script>  

<input type="button" value="Dial"

onclick="Dial('212-555-5555,,,1234')">

----------------end of code-------------------


It presents a button en when it is clicked it produces a Runtime error "Type mis match "dail"" on line 51

Franse
0
 
LVL 19

Expert Comment

by:webwoman
ID: 7025957
Which is exactly the point. Do you know how these systems are set up? Are they all EXACTLY the same? Where is the modem? What com port? What type of modem? Do you know?

You have to -- because otherwise you can't call the modem, because you don't know where it is. And if they're not all the same, you're going to have lots of problems.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7026175
The code above is in VB, not VBScript (some things must be changed, like DoEvents I mentioned):


Try something like this:

<script language="VBScript">
Public Sub Dial(num)
  On Error Resume Next
  Dim Communications 'As MSCommLib.MSComm
  Set Communications = CreateObject("MSCommLib.MSComm")
  DialString = "ATDT" + num + ";" + Chr(13)
  Communications.CommPort = 3
  Communications.Settings = "300,N,8,1"
 
  On Error Resume Next
  Communications.PortOpen = True
 
  If Err Then
      MsgBox Err.Description
    ' MsgBox "COM1: not available. Change the CommPort

property to another port."
     Exit Sub
  End If
 
  ' Flush the input buffer.
  Communications.InBufferCount = 0
 
  ' Dial the number.
  Communications.Output = DialString
 
  ' Wait for "OK" to come back from the modem.
  Do
     'WE NEED A SUBSTITUE FOR DOEVENTS - TRY W/O BUT BEWARE CPU MAY LOCK IN ENDLESS LOOP
     ' If there is data in the buffer, then read it.
     If Communications.InBufferCount Then
        FromModem = FromModem + Communications.Input
        ' Check for "OK".
        If InStr(FromModem, "OK") Then
           ' Notify the user to pick up the phone.
           ' Beep
     '      MsgBox "Please pick up the phone and either press

Enter or click OK"
           Exit Do
        End If
     End If

  Loop
 
  ' Disconnect the modem.
  Communications.Output = "ATH" + Chr(13)
  ' Close the port.
  Communications.PortOpen = False


End Sub
</script>  
0
 

Author Comment

by:franse
ID: 7026869
AzraSound,

The result no error pop-up but an (error in page)in left corner of bar under in browser.

Franse
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7027012
Double-click on the error symbol (yellow triangle?) to see what the error is.
0
 
LVL 12

Expert Comment

by:Wouter Boevink
ID: 7069936
This should be fun, make a client side scripts that dials out. No way it's going to work. The browser is running in a security context that can't access such system resources.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 7070081
The specification does not say it needs to be done secretively.  An ActiveX control embedded in a page can access what it needs if a user allows it to run can it not?
0
 

Author Comment

by:franse
ID: 7343955
Sorry guys an girls,

This not leading to what I am looking for. I acept that it is not posible.

I'll send a request to the Community Support to delete this qustion. I'll hope you have you people have no objections. And if you do I'll hope you can still help me out.

Thanks,

franse
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7345289
Every one has mentioned that a ActiveX component installed on the client is the only way.  I have ran across a few examples of this very issue in my years... all to which install a component on my machine, which I do not like.
0
 

Author Comment

by:franse
ID: 7345921
mqfranz,

Wait don't run away..
Wat you mention is what I am looking for. Like I tried to explain over and over again is that the sollution is for an intranetwork and not for a public site. So if you have information I am verry interested to hear what you have to say. Especially if it is a free component.

Thanks for the response.

Franse
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7345961
0
 

Expert Comment

by:GKR2002
ID: 7563859
Today, I wrote something that is similar to what you are talking about.  However, I needed to locally access the client's com port for "output".  I needed to send a bar code printer some "IPL" language made up of info from a database.  Same idea, just a different direction.  Worked like a charm on "my" development machine however, the client machines are another problem because they don't have Visual Studio installed on them.

Since you mentioned something to this effect, you may have already solved your problem. If not, hang on, it seems that the scripting environment looks like a design-time environment from the OCX's point of view and machines which don't have VID, don't have design time licensing.

Supposedly, the only way around this is to wrap the OCX in a wrapper?  I am working on one now.  Did you find your solution?  If not, I will send you mine when I get it finished or perhaps, if you already found a solution, you could post your solution for others.
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7566651
0
 

Accepted Solution

by:
GKR2002 earned 400 total points
ID: 7567557
Franse, not sure if you found your solution yet or not but this will do exactly what you want to do.

The MSComm Control is a licensed control.  To use licensed controls in an HTML page on a non-licensed computer, you must generate a license package file.  To learn how to generate a "lpk" file, read Microsoft article: q159923 or do this.

Download the lpk tool from: (URL is split)
-------------------------------------------------------
http://msdn.microsoft.com/downloads/samples/internet/
default.asp?url=/downloads/samples/internet/browsertools/
lpktool/Default.asp

To the computer that is licensed to use the control

Run lpk_tool.exe located in (Path is split)
"Your Download Folder"\downloads\samples\internet\
browsertools\lpktool\

Run Lpk_tool.exe

Highlight each licensed ActiveX control that you want to use on the HTML page, and then click Add.

Click Save & Exit, and then type a name for the LPK file.

Here is an Example:
Example assumes you created a lpk file and named
it "lic.lpk" and your web page that you want to use the control in, resides in a folder named "printing" and you are only using the mscomm control.

Copy your "lic.lpk" file to the "printing" folder through FrontPage, VID, or whatever program you design in.

==================== Clip ===========================
<html>
<head>
<script language="vbscript">
Sub PlayWithComm()
 Comm.PortOpen = True
 Comm.Output = "Hello World"
 Com.PortOpen = False
End Sub
</script>
</head>

<body onload="PlayWithComm()">

<!-- This is the licensing control -->
<object
classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331" viewastext>
<param name="LPKPath" value="commlicense.lpk">
</object>

<!-- This is the mscomm control -->
<object
classid="clsid:648A5600-2C6E-101B-82B6-000000000014" id="Comm" width="1" height="1">
<param name="BaudRate" value="9600">
<param name="ParitySetting" value="0">
<param name="DataBits" value="8">
<param name="StopBits" value="0">
</object>
</body>
</html>
0
 

Author Comment

by:franse
ID: 7571662
Hello GKR2002,

No I don't have a working sollution jet. But yours looks promising.

But
Wat activeX controle do you think I need to highlight in the LPK tool?

And do I understand correctly that I have to make "Printing" folder in my web directory?
And have to place the "lic.lpk" file in that dir?
And this file "lic.lpk" does it not need to have the same name as the file in this line:
<param name="LPKPath" value="commlicense.lpk">

Thanks,

franse
0
 

Expert Comment

by:GKR2002
ID: 7576463
The ActiveX contol name is:
"Microsoft Communications Control"

Yes, but the dir name can be any name you want.

If you don't put the "*.lpk" file in the same dir as the web page that is using the control, then you need to indicate that when you specify the param value attribute but keep the param name attribute as "LPKPath".

The reason for al this because the param value attribute is a relative path to the "*.lpk" file.  So if you decide to name your lpk file "comm.lpk" and you put it in a dir named "licenses", on the root.  But you have the web page that uses the control in a folder named "/zoo/animals/cats.htm, then the param tag would look like:

<param name="LPKPath" value="/licenses/comm.lpk">

This works fantastic as this control allows you just about everything you could ever want to do with the users comm port.

Enjoy,



0
 

Author Comment

by:franse
ID: 7592204
GKR2002

Thanks this is exactly what I'am looking for.

Thanks,

franse
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IP API - need data... 4 31
age from date of birth 4 63
Debugging Html 8 40
SP converting date time to date and time separately 2 36
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question