Products‎ > ‎Lync Contact Syncr‎ > ‎LyncCSCode‎ > ‎

Code 3/15/2012

posted Mar 15, 2012, 6:53 AM by Thad Williams
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\ICONS\link.ico
#AutoIt3Wrapper_Outfile=C:\Users\williams\Documents\Insync\thadwilliams@gmail.com\AUTOIT\LyncContactSyncr\LyncContactSyncr.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;
;Lync client contact refresher
;written by Thad, Seabyrd Tech
;no warranty implied or offered. use at your own risk. check the code yourself.
;questions: thad@seabyrdtech.com
;thanks

$Proc = ProcessExists ("communicator.exe")
if $Proc <> 0 Then
ProcessClose ("communicator.exe"); kills the LYNC process, communicator.exe
Else
$Continue = MsgBox (4, "Lync isn't running", "Lync doesn't seem to be running. Would you like to continue and delete your local sip cache anyway?")
if $Continue = 7 Then
Exit
EndIf
EndIf

sleep (4000); wait for the Lync process to fully close

$file = FileExists (@UserProfileDir&"\AppData\Local\Microsoft\Communicator\sip_*")
if $file = 1 Then
FileRecycle (@UserProfileDir&"\AppData\Local\Microsoft\Communicator\sip_*"); sends the user's sip_username@domain directory to the recycle bin
Else
MsgBox (0, "Can't find your sip profile", "I'm unable to find your sip profile where I expect it. Contact your system administrator.")
Exit
EndIf

sleep (2000); wait for the file operation to finish

$Lync32 = FileExists ("C:\Program Files\Microsoft Lync\communicator.exe");checks for LYNC in the 32 bit default directory
$Lync64 = FileExists ("C:\Program Files (x86)\Microsoft Lync\communicator.exe"); checks for LYNC in the 64 bit default directory
if $Lync32 = 1 Then
Run ("C:\Program Files\Microsoft Lync\communicator.exe"); runs Lync on 32 bit machine
ElseIf $Lync64 = 1 Then
Run ("C:\Program Files (x86)\Microsoft Lync\communicator.exe"); runs Lync on 64 bit machine
Else
MsgBox (0, "Can't find Lync", "I can't find where your Lync is installed. Please just launch it the way you normally do. Thanks")
EndIf

Exit
Comments