rendered paste body#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.4.9
Author: yourName
Script Function:
Hack for: http://club.live.com/chicktionary.aspx
; Script Start - Add your code below here
#ce ----------------------------------------------------------------------------
;Include necessary constants.
#include <GUIConstants.au3>
$looping = True
; NOTE YOU MUST CHANGE THIS!
$windowTitle = "Chicktionary";
$safariCtrl = "[CLASS:WebPluginView; INSTANCE:1]"
$firefoxCtrl = "[CLASS:MozillaWindowClass; INSTANCE:6]"
$ieCtrl = "[CLASS:MacromediaFlashPlayerActiveX; INSTANCE:1]"
$controlTitle = ""
;Turn on the OnEvent Mode
Opt("GUIOnEventMode", 1)
;Create the Window
GUICreate("Chickabot", 225, 400)
;Hook into the Close Clicked Event
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
;Create the textbox
$sendData = GUICtrlCreateEdit("Fill in words here.", 10, 10, 180, 100)
$txtWinTitle = GUICtrlCreateEdit("Put Window Title Here", 10, 120, 180, 100)
$txtControlTitle = GUICtrlCreateCombo("FireFox", 10, 230, 180, 25)
GUICtrlSetData($txtControlTitle, "Internet Explorer|Safari", "Internet Explorer")
;Create the send button
$send = GUICtrlCreateButton("Send", 10, 265, 180, 25)
;Hook into the button
GUICtrlSetOnEvent($send, "SendButton")
;Show the window
GUISetState(@SW_SHOW)
;Our generic loop
While $looping == True
Sleep(1000) ; Idle around
WEnd
Func SendButton()
$wordmax = 16
$word3 = 0
$word4 = 0
$word5 = 0
$word6 = 0
$browser = GUICtrlRead($txtControlTitle)
If $browser == "FireFox" Then
$controlTitle = $firefoxCtrl
ElseIf $browser == "Internet Explorer" Then
$controlTitle = $ieCtrl
ElseIf $browser == "Safari" Then
$controlTitle = $safariCtrl
EndIf
$windowTitle = GUICtrlRead($txtWinTitle)
;Wait for the window...
WinWaitActive($windowTitle)
;Get an abnormally large array
Dim $array[2048]
$data = GUICtrlRead($sendData) ;Get the data from the textbox
$data = StringReplace($data, " ", "") ;Replace all the spaces
$array = StringSplit($data, ', \n', 0) ;Split the array based on commas
$colortest = 0x6Da219
;Loop through all the strings
For $word in $array
If StringLen($word) == 3 Then
$word3 = $word3 + 1
If $word3 > $wordmax Then
ContinueLoop
EndIf
ElseIf StringLen($word) == 4 Then
$word4 = $word4 + 1
If $word5 > $wordmax Then
ContinueLoop
EndIf
ElseIf StringLen($word) == 5 Then
$word5 = $word5 + 1
If $word5 > $wordmax Then
ContinueLoop
EndIf
EndIf
If Hex(PixelGetColor(530,379),6) == Hex($colortest,6) Then
; $i = 2055
ExitLoop
; MsgBox(1, "Hex Color", Hex(PixelGetColor(530,379),6))
; MsgBox(1, "Hex Color", Hex($colortest,6))
; MsgBox(1, "Hex Color Test", Hex(PixelGetColor(530,379),6) == Hex($colortest,6))
EndIf
$windowtitle = WinGetTitle("")
;Send the string and then sleep
ControlSend($windowtitle, "", $controlTitle, $word)
;Sleep(5)
;Send the enter button
ControlSend($windowtitle, "", $controlTitle, "{ENTER}")
;Sleep(5)
$windowtitle = WinGetTitle("")
;Just as a precautionary step, backspace enough to cancel out the typed word
;if necessary.
For $k = 0 to StringLen($word) Step 1
ControlSend($windowtitle, "", $controlTitle, "{BACKSPACE}")
;Sleep(5)
Next
Sleep(50)
Next
Return 0
EndFunc
Func CLOSEClicked()
;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE,
;and @GUI_WINHANDLE would equal $mainwindow
;MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
;Exit
$looping = False
Exit
EndFunc