Left Half of Ascendis Software LLC Logo Right Half of Ascendis Software LLC Logo

Ascendis Software LLC Support Forum
 
  ascendis.comascendis.com   FAQFAQ    SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister  
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Question about the context menu

 
Post new topic   Reply to topic    ascendis.com Forum Index -> Other Issues - Ascendis Caller ID
View previous topic :: View next topic  
Author Message
samsungpower



Joined: 22 May 2012
Posts: 49

PostPosted: Sat May 13, 2017 2:40 pm    Post subject: Question about the context menu Reply with quote

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
Back to top
View user's profile Send private message
Bill Root
Site Admin


Joined: 19 Jan 2004
Posts: 951
Location: Perrysburg, OH

PostPosted: Sun May 14, 2017 7:34 am    Post subject: Re: Question about the context menu Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
samsungpower



Joined: 22 May 2012
Posts: 49

PostPosted: Sun May 14, 2017 9:25 am    Post subject: Reply with quote

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:

Run('notepad');
Run('myprogram.exe');
Run('showargs.exe',
'"' + CallInfo.Name + '" ' +
'"' + CallInfo.Number + '" ' +
'"' + CallInfo.DateTimeStr + '" ');


Richard
Back to top
View user's profile Send private message
samsungpower



Joined: 22 May 2012
Posts: 49

PostPosted: Sun May 14, 2017 11:46 am    Post subject: Reply with quote

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

RUN "notepad.exe" "{Name} {Number} {DateTime}";


I will check tomorrow when I'am at the office on the computer.
Back to top
View user's profile Send private message
Bill Root
Site Admin


Joined: 19 Jan 2004
Posts: 951
Location: Perrysburg, OH

PostPosted: Sun May 14, 2017 12:49 pm    Post subject: Re: Question about the context menu Reply with quote

Hi Richard,

If you're using an advanced script, then you had it right the first time:
Code:
//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/docs/intro/running.htm

An example they give for passing arguments to an AutoIt script run through AutoIt is:
Code:
AutoIt3.exe myScript.au3 param1 "This is a string parameter" 99


You can access the parameters in your script thusly:
Code:
$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.



Quote:
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
Back to top
View user's profile Send private message Visit poster's website
samsungpower



Joined: 22 May 2012
Posts: 49

PostPosted: Mon May 15, 2017 6:53 pm    Post subject: Reply with quote

Bill,

Quote:
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.
Back to top
View user's profile Send private message
Bill Root
Site Admin


Joined: 19 Jan 2004
Posts: 951
Location: Perrysburg, OH

PostPosted: Mon May 15, 2017 7:11 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
samsungpower



Joined: 22 May 2012
Posts: 49

PostPosted: Mon May 15, 2017 7:45 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
samsungpower



Joined: 22 May 2012
Posts: 49

PostPosted: Tue May 16, 2017 6:46 am    Post subject: Reply with quote

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:
Send("{down 10}"
and the shift key with delay F10 for keyboard right click but didn't always have positive results.

Code:
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)
Back to top
View user's profile Send private message
Bill Root
Site Admin


Joined: 19 Jan 2004
Posts: 951
Location: Perrysburg, OH

PostPosted: Tue May 16, 2017 7:02 am    Post subject: Reply with quote

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:
//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:
$CmdLine[1]



Finest regards,
Bill Root
Ascendis Software LLC
Back to top
View user's profile Send private message Visit poster's website
samsungpower



Joined: 22 May 2012
Posts: 49

PostPosted: Tue May 16, 2017 2:49 pm    Post subject: Reply with quote

Bill, Very Happy Very Happy Very Happy 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.
Back to top
View user's profile Send private message
Bill Root
Site Admin


Joined: 19 Jan 2004
Posts: 951
Location: Perrysburg, OH

PostPosted: Wed May 17, 2017 6:23 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    ascendis.com Forum Index -> Other Issues - Ascendis Caller ID All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group