Sign in to follow this  
Followers 0
Henry

Incoming calls.

8 posts in this topic

If you have a cell phone connected using a com port, this script could be useful to show incoming calls:

#Include <Constants.au3>

#NoTrayIcon

Opt("TrayOnEventMode",1)

Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

TraySetClick(16) ; Only secondary mouse button will show the tray menu.

Global $NetComm, $Com, $Iconpath

$Com = $CmdLine[1] ; Comnunication Port passed by command line

;$Com = "16" ; Comunication Port if not passed by command line

$Iconpath = ""

;$Iconpath = "e:\software\autoit\icons\" ; Use if icons are not into the same folder of CallerID.exe

$settingsitem = TrayCreateMenu("Settings")

$disableitem = TrayCreateItem("Disconnect phone on com"&$CmdLine[1], $settingsitem)

TrayItemSetOnEvent(-1,"Disable")

$enableitem = TrayCreateItem("Connect phone on com"&$CmdLine[1], $settingsitem)

TrayItemSetOnEvent(-1,"Enable")

TrayCreateItem("")

$aboutitem = TrayCreateItem("About")

TrayItemSetOnEvent(-1,"About")

TrayCreateItem("")

$exititem = TrayCreateItem("Exit")

TrayItemSetOnEvent(-1,"Exitscript")

TraySetState()

TraySetIcon($Iconpath&"phone_d.ico")

$start = False

While 1

If $start Then

$a=""

If $NetComm.InBufferCount > 0 Then

$a=$a&$NetComm.InputData

$a=StringTrimLeft($a,18)

$b=StringInStr($a,chr(34))

If $b>1 Then

$a=StringMid($a,1,$b-1)

MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from # +"&$a&" ", 4)

Else

MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from Private Number ", 4)

EndIf

Sleep(250)

EndIf

EndIf

Sleep(20)

WEnd

Exit

; Functions

Func About()

Msgbox(0, "About", " Display Caller ID for incoming calls - E. Schettini ", 3)

EndFunc

Func Disable()

$start = False

$NetComm.PortOpen = False

Msgbox(0, "CallerID "&"on COM"&$CmdLine[1], " Disconnecting "&"phone on com"&$CmdLine[1], 3)

TraySetIcon($Iconpath&"phone_d.ico")

EndFunc

Func Enable()

$start = True

$ft = True

$NetComm = ObjCreate("NETCommOCX.NETComm") ;Create NETComm.ocx object

;Set object settings

With $NetComm

.CommPort = $Com ;Set port number

.Settings = "9600,N,8,1" ;Set port settings

.InputLen = 0 ;reads entire buffer

.InputMode = 0 ;reads in text mode

.HandShaking = 3 ;uses both RTS and Xon/Xoff handshaking

.PortOpen = "True" ;opens specified COM port

.Output = "AT+CLIP=1" & Chr(13) ;set CLIP=1.

;.Output = "ATV1Q0" & Chr$(13) ;Ensure that the modem responds with "OK".

EndWith

If $ft Then

$ft = False

Sleep(2500)

$result = 0

While $result = 0

$result = StringInStr($NetComm.InputData, "OK")

WEnd

If $result <> 0 Then MsgBox(0, "CallerID on COM"&$CmdLine[1], " Connection to phone on com"&$CmdLine[1]&" established ", 2)

TraySetIcon($Iconpath&"phone_e.ico")

EndIf

EndFunc

Func Exitscript()

If $start = False Then

Exit

Else

$NetComm.PortOpen = False

Msgbox(0, "CallerID on COM"&$CmdLine[1], " Disconnecting phone on com"&$CmdLine[1]&" ", 3)

EndIf

Exit

EndFunc

Share this post


Link to post
Share on other sites



Mind editing the post: put

before your code and [*/code] after it (DO NOT PUT THE * IN)

Thanks,

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

ok Kurt, sorry ...

Here it is again:

 

#Include <Constants.au3>

#NoTrayIcon

Opt("TrayOnEventMode",1)

Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

TraySetClick(16) ; Only secondary mouse button will show the tray menu.

Global $NetComm, $Com, $Iconpath

$Com = $CmdLine[1] ; Comnunication Port passed by command line

;$Com = "16" ; Comunication Port if not passed by command line

$Iconpath = ""

;$Iconpath = "e:\software\autoit\icons\" ; Use if icons are not into the same folder of CallerID.exe

$settingsitem = TrayCreateMenu("Settings")

$disableitem = TrayCreateItem("Disconnect phone on com"&$CmdLine[1], $settingsitem)

TrayItemSetOnEvent(-1,"Disable")

$enableitem = TrayCreateItem("Connect phone on com"&$CmdLine[1], $settingsitem)

TrayItemSetOnEvent(-1,"Enable")

TrayCreateItem("")

$aboutitem = TrayCreateItem("About")

TrayItemSetOnEvent(-1,"About")

TrayCreateItem("")

$exititem = TrayCreateItem("Exit")

TrayItemSetOnEvent(-1,"Exitscript")

TraySetState()

TraySetIcon($Iconpath&"phone_d.ico")

$start = False

While 1

If $start Then

$a=""

If $NetComm.InBufferCount > 0 Then

$a=$a&$NetComm.InputData

$a=StringTrimLeft($a,18)

$b=StringInStr($a,chr(34))

If $b>1 Then

$a=StringMid($a,1,$b-1)

MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from # +"&$a&" ", 4)

Else

MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from Private Number ", 4)

EndIf

Sleep(250)

EndIf

EndIf

Sleep(20)

WEnd

Exit

; Functions

Func About()

Msgbox(0, "About", " Display Caller ID for incoming calls - E. Schettini ", 3)

EndFunc

Func Disable()

$start = False

$NetComm.PortOpen = False

Msgbox(0, "CallerID "&"on COM"&$CmdLine[1], " Disconnecting "&"phone on com"&$CmdLine[1], 3)

TraySetIcon($Iconpath&"phone_d.ico")

EndFunc

Func Enable()

$start = True

$ft = True

$NetComm = ObjCreate("NETCommOCX.NETComm") ;Create NETComm.ocx object

;Set object settings

With $NetComm

.CommPort = $Com ;Set port number

.Settings = "9600,N,8,1" ;Set port settings

.InputLen = 0 ;reads entire buffer

.InputMode = 0 ;reads in text mode

.HandShaking = 3 ;uses both RTS and Xon/Xoff handshaking

.PortOpen = "True" ;opens specified COM port

.Output = "AT+CLIP=1" & Chr(13) ;set CLIP=1.

;.Output = "ATV1Q0" & Chr$(13) ;Ensure that the modem responds with "OK".

EndWith

If $ft Then

$ft = False

Sleep(2500)

$result = 0

While $result = 0

$result = StringInStr($NetComm.InputData, "OK")

WEnd

If $result <> 0 Then MsgBox(0, "CallerID on COM"&$CmdLine[1], " Connection to phone on com"&$CmdLine[1]&" established ", 2)

TraySetIcon($Iconpath&"phone_e.ico")

EndIf

EndFunc

Func Exitscript()

If $start = False Then

Exit

Else

$NetComm.PortOpen = False

Msgbox(0, "CallerID on COM"&$CmdLine[1], " Disconnecting phone on com"&$CmdLine[1]&" ", 3)

EndIf

Exit

EndFunc

[*/code]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You shoudlt use * in the close code brackets

Just do as in autoit remove the semi colon so that it isnt commented and it will work

;
;
Edited by rambo3889

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!

Share this post


Link to post
Share on other sites

#Include <Constants.au3>
#NoTrayIcon

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1); Default tray menu items (Script Paused/Exit) will not be shown.

TraySetClick(16); Only secondary mouse button will show the tray menu.

Global $NetComm, $Com, $Iconpath

$Com = $CmdLine[1]; Comnunication Port passed by command line
;$Com = "16"; Comunication Port if not passed by command line
$Iconpath = ""
;$Iconpath = "e:\software\autoit\icons\"; Use if icons are not into the same folder of CallerID.exe

$settingsitem = TrayCreateMenu("Settings")

$disableitem = TrayCreateItem("Disconnect phone on com"&$CmdLine[1], $settingsitem)
TrayItemSetOnEvent(-1,"Disable")
$enableitem = TrayCreateItem("Connect phone on com"&$CmdLine[1], $settingsitem)
TrayItemSetOnEvent(-1,"Enable")
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"Exitscript")

TraySetState()

TraySetIcon($Iconpath&"phone_d.ico")

$start = False

While 1
If $start Then
$a=""
If $NetComm.InBufferCount > 0 Then
$a=$a&$NetComm.InputData
$a=StringTrimLeft($a,18)
$b=StringInStr($a,chr(34))
If $b>1 Then
$a=StringMid($a,1,$b-1)
MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from # +"&$a&" ", 4)
Else
MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from Private Number ", 4)
EndIf
Sleep(250)
EndIf
EndIf
Sleep(20)
WEnd

Exit


; Functions
Func About()
Msgbox(0, "About", " Display Caller ID for incoming calls - E. Schettini ", 3)
EndFunc

Func Disable()
$start = False
$NetComm.PortOpen = False
Msgbox(0, "CallerID "&"on COM"&$CmdLine[1], " Disconnecting "&"phone on com"&$CmdLine[1], 3)
TraySetIcon($Iconpath&"phone_d.ico")
EndFunc

Func Enable()
$start = True
$ft = True
$NetComm = ObjCreate("NETCommOCX.NETComm");Create NETComm.ocx object

;Set object settings
With $NetComm
.CommPort = $Com;Set port number
.Settings = "9600,N,8,1";Set port settings
.InputLen = 0;reads entire buffer
.InputMode = 0;reads in text mode
.HandShaking = 3;uses both RTS and Xon/Xoff handshaking
.PortOpen = "True";opens specified COM port
.Output = "AT+CLIP=1" & Chr(13);set CLIP=1.
;.Output = "ATV1Q0" & Chr$(13);Ensure that the modem responds with "OK".
EndWith

If $ft Then
$ft = False
Sleep(2500)
$result = 0
While $result = 0
$result = StringInStr($NetComm.InputData, "OK")
WEnd
If $result <> 0 Then MsgBox(0, "CallerID on COM"&$CmdLine[1], " Connection to phone on com"&$CmdLine[1]&" established ", 2)
TraySetIcon($Iconpath&"phone_e.ico")
EndIf
EndFunc

Func Exitscript()
If $start = False Then
Exit
Else
$NetComm.PortOpen = False
Msgbox(0, "CallerID on COM"&$CmdLine[1], " Disconnecting phone on com"&$CmdLine[1]&" ", 3)
EndIf
Exit
EndFunc

There is his code in the [ code] tags

Share this post


Link to post
Share on other sites

#Include <Constants.au3>
#NoTrayIcon

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1); Default tray menu items (Script Paused/Exit) will not be shown.

TraySetClick(16); Only secondary mouse button will show the tray menu.

Global $NetComm, $Com, $Iconpath

$Com = $CmdLine[1]; Comnunication Port passed by command line
;$Com = "16"; Comunication Port if not passed by command line
$Iconpath = ""
;$Iconpath = "e:\software\autoit\icons\"; Use if icons are not into the same folder of CallerID.exe

$settingsitem = TrayCreateMenu("Settings")

$disableitem = TrayCreateItem("Disconnect phone on com"&$CmdLine[1], $settingsitem)
TrayItemSetOnEvent(-1,"Disable")
$enableitem = TrayCreateItem("Connect phone on com"&$CmdLine[1], $settingsitem)
TrayItemSetOnEvent(-1,"Enable")
TrayCreateItem("")
$aboutitem = TrayCreateItem("About")
TrayItemSetOnEvent(-1,"About")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"Exitscript")

TraySetState()

TraySetIcon($Iconpath&"phone_d.ico")

$start = False

While 1
If $start Then
$a=""
If $NetComm.InBufferCount > 0 Then
$a=$a&$NetComm.InputData
$a=StringTrimLeft($a,18)
$b=StringInStr($a,chr(34))
If $b>1 Then
$a=StringMid($a,1,$b-1)
MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from # +"&$a&" ", 4)
Else
MsgBox(0, "CallerID "&"on COM"&$CmdLine[1], " Incoming call from Private Number ", 4)
EndIf
Sleep(250)
EndIf
EndIf
Sleep(20)
WEnd

Exit


; Functions
Func About()
Msgbox(0, "About", " Display Caller ID for incoming calls - E. Schettini ", 3)
EndFunc

Func Disable()
$start = False
$NetComm.PortOpen = False
Msgbox(0, "CallerID "&"on COM"&$CmdLine[1], " Disconnecting "&"phone on com"&$CmdLine[1], 3)
TraySetIcon($Iconpath&"phone_d.ico")
EndFunc

Func Enable()
$start = True
$ft = True
$NetComm = ObjCreate("NETCommOCX.NETComm");Create NETComm.ocx object

;Set object settings
With $NetComm
.CommPort = $Com;Set port number
.Settings = "9600,N,8,1";Set port settings
.InputLen = 0;reads entire buffer
.InputMode = 0;reads in text mode
.HandShaking = 3;uses both RTS and Xon/Xoff handshaking
.PortOpen = "True";opens specified COM port
.Output = "AT+CLIP=1" & Chr(13);set CLIP=1.
;.Output = "ATV1Q0" & Chr$(13);Ensure that the modem responds with "OK".
EndWith

If $ft Then
$ft = False
Sleep(2500)
$result = 0
While $result = 0
$result = StringInStr($NetComm.InputData, "OK")
WEnd
If $result <> 0 Then MsgBox(0, "CallerID on COM"&$CmdLine[1], " Connection to phone on com"&$CmdLine[1]&" established ", 2)
TraySetIcon($Iconpath&"phone_e.ico")
EndIf
EndFunc

Func Exitscript()
If $start = False Then
Exit
Else
$NetComm.PortOpen = False
Msgbox(0, "CallerID on COM"&$CmdLine[1], " Disconnecting phone on com"&$CmdLine[1]&" ", 3)
EndIf
Exit
EndFunc


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

Could this be used on a fixed line with a spare dialup modem/modem card that is lying around?

Share this post


Link to post
Share on other sites

doubt it, Im guessing this is a plugged-in cellphone. You would need a modem and some some software to do that although there is some nice programs out there(Roots around for old modem :whistle: )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0