#cs ------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author:l Script Function: To start:USE HOTKEY: ALT + SHIFT + d #ce ------------------------------------------------------------- #include ; Press Esc to terminate script, Pause/Break to "pause" Global $g_bPaused = False Global $h = 0 ; handle variable global $iState = 0 ; window state global $titletext="" ; to save title of active window HotKeySet("{PAUSE}", "HotKeyPressed") HotKeySet("{ESC}", "HotKeyPressed") HotKeySet("+!d", "HotKeyPressed") ; Shift-Alt-d While 1 Sleep(100) WEnd Func HotKeyPressed() Switch @HotKeyPressed ; The last hotkey pressed. Case "{PAUSE}" ; String is the {PAUSE} hotkey. $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") Case "{ESC}" ; String is the {ESC} hotkey. Exit Case "+!d" ; String is the Shift-Alt-d hotkey. $h = WinWaitActive("[CLASS:MozillaWindowClass]", "", 1) If $h > 0 Then $titletext = WinGetTitle("[ACTIVE]") sleep(200) If StringInStr($titletext, "Gmail - Mozilla Firefox") > 0 Then $iState = WinGetState("[ACTIVE]") ; get active window's state sleep(200) if BitAND($iState,32) > 0 then Enter_Bcc_Stuff() ; initiate automation **** Else MsgBox(0, "Script Error", "Please Maximize FireFox window", 10) EndIf Else MsgBox(0, "Script Error", "Gmail Client not Active", 10) EndIf Else MsgBox(0, "Script Error", _ "FireFox not in Active Window", 10) EndIf EndSwitch EndFunc ;==>HotKeyPressed Func Enter_Bcc_Stuff() MouseClick("left", 1066, 467, 1, 0) ; click in the body MouseClick("left", 1024, 380, 1, 20) ; click in FROM: field Sleep(200) Send("Greg") ; key FROM name Sleep(500) ; wait for it MouseClick("left", 1087, 412, 1, 30) ; select first list entry Sleep(200) MouseClick("left", 1548, 377, 1, 40) ; click bbc button Send("Speakers Side") ; cursor is on TO: field. MouseClick("left", 1121, 439, 1, 50) ; select first list entry Sleep(1000) ; wait for it to expand Local $aPos = MouseGetPos() ; get current mouse position $aPos[1] = $aPos[1] + 300 ; y =y + 300 MouseClick("left", $aPos[0], $aPos[1], 1, 10) ; below expansion Sleep(200) ; wait MouseClick("left", 1078, 421, 1, 10) ; click on subject Send("fifth annual...") ; enter subject Sleep(200) ; wait a bit MouseClick("left", 1066, 467, 1) ; click in the body to end Sleep(500) ; wait Return EndFunc ;==>Enter_Bcc_Stuff