Link to home
Start Free TrialLog in
Avatar of franse
franse

asked on

Client-based addressing a local modem

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
Avatar of webwoman
webwoman

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.
Avatar of Mark Franz
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...
And so does most UPS software, backup software, etc.

Which begs the question -- what is this for?
What happens if you run the above on the client-side?
Avatar of franse

ASKER

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









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.
Avatar of franse

ASKER

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
And again...
ASP runs on the SERVER, not the client. It's not going to do what you want. By definition, it CAN'T.
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.
>>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')">
Avatar of franse

ASKER

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

 
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.
Avatar of franse

ASKER

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
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.
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>  
Avatar of franse

ASKER

AzraSound,

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

Franse
Double-click on the error symbol (yellow triangle?) to see what the error is.
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.
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?
Avatar of franse

ASKER

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
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.
Avatar of franse

ASKER

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
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.
ASKER CERTIFIED SOLUTION
Avatar of GKR2002
GKR2002

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of franse

ASKER

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
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,



Avatar of franse

ASKER

GKR2002

Thanks this is exactly what I'am looking for.

Thanks,

franse