Jump to content

Au3 Script To Conf Messenger


Recommended Posts

AutoIt script to configure messenger after xp install.

As this is my first script being posted if I have not

followed certain forum conventions, let me know.

; ---------------------------------------------------

; Set Messenger Options Preferences to

; not run when win starts, not allow to run background

; ---------------------------------------------------

;AutoItSetOption("WinTitleMatchMode", 4)

; ---------------------------------------------------

$bslash="\"

$DRV=@HomeDrive

$PGD=@ProgramFilesDir

$MSGDIR="\Messenger"

$MEXE="msmsgs.exe"

$messenger=$PGD&$MSGDIR&$bslash&$MEXE

$title01="Windows Messenger"

$wintext01="LogonWindow"

$title05="Options"

$wintext05="Personal"

$wintext07="Preferences"

; ---------------------------------------------------

If NOT FileExists( $messenger ) Then

MsgBox (0, $messenger, "Messenger program not found, Exiting")

Exit

Else

Run( $messenger )

EndIf

; ---------------------------------------------------

Sleep(100)

If WinWaitActive ( $title01, $wintext01 ) Then

Send ("+{F10}")

Send ("!TO")

Else

MsgBox (0, $title01, "waited for Messenger -- TIMEOUT")

EndIf

; ---------------------------------------------------

Sleep(100)

If WinWaitActive ( $title05, $wintext05 ) Then

ControlClick( $title05, $wintext05, "SysTabControl321")

Send ("{RIGHT 2}")

Sleep(100)

; notice we change to wintext07

ControlCommand( $title05, $wintext07, "Button1", "UnCheck", "" )

ControlCommand( $title05, $wintext07, "Button2", "UnCheck", "" )

ControlClick( $title05, $wintext07, "Button10")

Else

MsgBox (0, $title05, "waited for Options -- TIMEOUT")

EndIf

; ---------------------------------------------------

Sleep(100)

If WinWaitActive ( $title01, $wintext01 ) Then

Send ("+{F10}")

Send ("!FC")

Else

MsgBox (0, $title01, "waited for Messenger final pass -- TIMEOUT")

EndIf

Link to comment
Share on other sites


First off why is this not in the AutoIt thread...best if you stuff a copy in there for easy searching. :)

Below is who I'd write the script based off what you have...you may or may not find this helpful.

Dim $PID

; On Error Function
Func _error($text)
   MsgBox (0, "Windows Messenger", $text, 3)
   ProcessClose ( $PID )
   Exit
EndFunc

$messenger = @ProgramFilesDir & "\Messenger\msmsgs.exe"

; If Exists
If NOT FileExists( $messenger ) Then
  _error("Messenger program not found, Exiting")
Else
  $PID = Run( $messenger )
EndIf

; Logon Window #1
WinWaitActive ( "Windows Messenger", "LogonWindow", 2 )
If NOT WinExists ( "Windows Messenger", "LogonWindow" ) Then
  _error("waited for Messenger -- TIMEOUT")
EndIf
Send ("+{F10}!TO")

; Personal
WinWaitActive ( "Options", "Personal", 2)
If NOT WinExists ( "Options", "Personal" ) Then
  _error("waited for Options -- TIMEOUT")
EndIf
ControlClick( "Options", "", "SysTabControl321")
Send ("{RIGHT 2}")

; Preferences
WinWaitActive ( "Options", "Preferences", 2)
If NOT WinExists ( "Options", "Preferences" ) Then
  _error("waited for Preferences -- TIMEOUT")
EndIf
ControlCommand( "Options", "", "Button1", "UnCheck", "" )
ControlCommand( "Options", "", "Button2", "UnCheck", "" )
ControlClick  ( "Options", "", "Button10")

; Logon Window #2
WinWaitActive ( "Windows Messenger", "LogonWindow", 2 )
If NOT WinExists ( "Windows Messenger", "LogonWindow" ) Then
  _error("waited for Messenger final pass -- TIMEOUT")
EndIf
Send ("+{F10}!FC")

Really the only thing I honestly have to suggest is that you make your code a little more readable...other wise your doing a great job, keep up the good work. :)

Note:

I may have the Send keys hosed. ;)

Link to comment
Share on other sites

Greetings Nologic,

I looked around a bit but only saw the pinned autoit thread here under Application Installs. Not sure how to post to that thread. Also I must have fouled up the code tag or tags as my post got left justified and yours looks nice.

Anyway, liked your post and will analyze it for future reference.

Thanks

Link to comment
Share on other sites

Well last I checked the autoit thread wasn't locked. :)

Just list what the file is for and attach it in any file format (txt au3 zip rar) or if need be copy the code in...tho its best if the file is attached so the thread doesn't get to unmanageable over time. :)

Any ways its good to have another scripter around. :)

cya

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...