Community
Showing results for 
Search instead for 
Do you mean 
Reply

SDK TIMER PLUGIN - For background requests to ACT from any other App

Copper Contributor
Posts: 70
Country: USA

SDK TIMER PLUGIN - For background requests to ACT from any other App

Good day all.

 

From the Desk of Kevin Ritch - an old programmer with lotsa VB experience - and a wee bit of Dot Net as well :-)

 

The following Code Snippet may be of use to anyone who is trying to have a "Client App" perform background tasks for you in ACT without resorting to either Dot Net for that "calling application" or being an actual ACT SDK app at all.

 

In other words, when your Timer Plugin is working (coded and debugged to perform the real SDK work) you can control it from your VB6 Application or even some a script or plugin or addin in another application.

 

How cool is that?

 

  • TAPI INTERFACE
  • NO LOG-IN REQUIRED - USER IS ALREADY LOGGED INTO ACT
  • POP A CONTACT FROM OUTLOOK
  • CREATE AN ACT HTML EMAIL FROM AN EXTERNAL APP
  • WHATEVER & WHENEVER YOU WANT - THE IDEAS ARE ENDLESS

 

Because it may suit you to develop your background requests in ACT from Visual Basic 6.0 or any other easy language, you may benefit from having an automatic timer that activates when ACT LOADS.

 

Your timer should not interfere with ACT or cause any wierd effects if you use the "Windows" Timer in your class obj instead of the threading timer.

 

Here's some helpful code:

 

Imports Microsoft.VisualBasic
Imports
System
Imports
System.Threading
Imports
System.Windows.Forms
Imports
Act.Framework.Contacts
Imports
Act.UI
Imports System.Timers

 

Then set up the timer when ACT starts...

 

' ===============================================================
' FEEL FREE TO *MODIFY* AND MAKE USE OF ANY OF THIS CODE IN YOUR APPS 

' ===============================================================
Private Sub ActApp_AfterLogon(ByVal Sender As Object, ByVal e As System.EventArgs)

    AddMenuItem(
"act-ui://com.act/application/menu/tools/MyAppAboutBox", "MyAppAboutBox", New Act.UI.CommandHandler(AddressOf MyAppAboutBox))
   
AddHandler ActApp.ActFramework.Database.BeforeDatabaseLock, AddressOf ActApp_BeforeDatabaseLock


   
'=================================================
   'BUILD THE REQUEST CHECK TIMER (WINDOWS TIMER!!!)
   
'=================================================
    Dim T1 As New System.Windows.Forms.Timer
    T1.Interval = 1000
    T1.Enabled = True
    AddHandler T1.Tick, AddressOf Me.T1_Tick
    T1.Start()

End
Sub 'ActApp_AfterLogon

 

 

' And then ~ Process on your timer using this procedure

' =========================================

 

Public Sub T1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Thread.Sleep(0)
    Application.DoEvents()
   
'===========================================================
   ' CHECK IF A REQUEST HAS BEEN MADE FROM THE OUTSIDE "CALLING APP"
   ' AND IF THAT IS TRUE - GO AHEAD AND PERFORM THE SDK WORK AS NEEDED
   ' THEN RESET THE REQUEST FLAG SO THE CALLING APP KNOWS THE JOB'S DONE
   
'===========================================================
    
Dim CheckStr as String = "?"

    Dim MyReply as String = "0"
    Dim ClientRequestStr as String = "?"
    FileClose(0)
    FileOpen(1,
"c:\YourFolder\RequestCheck.txt", OpenMode.Binary, , OpenShare.Shared)
    CheckStr = InputString(1, 1)
    FileClose()
   '===================
   
'CHECK IF JOB REQUESTED
   
'===================
   
If CheckStr = "1" Then ' TASK REQUESTED !
       
FileClose()
        FileOpen(1,
"c:\YourFolder\MyFormattedRequest.txt", OpenMode.Input)
        ClientRequestStr = LineInput(1)
        FileClose()
       '==========================================================
       'INSERT YOUR GROOVY SDK DATA PROCESSING OR SCREEN POP OR WHATEVER
       '==========================================================
       ' Screen Pop Selected Contact/S

       ' Add History?

       ' Add Activity?

       ' Whatever Data Processing you want to do

       '

       ' No Need to LOG INTO ACT - The user is ALREADY LOGGED IN !!!

       '

       '=====================================================
       'TELL THE CLIENT APPLICATION THAT THE TASK HAS BEEN COMPLETED
       '=====================================================
       
Dim Dun as String = "2"
        FileOpen(1,
"c:\YourFolder\RequestCheck.txt", OpenMode.Binary, , OpenShare.Shared)
       
Try
           
FilePut(1, Dun, 1)
       
Catch ex As Exception
            'GUESS THERE WAS NO PROBLEM THEN :-)
       
End Try
   
End If
End Sub

 

Cheers,
Kevin
=========
Kevin Ritch
V8Software & CRM Solutions, Inc.
London & New York
=========================