Question about the context menu

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

Question about the context menu

Post by samsungpower »

Hi, We have been using autoit to create some little .exe scripts for things we need to be execute when a call comes in and initiated from within your program.
Our current little project was to set up a voice recorder that would save the file within the web director and be link to the call history and also be available via thru our pushover app.

We have set up a free sound recorder software from http://www.coolrecordedit.com/freesoundrecorder.php and have it connected thru the computers line in port and have it working with positive results.

What we were trying to do is use the name, number, and call began information as the save file information for the sound recorder software that would be accessed thru via webpage link ###name### etc. . Now to the question, autoit uses as you know class to determine certain areas within the target program to access and keep active, we were able to make a little program and use the short cut key in the Ascendis main window Ctrl + Alt + C to copy and paste those three pieces of information into the recorder software but the program denied the file name because there was square boxes the represented spaces between each field.

Our second attempt was to grab each field information separately and insert it with spaces between them but the problem is not knowing the class name for the "call list context menu" when you right click and the menu become visible. Does the context menu have a class name assign to it so we can target the area field in your program.

Thanks Richard

PS. We also have to change the date and time format to be accepted by the sound recorder software. 05/10/2017 to 05-10-2017 and time from 9:10:49 to 9.10.49
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Question about the context menu

Post by Bill Root »

Hi Richard,
samsungpower wrote:Does the context menu have a class name assign to it so we can target the area field in your program.
We have not assigned a class to the context menu. I tried a couple window spy programs but one is incapable of monitoring a menu, and the other just shows info for the window behind the menu.

Capturing info from a menu is a tricky proposition because Windows makes them go away if focus is moved to another window.

The normal way to get caller information out of Ascendis Caller ID is to pass the information to the external program as command line arguments. This assumes the external program is launched when the caller information is received or when the call ends.

Another less-optimal option is to write the desired information to a file that the external program references. This can be tricky because if the same filename is always used, incoming calls can (try to) overwrite information that is still being processed by the external program. If different filenames are used, the external program might not know which file to use. However, some solutions are possible.

Perhaps I could help with a solution based on one of those techniques?

As to file naming based on dates or other caller information, an advanced script can be used in Ascendis Caller ID to create valid file names from the data.


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

Post by samsungpower »

Bill, Thank you for looking into this matter and also suggesting possible solution ideas. If normal way ( best ) is to past command line arguments to a external program then we will try to take that approach. So let me just clarify the layout process that would have to take place. First Ascendis would pass the information into a external program maybe like notepad, and then autoit would copy & paste from notepad to our sound recorder software, is that what you would recommended the process to be? If we have a external program running 24/7 in the background what program would your suggestion, taking consideration of memory resources and easiest scripts to export. If you could point us in the right direction and show an example it would be much appreciated on how to use command line arguments. Something like this?

Code: Select all

Run('notepad');
Run('myprogram.exe');
Run('showargs.exe',
'"' + CallInfo.Name + '" ' +
'"' + CallInfo.Number + '" ' +
'"' + CallInfo.DateTimeStr + '" ');
Richard
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

Update : I quess I wasn't fully awake or a brain freeze with the code, should be something like this I think.

Code: Select all

RUN "notepad.exe" "{Name} {Number} {DateTime}";
I will check tomorrow when I'am at the office on the computer.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Re: Question about the context menu

Post by Bill Root »

Hi Richard,

If you're using an advanced script, then you had it right the first time:

Code: Select all

//LANGUAGE=DWS
Run('showargs.exe',
'"' + CallInfo.Name + '" ' +
'"' + CallInfo.Number + '" ' +
'"' + CallInfo.DateTimeStr + '" ');
If you're using an Easy action, then your second approach would work for the parameters:
Program: ShowArgs.exe
Arguments: "{Name}" "{Number}" "{DateTime}"


However, I was suggesting you pass the arguments directly to your script. This web page discusses accessing command line parameters in your AutoIt script:
https://www.autoitscript.com/autoit3/do ... unning.htm

An example they give for passing arguments to an AutoIt script run through AutoIt is:

Code: Select all

AutoIt3.exe myScript.au3 param1 "This is a string parameter" 99
You can access the parameters in your script thusly:

Code: Select all

$CmdLine[0] ; This contains 3 parameters.
$CmdLine[1] ; This contains param1 and not myScript.au3 as this is ignored when running non-compiled.
$CmdLine[2] ; This contains This is a string parameter.
$CmdLine[3] ; This contains 99.
$CmdLineRaw ; This contains myScript.au3 param1 "This is a string parameter" 99.
If we have a external program running 24/7 in the background what program would your suggestion, taking consideration of memory resources and easiest scripts to export.
If the program you need Ascendis Caller ID to interact with is running all the time you will probably want to use files. In this case, I would recommend having Ascendis Caller ID write the call information to a file in a folder that your program monitors. Your program could always act on the newest file once it's accessible. It may be tricky to ensure that Ascendis Caller ID is done with the file before yours tries to read it, but it should be doable. If it's too hard to monitor for files by date, you could use a sequence number in the filename. An advanced Ascendis Caller ID script should be able to store the next sequence number in an ini file.


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

Post by samsungpower »

Bill,
The normal way to get caller information out of Ascendis Caller ID is to pass the information to the external program as command line arguments.
So if I want to pass name, number, datetime into notepad on a single line text that's the route I will have to take? or is there a another way etc.
run ('windows\notepad.exe' ['name' 'number' 'datetime']; just because I don't understand the complete concept of command line arguments yet.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

samsungpower wrote:So if I want to pass name, number, datetime into notepad on a single line text that's the route I will have to take? or is there a another way etc.
run ('windows\notepad.exe' ['name' 'number' 'datetime']; just because I don't understand the complete concept of command line arguments yet.
A couple things here:
1) Notepad basically only accepts filenames as command line parameters (i.e., notepad.exe filename-to-open.txt)
2) It doesn't really make sense to put the information you need into Notepad to then copy out using copy-and-paste

So, no, the way you proposed to get the information into Notepad using command line parameters won't work, but it's not the right question to ask.

Is the external program that you want Ascendis Caller ID to interface with written using AutoIt?


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

Post by samsungpower »

The external program is called free sound recorder from http://www.coolrecordedit.com/freesoundrecorder.php

I was using autoit to copy "copy clicked cell" from the context menu that would select callbegan field and then open sound recorder - press F2 - display save file name box area - then paste it, hit enter and after 30sec. press F3 to stop reordering and then close the program.

I was hoping to have the file name consist of name, phone and callbegan but was ok with only callbegan but the problem is ... what is display on the main page under the heading callbegan in reference of time is sometimes different then if your right click on the context menu and select copy clicked cell for callbegan information . The system must round up to the closest sec. because it's out sometimes by a sec. sometimes and when we use the callbegan as the file name for the websever it's not found. I have done some testing and with the advance script option using {callbegan} it's dead on with the main page and file name but I don't know how to get {callbegan} information into the recorder software so I was using second best way I knew of.
samsungpower
Posts: 49
Joined: Tue May 22, 2012 4:40 pm

Post by samsungpower »

Bill, actually this may take out some of the guess work, here's the autoit script. Don't laugh too hard and hurt yourself. I did try to clean the code up a little by using

Code: Select all

Send("{down 10}"
and the shift key with delay F10 for keyboard right click but didn't always have positive results.

Code: Select all

Run ("C:/Program files/Ascendis Software/Ascendis Caller ID 3/CallerID.exe")

WinWaitActive("[CLASS:TAscendisCallerID3MainForm]", "", 10)

WinActive("[CLASS:TcxGridSite]")

Sleep(2000)

MouseClick ( "right",60,255,1,10)

Sleep(1000)

Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{down}")
Sleep(50)
Send("{enter}")
Sleep(300)

Run ("c:/Program files/Free Sound Recorder/FreeSoundRecorder.exe")

WinWaitActive("[CLASS:TFormMain]", "", 10)

WinActive("[CLASS:TFormMain]")

Sleep(1000)

Send("{F2 down}")

sleep (50)

Send("{F2 up}")

Sleep(500)

WinWaitActive("[CLASS:TFormMain]", "", 5)

WinActive("[CLASS:TEdit]")

Send ("^v")

Send("{enter}")

Sleep(30000)

Send("{F3 down}")

Sleep(50)

Send("{F3 up}")

Sleep(50)

If ProcessExists("FreeSoundRecorder.exe") Then
  ProcessClose("FreeSoundRecorder.exe")
EndIf


If $CmdLine[0] = 0 Then Exit (1)
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

You need to have Ascendis Caller ID start your AutoIt program/script and pass the desired information on the command line. Since you want to use the date as a filename we need to change the date so it doesn't include characters that aren't allowed in filenames.

Something like this should work:

Code: Select all

//LANGUAGE=DWS

var callBegan: String;

// this uses 24-hour time which is better for sorting
callBegan := FormatDateTime('yyyy-mm-dd hh.nn.ss', CallInfo.CallBegan);
// this uses 12-hour time
//callBegan := FormatDateTime('yyyy-mm-dd hh.nn.ss AM/PM', CallInfo.CallBegan);

var filename: String;
filename := '"' + callBegan + ' # ' + CallInfo.Number + ' # ' + CallInfo.Name + '"';
Run('path\to\AutoIt.exe', 'path\to\autoit\script' + ' ' + filename);
// for testing:
//Run('ShowArgs', filename);
I think your AutoIt script can access the parameter using:

Code: Select all

$CmdLine[1]

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

Post by samsungpower »

Bill, :D :D :D I want to say THANK YOU again for all your time and patients for helping us out ( firefighters). It took me a little while and some reading and trial and error but got it going. I had to change the format for datetime to match the ###CallBegan### in the sever, the only thing with the code was it prevents us of using CallInfo.Ring but our CallInfo.Line still works and that's the big one. That only means in the short future will buy another phone line license from you to add to our system or the ambulance, again thank you.
Bill Root
Site Admin
Posts: 1025
Joined: Mon Jan 19, 2004 1:29 pm
Location: Perrysburg, OH
Contact:

Post by Bill Root »

Richard,

I'm very happy to hear you got it working! Your perseverance does you credit.

The ring count is harder to handle because it's not available at the start of the call. Depending on what you hope to do with it, I may be able to help getting the ring count reported later.


Finest regards,
Bill Root
Ascendis Software LLC
Post Reply