Jump to content

Just a funny agent script...


kjactive
 Share

Recommended Posts

This is just some holliday scriping puzzly ibetween dinners... - Agent component activate the ClippIt helper from MS Office - Agent component and ClippIt.acs is needed as well as latest AutoIt beta...

;********************************************************************************
; Microsoft Agent Example
;
; Requires Micrsoft Agent, L&H TrueVoice, and the ClippIt character
; Available from http://msdn.microsoft.com/workshop/imedia/agent/agentdl.asp
;********************************************************************************

HotKeySet("{Esc}", "Exits")
$strAgentName = 'ClippIt'
$strAgentPath = 'C:\Programmer\Microsoft office\Office10\' & $strAgentName & '.acs'

Global $oAgent = ObjCreate("Agent.Control")
if not IsObj($oAgent) then
    MsgBox(48,"ERROR...","Agent component failed...")
    Exits()
EndIf
GUICtrlCreateObj($oAgent, 0, 0 , 64 , 55 )

With $oAgent
    .Connected = -1
    $Characters = .Characters
    $Characters.Load($strAgentName, $strAgentPath)
    $Merlin = $Characters.Character($strAgentName)
EndWith
    
With $Merlin; default figur preferences ( 'Merlin' )
    .LanguageID = 2057;2057 US / 1031 UK / 1033 / 1036 / 3082 - controls speach...
    .Balloon.Style = 1;0 ballone text off
    .Show
EndWith

Intro()
ShowItAll()

While 1
Wend

Func Exits()
$Merlin.Play('hide')
$oAgent = 0
Exit
EndFunc

Func Intro()
With $Merlin
    .Think("Just a moment - ESC Quits Script.")
    .MoveTo(700,500)
    .Speak("Hello, I am " & $Merlin.Name)
    .Speak(". I would like to introduce you to the Microsoft Agent Active.X.")
    .Speak("Embedded. Compo.nent. text to voice feature.")
    .Speak('.Ummm.... ' & $Merlin.Name & ', Show it all')
    .Play("RestPose")
    .MoveTo(350,250)
EndWith
EndFunc

Func ShowItAll()
With $Merlin
    .Play("Alert");Straightens and raises eyebrows
    .Play("Congratulate");Displays trophy
    .Play('EmptyTrash');Character lights trash can on fire
    .Play("Explain");Extends arms to side
    .Play("GestureDown");Gestures down
    .Play("GestureLeft");Gestures to his left
    .Play("GestureRight");Gestures to his right
    .Play("GestureUp");Gestures up
    .Play('GetArtsy');Character puts on beret, holds palette, and paints
    .Play("GetAttention");Leans forward and knocks
    .Play('GetWizardy');Character puts on wizard hat and waves wand
    .Play('Goodbye');This is an elaborate disappear that begins in RestPose and ends with blank frame
    .Play('Greeting');This is an elaborate appear that begins with a blank frame, and ends in RestPose
    .Play("Idle1_1");Takes breath
    .Play("LookDown");Looks down
    .Play("LookDownLeft");Notices a row is inserted and glances at it
    .Play("LookLeft");Looks left
    .Play("LookDownRight");Notices a column is inserted and glances at it
    .Play("LookRight");Looks right
    .Play("LookUp");Looks up
    .Play("LookUpLeft");Notices toolbar button gets clicked and glances at it (Character isn't surprised as much as interested)
    .Play("LookUpRight");Notices toolbar button gets clicked and glances at it (Character isn't surprised as much as interested)
    .Play('Print');Grabs one piece of paper and sends it down to the printer
    .Play("RestPose"); Neutral position
    .Play('Save');Character puts something into a vault
    .Play('SendMail');Pulls out a letter and puts it into a mailbox
    .Play("Wave");Waves
    .Think("Don't he ever get tired - ESC Quits Script.")
EndWith
EndFunc

Other small animated helpers that fits right into this script are: exchange code

$strAgentName = 'OFFCAT'; or: MNATURE / LOGO / F1 / DOT / ROCKY - all part of MSOffice10
$strAgentPath = 'C:\Programmer\Microsoft Office\Office10\' & $strAgentName & '.acs'

Merry Christmas to you all...

Kjactive :P

Edited by kjactive
Link to comment
Share on other sites

So you did - but this script contains all 'non looping' actions, options to do default preferences settings and has no intuition only these happy little fellows...

Happy Newyear :P:lmao::(:)

kjactive :)

Edited by kjactive
Link to comment
Share on other sites

Just a quick update so it will work on more than just Office XP

$strAgentName = 'ClippIt'
;Get office XP or 2003
$OfficePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Word\InstallRoot", "Path"); Check for Office 2003
if @error Then
    $OfficePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Word\InstallRoot", "Path"); Check for Office XP
    if @error Then
        $OfficePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Word\InstallRoot", "Path");Check for Office 2000
        if @Error Then
            MsgBox(0, "Error", "Microsoft Office not detected")
            Exit
        EndIf
    EndIf
EndIf


$strAgentPath = $OfficePath & $strAgentName & '.acs'
Link to comment
Share on other sites

Well I just been down in documentation on the 'Clippy' object and found some new relations, mostly preferences settings, event handling, the loop animations and a motion handling function...

;********************************************************************************
; Microsoft Agent 'Clippy' R.I.P 2003 - Example
;
; Requires Micrsoft Agent, L&H TrueVoice, and the ClippIt character
; Available from http://msdn.microsoft.com/workshop/imedia/agent/agentdl.asp
;********************************************************************************
;#include <word.au3>
HotKeySet("{Esc}", "Exits")
$strAgentName = 'ClippIt'
;Get office XP or 2003
$OfficePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Word\InstallRoot", "Path"); Check for Office 2003
if @error Then
    $OfficePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Word\InstallRoot", "Path"); Check for Office XP
    if @error Then
        $OfficePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Word\InstallRoot", "Path");Check for Office 2000
        if @Error Then
            MsgBox(48, "ERROR...", "Microsoft Office not detected")
            Exit
        EndIf
    EndIf
EndIf


$strAgentPath = $OfficePath & $strAgentName & '.acs'
Global $oAgent = ObjCreate("Agent.Control")
Global $oAgentEvt = ObjEvent($oAgent,"Agent_")
if not IsObj($oAgent) then
    MsgBox(48,"ERROR...","Agent component failed...")
    Exits()
EndIf
GUICtrlCreateObj($oAgent, 0, 0 , 124, 93)

With $oAgent; defaults
    .Connected = False; Connected by INet to Microsoft server
    $Characters = .Characters
    $Characters.Load($strAgentName, $strAgentPath)
    $Characters.Character($strAgentName).ShowPopupMenu(100,100)
    $Merlin = $Characters.Character($strAgentName); create the character
EndWith
    
With $Merlin; default figur preferences ( 'Merlin' )
    .LanguageID = 2057;2057 US / 1031 UK / 1033 / 1036 / 3082 - controls speach...
    .Balloon.Style = 1;0 ballone text off
    .SoundEffectsOn = 1; turn attached default sound on / off
    _say(.Speed); Convert _say -> ConsoleWrite
    _say(.HasOtherClients )
    _say(.Top)
    _say(.Left)
    _say(.Width)
    _say(.height)
    _say(.Version)
    .Left = 100
    .Top = 100
    .Height = .Height + 10
    .Width = .Width + 10
    $MyRequest = .Show
EndWith

Intro()
ShowItAll()

While 1
Wend

;==================================================================
;Exits Close the 'clippy' object and remove the handle process
;argument: no , no returns
;==================================================================
Func Exits()
$Merlin.Play('hide')
$oAgentEvt = 0
$oAgent = 0
Exit
EndFunc

;==================================================================
;All Events retated
;argument: different options, no returns
;==================================================================
Func Agent_BalloonHide($ID)
    _say('Ballon hide: ' & $ID)
EndFunc

Func Agent_BalloonShow($ID)
    _say('Ballon Show: ' & $ID)
EndFunc

Func Agent_DragStart( $ID, $Button, $Shift, $X, $Y)
    _say('Dragstart: ' & $ID & ' ' & $button & ' ' & $shift & ' ' & $x & ' ' & $y)
EndFunc

Func Agent_DragComplete( $ID, $Button, $Shift, $X, $Y)
    _say('DragCpmplete: ' & $ID & ' ' & $button & ' ' & $shift & ' ' & $x & ' ' & $y)
EndFunc

Func Agent_Hide( $ID, $Cause)
    _say('Hide: ' & $ID & ' ' & $Cause)
EndFunc

Func Agent_Move( $ID, $x, $y, $Cause)
    _say('Move: ' & $ID & ' ' & $x & ' ' & $y & ' ' & $Cause)
EndFunc

Func Agent_Bookmark($BookmarkID)
    _say('Bookmark: ' & $BookmarkID)
EndFunc

Func Agent_RequestComplete($Request)
    _say('Request: ' & $Request)
EndFunc

;==================================================================
;Intro: Move the default object to spot
;argument: no, no returns
;==================================================================
Func Intro()
With $Merlin
    .Think("Just a moment - ESC Quits Script.")
    .MoveTo(700,500)
    .Speak("Hello, I am " & $Merlin.Name)
    .Speak(". I would like to introduce you to the Microsoft Agent Active.X.")
    .Speak("Embedded. Compo And here \mrk=100\it is.nent. text to voice feature.")
    .Speak('.Ummm.... ' & $Merlin.Name & ', Show it all')
    .MoveTo(350,250)
EndWith
EndFunc

;==================================================================
;ShowItAll Show all movements
;argument: no, no returns
;==================================================================
Func ShowItAll()
With $Merlin
    .Play("Alert");Straightens and raises eyebrows
    .Play("Congratulate");Displays trophy
    .Play('EmptyTrash');Character lights trash can on fire
    .Play("Explain");Extends arms to side
    .Play("GestureDown");Gestures down
    .Play("GestureLeft");Gestures to his left
    .Play("GestureRight");Gestures to his right
    .Play("GestureUp");Gestures up
    .Play('GetArtsy');Character puts on beret, holds palette, and paints
    .Play("GetAttention");Leans forward and knocks
    .Play('GetWizardy');Character puts on wizard hat and waves wand
    .Play('Goodbye');This is an elaborate disappear that begins in RestPose and ends with blank frame
    .Play('Greeting');This is an elaborate appear that begins with a blank frame, and ends in RestPose
    .Play("Idle1_1");Takes breath
    .Play("LookDown");Looks down
    .Play("LookDownLeft");Notices a row is inserted and glances at it
    .Play("LookLeft");Looks left
    .Play("LookDownRight");Notices a column is inserted and glances at it
    .Play("LookRight");Looks right
    .Play("LookUp");Looks up
    .Play("LookUpLeft");Notices toolbar button gets clicked and glances at it (Character isn't surprised as much as interested)
    .Play("LookUpRight");Notices toolbar button gets clicked and glances at it (Character isn't surprised as much as interested)
    .Play('Print');Grabs one piece of paper and sends it down to the printer
    Looping_Character("Processing",5000);Stirs cauldron (looping animation)
    .Play("RestPose"); Neutral position
    Looping_Character("Searching",5000);Looks into crystal ball (looping animation)
    .Play('Save');Character puts something into a vault
    .Play('SendMail');Pulls out a letter and puts it into a mailbox
    Looping_Character("Thinking",5000);Looks up with hand on chin (looping animation)
    Looping_Character("Writing",5000);Writes (looping animation)
    .Play("Wave");Waves
    .Think("Don't he ever get tired - ESC Quits Script.")
EndWith
EndFunc

;==================================================================
;Looping_Character; Do all the looping movements - into time related
;argument: movement / for how long, no returns
;==================================================================
Func Looping_Character($move,$time)
    $tmp = .Play($move)
    While $tmp.Status = 2
        Sleep(100)
    WEnd
    Sleep($time)
    .stop
EndFunc

Convert _Say -> ConsoleWrite as this is one of my fast debugging options from my word related UDF 'Word.au3' but else this should be self explenated...

'Clippy' got removed ( R.I.P. ) by Microsoft in 2003 but he is very funny and I attached the code to check for Office Object revisions bye 'Sykes' but as I'm using a 'revision unknown' call this is not truelly nessesary only to check 'Office installed or not' but as that it's alright...

Happy newyear to all...

kjactive :P

Edited by kjactive
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
 Share

  • Recently Browsing   0 members

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