Modem Line "Name"

Questions, problems, and other issues for Ascendis Caller ID that aren't covered by the other forums.
Post Reply
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Modem Line "Name"

Post by samsungpower »

Ok I am stuck again on a simple script that doesn't work.

Code: Select all

//LANGUAGE=DWS

if (CallInfo.Rings = 2) and (CallInfo.Line = Ambulance) then
begin 

  const FIREFOX='C:\Program Files\Mozilla Firefox\firefox.exe'; // Open FireFox 

  RunWait(FIREFOX, 'http://www.bing.com/maps/?v=2&cp=' + CallInfo.County + '&lvl=17&dir=0&sty=h&sp=&where1=' + CallInfo.SpeakName); 

        RunWait(FIREFOX, 'recv.Call.php'); 


end;


if CallInfo.Line = Fire then  
begin 

const FIREFOX='C:\Program Files\Mozilla Firefox\firefox.exe'; // Open FireFox 

  RunWait(FIREFOX, 'recv.Call.php'); 

end;
The Ambulance staff has been using this program and they love it so much, the fire dept is think of buying the program for themselves as well.
Instead of adding another modem to the same computer and all the problems that could come from that, they made a decision to buy another computer if everything goes well.

The plan is to network both computers and share the 2nd monitor that is attach to the Ambulance system ( dual monitors )
The Fire Dept. would be the "server" and the ambulance would be the "client" and when a call comes in for the Fire Dept. it would display thru the 2nd screen on the ambulance computer.

So far it works perfect and using the script action on the client computer, but not all the action are needed for each departments. Looking at the script above we can't get the CallInfo.Line to work it says unknow line but the line description is right we even try CallInfo.RawLine and still no results. So what am I missing?
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Modem Line "Name"

Post by Bill Root »

samsungpower wrote:Looking at the script above we can't get the CallInfo.Line to work it says unknow line but the line description is right we even try CallInfo.RawLine and still no results. So what am I missing?
You were very close!

When I ran the script I got 'Unknown name "Ambulance"'. This is because "Ambulance" should be in single quotes since it's a string literal like the second parameter to RunWait. Similarly, you need to (single) quote 'Fire' in the second "if" statement. I made these changes and extracted the common FIREFOX constant:

Code: Select all

//LANGUAGE=DWS

const FIREFOX='C:\Program Files\Mozilla Firefox\firefox.exe'; // Open FireFox


if (CallInfo.Rings = 2) and (CallInfo.Line = 'Ambulance') then
begin
  RunWait(FIREFOX, 'http://www.bing.com/maps/?v=2&cp=' + CallInfo.County + '&lvl=17&dir=0&sty=h&sp=&where1=' + CallInfo.SpeakName);
  RunWait(FIREFOX, 'recv.Call.php');
end;


if CallInfo.Line = 'Fire' then 
begin
  RunWait(FIREFOX, 'recv.Call.php');
end; 
Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

Thanks again, one more question. Is there a way to keep the notification window always on top. We have it setup using html under the options in the notification tab. When using the code above bing maps brings up the location of the caller but makes the notification window fall behind it, and I have say in the past we use dual monitors, the notification window is on one and the main program in on the other. If I click anywhere on the main ascendis callerid program is show the notification window again on the 2nd screen.
We do have it check mark under the heading "keep child window on top of main window" any easy fix?
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

I found a workaround for now :roll: to someone find the proper solution. If I put

Code: Select all

RunWait ('CallerId.exe');
end;
at the very end of my script it highlights the main program again. I have look into programs like Always On Top but I would not like to add more programs to this computer then I need too.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

I like your workaround. I hadn't thought of that!

Since any program can request to be on top, the last program that does it wins. Your script launches Firefox after Ascendis Caller ID has shown the notification window (as would any action) so Firefox ends up on top. Even if the notification window were opened after Firefox, if Firefox took too long to start, it would still end up on top.

Other than your workarounds of running Ascendis Caller ID from the action or using a separate program, you might consider manually positioning both windows to display side by side. Ascendis Caller ID will remember the size and position of most notification windows. If you keep an instance of Firefox running I think you can do the same.


Finest regards,
Bill Root
Ascendis Software LLC
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

I need some help from any users on the forum.

I am having trouble with the "if' statements. To simplify our system basically we have a two line phone system, one line is call Ambulance and the other is Fire, here's the code I am having trouble with.

Code: Select all

if ((CallInfo.Line = 'Ambulance') and (CallInfo.Rings = 3) or (CallInfo.Rings = 4)) then
 begin
 SendMail('911' xxxxxxxxxxx
If a call comes in on line fire and rings 4 times it will start the above code :(, so then I tried this code

Code: Select all

if (CallInfo.Line = 'Ambulance') and (CallInfo.Rings = 3) or (CallInfo.Rings = 4) then
 begin
SendMail('911' xxxxxxxx
same results but if I do this codes

Code: Select all

if (CallInfo.Line = 'Ambulance') and (CallInfo.Rings = 3) then
 begin 
SendMail('911' xxxxxxxxx


if (CallInfo.Line = 'Ambulance') and (CallInfo.Rings = 4) then
 begin
SendMail('911' xxxxxxxxx
 
The system works how it should and doesn't send out a email. Yes I just could do like the last example but I was trying to make my scripts a little more presentable and less lengthy. Any thoughts anyone?
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

Solve, this works

Code: Select all

if (CallInfo.Rings = 3) or (CallInfo.Rings = 4) and (CallInfo.Line = 'Ambulance')  then 
 begin 
SendMail('911' xxxxxxxx 
I reverse the order and that matters or I did a typing error.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

Kudos for fixing the problem. For the benefit of other readers, I'll explain.


We only want the "if" statement to succeed when two conditions are true:

Code: Select all

(CallInfo.Line = 'Ambulance')
and

Code: Select all

(CallInfo.Rings = 3) or (CallInfo.Rings = 4)
Since there are no parentheses around the second condition, the statement was probably interpreted as

Code: Select all

if    ((CallInfo.Line = 'Ambulance') and (CallInfo.Rings = 3))   or   (CallInfo.Rings = 4) then
so it triggered whenever four rings occurred.


samsungpower fixed it by changing the order of the statements, but to a human (well, me anyway!) it still looks ambiguous. The recommended solution is to put parentheses around the second condition (the two "or" operands) so the intention is clear:

Code: Select all

if (CallInfo.Line = 'Ambulance') and ((CallInfo.Rings = 3) or (CallInfo.Rings = 4)) then
Another workable solution is to chain the if statements like so:

Code: Select all

if CallInfo.Line = 'Ambulance' then
begin
  if (CallInfo.Rings = 3) or (CallInfo.Rings = 4) then
    ; // do something
end;
Post Reply